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

Unified Diff: chrome/browser/sync/glue/preference_model_associator.cc

Issue 6288016: Handle sync values of wrong type more graceful (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clear pref if it's TYPE_NULL Created 9 years, 11 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: chrome/browser/sync/glue/preference_model_associator.cc
diff --git a/chrome/browser/sync/glue/preference_model_associator.cc b/chrome/browser/sync/glue/preference_model_associator.cc
index be0345e45ff784479cb9dccb2ee07a89592eea25..dd9cb967f94c8bc4c49f137eab06316791655c82 100644
--- a/chrome/browser/sync/glue/preference_model_associator.cc
+++ b/chrome/browser/sync/glue/preference_model_associator.cc
@@ -73,8 +73,15 @@ bool PreferenceModelAssociator::InitPrefNodeAndAssociate(
// Update the local preference based on what we got from the
// sync server.
- if (!pref->GetValue()->Equals(new_value.get()))
+ if (new_value->IsType(Value::TYPE_NULL)) {
+ pref_service->ClearPref(pref_name.c_str());
+ } else if (!new_value->IsType(pref->GetType())) {
+ LOG(WARNING) << "Synced value for " << preference.name()
+ << " is of type " << new_value->GetType()
+ << " which doesn't match pref type " << pref->GetType();
+ } else if (!pref->GetValue()->Equals(new_value.get())) {
pref_service->Set(pref_name.c_str(), *new_value);
+ }
AfterUpdateOperations(pref_name);
« 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