continue if there is an edit command for an item we don't have (just print a warning)
authorDan Mills <thunder@mozilla.com>
Mon, 30 Jun 2008 23:25:51 -0700
changeset 44858 8da2fa569698701d8d7e16dbc1ba6f30cece81d3
parent 44857 8e299aa505a0163cb820ca453d0e4ba5b4ff5125
child 44859 24533ce49adc4a507909b2cbb66c0ec077b040ee
push id14033
push useredward.lee@engineering.uiuc.edu
push dateWed, 23 Jun 2010 22:21:35 +0000
treeherderautoland@227db4ad8cdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
continue if there is an edit command for an item we don't have (just print a warning)
services/sync/modules/stores.js
--- a/services/sync/modules/stores.js
+++ b/services/sync/modules/stores.js
@@ -107,24 +107,24 @@ Store.prototype = {
 
   // override only if neccessary
   _itemExists: function Store__itemExists(GUID) {
     if (GUID in this._lookup)
       return true;
     else
       return false;
   },
-  
+
   // override these in derived objects
-  
+
   // wrap MUST save the wrapped store in the _lookup property!
   wrap: function Store_wrap() {
     throw "wrap needs to be subclassed";
   },
-  
+
   wipe: function Store_wipe() {
     throw "wipe needs to be subclassed";
   },
 
   _resetGUIDs: function Store__resetGUIDs() {
     let self = yield;
     throw "_resetGUIDs needs to be subclassed";
   },
@@ -196,17 +196,20 @@ SnapshotStore.prototype = {
         if (("parentGUID" in this._data[GUID]) &&
             (this._data[GUID].parentGUID == oldGUID))
           this._data[GUID].parentGUID = newGUID;
       }
     }
     for (let prop in command.data) {
       if (prop == "GUID")
         continue;
-      this._data[command.GUID][prop] = command.data[prop];
+      if (command.GUID in this._data)
+        this._data[command.GUID][prop] = command.data[prop];
+      else
+        this._log.warn("Warning! Edit command for unknown item: " + command.GUID);
     }
   },
 
   save: function SStore_save() {
     this._log.info("Saving snapshot to disk");
 
     let file = Utils.getProfileFile(
       {path: "weave/snapshots/" + this.filename,