Bug 1332556 - Set correct passwords' timestamps on first Sync. r=markh
authorEdouard Oger <eoger@fastmail.com>
Tue, 07 Feb 2017 12:56:56 -0500
changeset 388370 3c9874eb6cc33914a32d2b1dbc2fffc4f0722fb2
parent 388369 6b4c738bb0d8197e075cf60eddc9df5caf16a33c
child 388371 1e0dc444f8e3cd626b36e3ab16cfe416af427596
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1332556
milestone54.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 1332556 - Set correct passwords' timestamps on first Sync. r=markh MozReview-Commit-ID: Izg9sIeGNJo
services/sync/modules/engines/passwords.js
--- a/services/sync/modules/engines/passwords.js
+++ b/services/sync/modules/engines/passwords.js
@@ -76,30 +76,40 @@ PasswordEngine.prototype = {
         this._log.debug("Password deletes failed", ex);
       }
     }
   },
 
   _findDupe(item) {
     let login = this._store._nsLoginInfoFromRecord(item);
     if (!login) {
-      return;
+      return null;
     }
 
     let logins = Services.logins.findLogins({}, login.hostname, login.formSubmitURL, login.httpRealm);
 
     this._store._sleep(0); // Yield back to main thread after synchronous operation.
 
     // Look for existing logins that match the hostname, but ignore the password.
     for (let local of logins) {
       if (login.matches(local, true) && local instanceof Ci.nsILoginMetaInfo) {
         return local.guid;
       }
     }
+
+    return null;
   },
+
+  pullAllChanges() {
+    let changeset = new Changeset();
+    for (let [id, info] of Object.entries(this._store.getAllIDs())) {
+      changeset.set(id, info.timePasswordChanged);
+    }
+    return changeset;
+  }
 };
 
 function PasswordStore(name, engine) {
   Store.call(this, name, engine);
   this._nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1", Ci.nsILoginInfo, "init");
 }
 PasswordStore.prototype = {
   __proto__: Store.prototype,