summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
authorYaroslav Miroshnychenko <yaroslav.miroshnychenko@sonymobile.com>2012-04-20 13:24:53 +0200
committerKenneth Andersson <kenneth.andersson@sonymobile.com>2012-09-03 08:26:28 +0200
commit8eb920de3073bded959828bd4933affe577e7730 (patch)
treec884546503f7155510f6ea53b06b53025075e9d0 /Source/WebKit
parent5fe0a0bed6096da8fb7beef2708c36972d67b723 (diff)
downloadexternal_webkit-8eb920de3073bded959828bd4933affe577e7730.zip
external_webkit-8eb920de3073bded959828bd4933affe577e7730.tar.gz
external_webkit-8eb920de3073bded959828bd4933affe577e7730.tar.bz2
Remove inconsistency between HistoryItem writing/reading
Fixes inconsistent writing of HistoryItem formData for the case when formData is not null, but it gets flattened and saved as empty string. FormData identifier also gets written in that case, which creates problem on HistoryItem reading, when parser does not expect to meet form identifier after it reads zero as FormData size. Change-Id: I77cf00b5b2a0f2a7cf4355d1bc1b8d4830ac1afb
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/jni/WebHistory.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/WebKit/android/jni/WebHistory.cpp b/Source/WebKit/android/jni/WebHistory.cpp
index b6972e4..6b71d0f 100644
--- a/Source/WebKit/android/jni/WebHistory.cpp
+++ b/Source/WebKit/android/jni/WebHistory.cpp
@@ -472,10 +472,13 @@ static void writeItem(WTF::Vector<char>& vector, WebCore::HistoryItem* item)
// Form data
const WebCore::FormData* formData = item->formData();
if (formData) {
- writeString(vector, formData->flattenToString());
- // save the identifier as it is not included in the flatten data
- int64_t id = formData->identifier();
- vector.append((char*)&id, sizeof(int64_t));
+ WTF::String flattenedFormData = formData->flattenToString();
+ writeString(vector, flattenedFormData);
+ if (!flattenedFormData.isEmpty()) {
+ // save the identifier as it is not included in the flatten data
+ int64_t id = formData->identifier();
+ vector.append((char*)&id, sizeof(int64_t));
+ }
} else
writeString(vector, WTF::String()); // Empty constructor does not allocate a buffer.