Bug 1200472 - Move includeOtherSubdomainsInLookup pref lookup to LoginHelper. r=sfoster
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Tue, 12 Nov 2019 08:31:08 +0000
changeset 502093 d38c2fbd306bbb7ea365cef72acef93996cc034b
parent 502092 83b5015216e3d77250d48eb454dbd473e4b1be62
child 502094 877779162b15b1cf31b69187a7eb6be1d834f3df
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster
bugs1200472
milestone72.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 1200472 - Move includeOtherSubdomainsInLookup pref lookup to LoginHelper. r=sfoster Differential Revision: https://phabricator.services.mozilla.com/D51353
toolkit/components/passwordmgr/LoginHelper.jsm
toolkit/components/passwordmgr/LoginManagerParent.jsm
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -26,16 +26,17 @@ const { XPCOMUtils } = ChromeUtils.impor
  */
 this.LoginHelper = {
   debug: null,
   enabled: null,
   storageEnabled: null,
   formlessCaptureEnabled: null,
   generationAvailable: null,
   generationEnabled: null,
+  includeOtherSubdomainsInLookup: null,
   insecureAutofill: null,
   managementURI: null,
   privateBrowsingCaptureEnabled: null,
   schemeUpgrades: null,
   showAutoCompleteFooter: null,
 
   init() {
     // Watch for pref changes to update cached pref values.
@@ -59,16 +60,19 @@ this.LoginHelper = {
       "signon.generation.available"
     );
     this.generationEnabled = Services.prefs.getBoolPref(
       "signon.generation.enabled"
     );
     this.insecureAutofill = Services.prefs.getBoolPref(
       "signon.autofillForms.http"
     );
+    this.includeOtherSubdomainsInLookup = Services.prefs.getBoolPref(
+      "signon.includeOtherSubdomainsInLookup"
+    );
     this.managementURI = Services.prefs.getStringPref(
       "signon.management.overrideURI",
       null
     );
     this.privateBrowsingCaptureEnabled = Services.prefs.getBoolPref(
       "signon.privateBrowsingCapture.enabled"
     );
     this.schemeUpgrades = Services.prefs.getBoolPref("signon.schemeUpgrades");
--- a/toolkit/components/passwordmgr/LoginManagerParent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerParent.jsm
@@ -33,23 +33,16 @@ ChromeUtils.defineModuleGetter(
   "resource://gre/modules/PrivateBrowsingUtils.jsm"
 );
 
 XPCOMUtils.defineLazyGetter(this, "log", () => {
   let logger = LoginHelper.createLogger("LoginManagerParent");
   return logger.log.bind(logger);
 });
 
-XPCOMUtils.defineLazyPreferenceGetter(
-  this,
-  "INCLUDE_OTHER_SUBDOMAINS_IN_LOOKUP",
-  "signon.includeOtherSubdomainsInLookup",
-  false
-);
-
 const EXPORTED_SYMBOLS = ["LoginManagerParent"];
 
 /**
  * A listener for notifications to tests.
  */
 let gListenerForTests = null;
 
 /**
@@ -366,17 +359,17 @@ class LoginManagerParent extends JSWindo
     if (guid) {
       logins = LoginHelper.searchLoginsWithObject({
         guid,
       });
     } else {
       logins = this._searchAndDedupeLogins(formOrigin, {
         formActionOrigin: actionOrigin,
         ignoreActionAndRealm: true,
-        acceptDifferentSubdomains: INCLUDE_OTHER_SUBDOMAINS_IN_LOOKUP,
+        acceptDifferentSubdomains: LoginHelper.includeOtherSubdomainsInLookup,
       });
     }
 
     log("sendLoginDataToChild:", logins.length, "deduped logins");
     // Convert the array of nsILoginInfo to vanilla JS objects since nsILoginInfo
     // doesn't support structured cloning.
     let jsLogins = LoginHelper.loginsToVanillaObjects(logins);
     return { logins: jsLogins, recipes };
@@ -432,17 +425,17 @@ class LoginManagerParent extends JSWindo
       logins = LoginHelper.vanillaObjectsToLogins(previousResult.logins);
     } else {
       log("Creating new autocomplete search result.");
 
       // Autocomplete results do not need to match actionOrigin or exact origin.
       logins = this._searchAndDedupeLogins(formOrigin, {
         formActionOrigin: actionOrigin,
         ignoreActionAndRealm: true,
-        acceptDifferentSubdomains: INCLUDE_OTHER_SUBDOMAINS_IN_LOOKUP,
+        acceptDifferentSubdomains: LoginHelper.includeOtherSubdomainsInLookup,
       });
     }
 
     let matchingLogins = logins.filter(function(fullMatch) {
       let match = fullMatch.username;
 
       // Remove results that are too short, or have different prefix.
       // Also don't offer empty usernames as possible results except