Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: components/autofill/core/common/form_data.cc

Issue 443873011: Fix KDE Wallet backward compatibility when (de)serializing FormData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment & another TC. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/core/common/form_data_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/common/form_data.cc
diff --git a/components/autofill/core/common/form_data.cc b/components/autofill/core/common/form_data.cc
index 83d8173ace00f9c67b7a8689f826fc1e13a05cff..b720ae402ea4b72b049c1ce48df529dabc1c7a2a 100644
--- a/components/autofill/core/common/form_data.cc
+++ b/components/autofill/core/common/form_data.cc
@@ -13,7 +13,7 @@ namespace autofill {
namespace {
-const int kPickleVersion = 1;
+const int kPickleVersion = 2;
bool ReadGURL(PickleIterator* iter, GURL* url) {
std::string spec;
@@ -48,6 +48,11 @@ bool DeserializeFormFieldDataVector(PickleIterator* iter,
return true;
}
+void LogDeserializationError(int version) {
+ DVLOG(1) << "Could not deserialize version " << version
+ << " FormData from pickle.";
+}
+
} // namespace
FormData::FormData()
@@ -113,24 +118,36 @@ void SerializeFormData(const FormData& form_data, Pickle* pickle) {
bool DeserializeFormData(PickleIterator* iter, FormData* form_data) {
int version;
if (!iter->ReadInt(&version)) {
- LOG(ERROR) << "Bad pickle of FormData, no version present";
+ DVLOG(1) << "Bad pickle of FormData, no version present";
return false;
}
switch (version) {
case 1: {
+ base::string16 method;
if (!iter->ReadString16(&form_data->name) ||
+ !iter->ReadString16(&method) ||
!ReadGURL(iter, &form_data->origin) ||
!ReadGURL(iter, &form_data->action) ||
!iter->ReadBool(&form_data->user_submitted) ||
!DeserializeFormFieldDataVector(iter, &form_data->fields)) {
- LOG(ERROR) << "Could not deserialize FormData from pickle";
+ LogDeserializationError(version);
return false;
}
break;
}
+ case 2:
+ if (!iter->ReadString16(&form_data->name) ||
+ !ReadGURL(iter, &form_data->origin) ||
+ !ReadGURL(iter, &form_data->action) ||
+ !iter->ReadBool(&form_data->user_submitted) ||
+ !DeserializeFormFieldDataVector(iter, &form_data->fields)) {
+ LogDeserializationError(version);
+ return false;
+ }
+ break;
default: {
- LOG(ERROR) << "Unknown FormData pickle version " << version;
+ DVLOG(1) << "Unknown FormData pickle version " << version;
return false;
}
}
« no previous file with comments | « no previous file | components/autofill/core/common/form_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698