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

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: 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 | no next file » | 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..8eadba5b32db0f72d7a45c64ef9450e6aa8f7928 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) {
+ LOG(ERROR) << "Could not deserialize version " << version
+ << " FormData from pickle.";
Ilya Sherman 2014/08/07 19:23:31 nit: Please use DVLOG(1) here. (I do see that the
+}
+
} // namespace
FormData::FormData()
@@ -116,15 +121,27 @@ bool DeserializeFormData(PickleIterator* iter, FormData* form_data) {
LOG(ERROR) << "Bad pickle of FormData, no version present";
return false;
}
-
Ilya Sherman 2014/08/07 19:23:31 nit: Please preserve this newline.
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)) {
+ 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)) {
- LOG(ERROR) << "Could not deserialize FormData from pickle";
+ LogDeserializationError(version);
return false;
}
break;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698