Bug 1291346 - Fix updateLoginAnchor's search for form logins and delay it until the pref check. r=dolske draft
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Wed, 03 Aug 2016 15:47:44 -0700
changeset 396496 dee388aa123d59219b6b2cb8ff963c6fca948137
parent 396495 e37ea4fe1d80aec302c2c64f625a2882a207f519
child 527220 31b164f929b9e246cf7a745a51a70ead55b3f436
push id25020
push usermozilla@noorenberghe.ca
push dateWed, 03 Aug 2016 22:48:38 +0000
reviewersdolske
bugs1291346, 1164018, 1286718
milestone51.0a1
Bug 1291346 - Fix updateLoginAnchor's search for form logins and delay it until the pref check. r=dolske It's possible to write a test for this but that's already covered by bug 1164018 and this code should be removed in bug 1286718. MozReview-Commit-ID: 1LUG3MM4Op3
toolkit/components/passwordmgr/LoginManagerParent.jsm
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -504,37 +504,37 @@ var LoginManagerParent = {
         () => this.updateLoginAnchor(browser),
         ANCHOR_DELAY_MS
       );
     }
     state.anchorDeferredTask.arm();
   },
 
   updateLoginAnchor: Task.async(function* (browser) {
+    // Once this preference is removed, this version of the fill doorhanger
+    // should be enabled for Desktop only, and not for Android or B2G.
+    if (!Services.prefs.getBoolPref("signon.ui.experimental")) {
+      return;
+    }
+
     // Copy the state to use for this execution of the task. These will not
     // change during this execution of the asynchronous function, but in case a
     // change happens in the state, the function will be retriggered.
     let { loginFormOrigin, loginFormPresent } = this.stateForBrowser(browser);
 
     yield Services.logins.initializationPromise;
 
     // Check if there are form logins for the site, ignoring formSubmitURL.
     let hasLogins = loginFormOrigin &&
                     LoginHelper.searchLoginsWithObject({
-                      formSubmitURL: "",
+                      httpRealm: null,
                       hostname: loginFormOrigin,
                       schemeUpgrades: LoginHelper.schemeUpgrades,
                     }).length > 0;
 
-    // Once this preference is removed, this version of the fill doorhanger
-    // should be enabled for Desktop only, and not for Android or B2G.
-    if (!Services.prefs.getBoolPref("signon.ui.experimental")) {
-      return;
-    }
-
     let showLoginAnchor = loginFormPresent || hasLogins;
 
     let fillDoorhanger = LoginDoorhangers.FillDoorhanger.find({ browser });
     if (fillDoorhanger) {
       if (!showLoginAnchor) {
         fillDoorhanger.remove();
         return;
       }