Bug 1332556 - Set correct passwords' timestamps on first Sync. r?markh draft
authorEdouard Oger <eoger@fastmail.com>
Tue, 07 Feb 2017 12:56:56 -0500
changeset 479989 e1ef261ecfe37c65781d2c26447d0b726d4f2f13
parent 479958 e677ba018b22558fef1d07b74d416fd3a28a5dc3
child 544846 a3a58456d0a71115ee97c6f48802105abb91e037
push id44427
push userbmo:eoger@fastmail.com
push dateTue, 07 Feb 2017 17:55:30 +0000
reviewersmarkh
bugs1332556
milestone54.0a1
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,42 @@ 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();
+    let logins = Services.logins.getAllLogins({});
+    for (let login of logins) {
+      let metaInfo = login.QueryInterface(Ci.nsILoginMetaInfo);
+      changeset.set(metaInfo.guid, metaInfo.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,