Bug 1297238 - Make sync forms tracker respect ignoreAll property r=markh
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Fri, 23 Sep 2016 13:58:19 -0400
changeset 315325 b9e51f08329dd77b9d4e1fc93058c75343c6bcfe
parent 315324 d08f86205057efa876a903e1a7d6ad1115138b46
child 315326 f7c04fd81fc2632a8825e027459b3facafe5230f
push id30748
push usercbook@mozilla.com
push dateWed, 28 Sep 2016 13:53:19 +0000
treeherdermozilla-central@8c84b7618840 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1297238
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1297238 - Make sync forms tracker respect ignoreAll property r=markh MozReview-Commit-ID: AuIWNcRux3b
services/sync/modules/engines/forms.js
services/sync/tests/unit/test_forms_tracker.js
--- a/services/sync/modules/engines/forms.js
+++ b/services/sync/modules/engines/forms.js
@@ -228,17 +228,19 @@ FormTracker.prototype = {
   },
 
   stopTracking: function() {
     Svc.Obs.remove("satchel-storage-changed", this);
   },
 
   observe: function (subject, topic, data) {
     Tracker.prototype.observe.call(this, subject, topic, data);
-
+    if (this.ignoreAll) {
+      return;
+    }
     switch (topic) {
       case "satchel-storage-changed":
         if (data == "formhistory-add" || data == "formhistory-remove") {
           let guid = subject.QueryInterface(Ci.nsISupportsString).toString();
           this.trackEntry(guid);
         }
         break;
     }
--- a/services/sync/tests/unit/test_forms_tracker.js
+++ b/services/sync/tests/unit/test_forms_tracker.js
@@ -35,24 +35,38 @@ function run_test() {
     addEntry("email", "john@doe.com");
     do_check_attribute_count(tracker.changedIDs, 2);
 
     _("Notifying twice won't do any harm.");
     Svc.Obs.notify("weave:engine:start-tracking");
     addEntry("address", "Memory Lane");
     do_check_attribute_count(tracker.changedIDs, 3);
 
+
+    _("Check that ignoreAll is respected");
+    tracker.clearChangedIDs();
+    tracker.score = 0;
+    tracker.ignoreAll = true;
+    addEntry("username", "johndoe123");
+    addEntry("favoritecolor", "green");
+    removeEntry("name", "John Doe");
+    tracker.ignoreAll = false;
+    do_check_empty(tracker.changedIDs);
+    equal(tracker.score, 0);
+
     _("Let's stop tracking again.");
     tracker.clearChangedIDs();
     Svc.Obs.notify("weave:engine:stop-tracking");
     removeEntry("address", "Memory Lane");
     do_check_empty(tracker.changedIDs);
 
     _("Notifying twice won't do any harm.");
     Svc.Obs.notify("weave:engine:stop-tracking");
     removeEntry("email", "john@doe.com");
     do_check_empty(tracker.changedIDs);
 
+
+
   } finally {
     _("Clean up.");
     engine._store.wipe();
   }
 }