Bug 888692 - Missing trackChanges call in forms.js. r=markh, a=bajaj
authorRichard Newman <rnewman@mozilla.com>
Tue, 02 Jul 2013 12:30:10 -0700
changeset 147830 65da4fb308a60b4a7dcf286d2bd56b8b2c70957f
parent 147829 8cebe418300901f0f427b08e0d879aaa5e42edcc
child 147831 b38c1015fad212d806c83b076943b12b47b0af37
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh, bajaj
bugs888692
milestone24.0a2
Bug 888692 - Missing trackChanges call in forms.js. r=markh, a=bajaj
services/sync/modules/engines/forms.js
--- a/services/sync/modules/engines/forms.js
+++ b/services/sync/modules/engines/forms.js
@@ -238,26 +238,30 @@ FormTracker.prototype = {
             .getService(Ci.nsIObserverService)
             .removeObserver(this, "earlyformsubmit");
           this._enabled = false;
         }
         break;
       case "satchel-storage-changed":
         if (data == "formhistory-add" || data == "formhistory-remove") {
           let guid = subject.QueryInterface(Ci.nsISupportsString).toString();
-          this.addChangedID(guid);
-          this.score += SCORE_INCREMENT_MEDIUM;
+          this.trackEntry(guid);
         }
         break;
     case "profile-change-teardown":
       FormWrapper._finalize();
       break;
     }
   },
 
+  trackEntry: function (guid) {
+    this.addChangedID(guid);
+    this.score += SCORE_INCREMENT_MEDIUM;
+  },
+
   notify: function (formElement, aWindow, actionURI) {
     if (this.ignoreAll) {
       return;
     }
 
     this._log.trace("Form submission notification for " + actionURI.spec);
 
     // XXX Bug 487541 Copy the logic from nsFormHistory::Notify to avoid
@@ -315,13 +319,16 @@ FormTracker.prototype = {
       if (name === "") {
         this._log.trace("Text input element has no name or id");
         continue;
       }
 
       // Get the GUID on a delay so that it can be added to the DB first...
       Utils.nextTick(function() {
         this._log.trace("Logging form element: " + [name, el.value]);
-        this.trackEntry(name, el.value);
+        let guid = FormWrapper.getGUID(name, el.value);
+        if (guid) {
+          this.trackEntry(guid);
+        }
       }, this);
     }
   }
 };