Bug 1412332 - Enable sync passwords validator for nightly and beta users. r?markh draft
authorThom Chiovoloni <tchiovoloni@mozilla.com>
Wed, 31 Jan 2018 20:00:29 -0500
changeset 753032 9ba7c61723f5dbe949480152a334997bbaa5ed59
parent 752970 d49553765a743ebbd4f08e92a93c9d811ee064c2
push id98458
push userbmo:tchiovoloni@mozilla.com
push dateFri, 09 Feb 2018 14:20:01 +0000
reviewersmarkh
bugs1412332
milestone60.0a1
Bug 1412332 - Enable sync passwords validator for nightly and beta users. r?markh This also fixes an issue where our engine enabled preference listener was overzealous. MozReview-Commit-ID: DphLaEUkyOz
services/sync/modules/engines/passwords.js
services/sync/modules/service.js
services/sync/services-sync.js
--- a/services/sync/modules/engines/passwords.js
+++ b/services/sync/modules/engines/passwords.js
@@ -373,16 +373,20 @@ PasswordTracker.prototype = {
 
       case "removeAllLogins":
         this._log.trace(data);
         this.score += SCORE_INCREMENT_XLARGE;
         break;
     }
   },
 
+  getValidator() {
+    return new PasswordValidator();
+  },
+
   async _trackLogin(login) {
     if (Utils.getSyncCredentialsHosts().has(login.hostname)) {
       // Skip over Weave password/passphrase changes.
       return false;
     }
     const added = await this.addChangedID(login.guid);
     if (!added) {
       return false;
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -446,16 +446,21 @@ Sync11Service.prototype = {
           this._startTracking();
         }
         break;
       case "nsPref:changed":
         if (this._ignorePrefObserver) {
           return;
         }
         const engine = data.slice((PREFS_BRANCH + "engine.").length);
+        if (engine.includes(".")) {
+          // A sub-preference of the engine was changed. For example
+          // `services.sync.engine.bookmarks.validation.percentageChance`.
+          return;
+        }
         this._handleEngineStatusChanged(engine);
         break;
     }
   },
 
   _handleEngineStatusChanged(engine) {
     this._log.trace("Status for " + engine + " engine changed.");
     if (Svc.Prefs.get("engineStatusChanged." + engine, false)) {
--- a/services/sync/services-sync.js
+++ b/services/sync/services-sync.js
@@ -73,31 +73,35 @@ pref("services.sync.fxa.privacyURL", "ht
 
 pref("services.sync.telemetry.submissionInterval", 43200); // 12 hours in seconds
 pref("services.sync.telemetry.maxPayloadCount", 500);
 
 #ifdef EARLY_BETA_OR_EARLIER
 // Enable the (fairly costly) client/server validation through early Beta, but
 // not release candidates or Release.
 pref("services.sync.engine.bookmarks.validation.enabled", true);
+pref("services.sync.engine.passwords.validation.enabled", true);
 #endif
 
 #if defined(NIGHTLY_BUILD)
 // Enable repair of bookmarks on Nightly only - requires validation also be
 // enabled.
 pref("services.sync.engine.bookmarks.repair.enabled", true);
 #endif
 
 // We consider validation this frequently. After considering validation, even
 // if we don't end up validating, we won't try again unless this much time has passed.
 pref("services.sync.engine.bookmarks.validation.interval", 86400); // 24 hours in seconds
+pref("services.sync.engine.passwords.validation.interval", 86400); // 24 hours in seconds
 
 // We only run validation `services.sync.validation.percentageChance` percent of
 // the time, even if it's been the right amount of time since the last validation,
 // and you meet the maxRecord checks.
 pref("services.sync.engine.bookmarks.validation.percentageChance", 10);
+pref("services.sync.engine.passwords.validation.percentageChance", 10);
 
 // We won't validate an engine if it has more than this many records on the server.
 pref("services.sync.engine.bookmarks.validation.maxRecords", 1000);
+pref("services.sync.engine.passwords.validation.maxRecords", 1000);
 
 // The maximum number of immediate resyncs to trigger for changes made during
 // a sync.
 pref("services.sync.maxResyncs", 5);