Bug 1412890 - Enable ESLint rule mozilla/use-services for toolkit/components/passwordmgr. r?MattN draft
authorMark Banner <standard8@mozilla.com>
Mon, 30 Oct 2017 16:28:39 +0000
changeset 690080 c108966ffee68ee5bd12c2ffe79b691c0330954a
parent 689820 ee21e5f7f1c1726e0ed2697eb45df54cdceedd36
child 738480 063a42d3b0b1fac10d9cca0f9f1c78db2b43c03b
push id87202
push userbmo:standard8@mozilla.com
push dateWed, 01 Nov 2017 14:06:23 +0000
reviewersMattN
bugs1412890
milestone58.0a1
Bug 1412890 - Enable ESLint rule mozilla/use-services for toolkit/components/passwordmgr. r?MattN MozReview-Commit-ID: BNojtj1cAji
toolkit/components/passwordmgr/.eslintrc.js
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/passwordmgr/nsLoginManagerPrompter.js
toolkit/components/passwordmgr/storage-mozStorage.js
toolkit/components/passwordmgr/test/browser/browser_passwordmgr_fields.js
toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
toolkit/components/passwordmgr/test/browser/browser_username_select_dialog.js
toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
toolkit/components/passwordmgr/test/mochitest/test_autofill_password-only.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_html5.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwonly.html
toolkit/components/passwordmgr/test/mochitest/test_prompt.html
toolkit/components/passwordmgr/test/mochitest/test_prompt_http.html
toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth.html
toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
toolkit/components/passwordmgr/test/mochitest/test_username_focus.html
toolkit/components/passwordmgr/test/prompt_common.js
toolkit/components/passwordmgr/test/pwmgr_common.js
toolkit/components/passwordmgr/test/test_master_password.html
toolkit/components/passwordmgr/test/test_prompt_async.html
toolkit/components/passwordmgr/test/test_xhr.html
toolkit/components/passwordmgr/test/test_xml_load.html
tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-services.js
--- a/toolkit/components/passwordmgr/.eslintrc.js
+++ b/toolkit/components/passwordmgr/.eslintrc.js
@@ -4,10 +4,11 @@ module.exports = {
 
   "rules": {
     // XXX Bug 1358949 - This should be reduced down - probably to 20 or to
     // be removed & synced with the mozilla/recommended value.
     "complexity": ["error", 43],
 
     "no-unused-vars": ["error", {"args": "none", "vars": "local", "varsIgnorePattern": "^(ids|ignored|unused)$"}],
     "semi": ["error", "always"],
+    "mozilla/use-services": "error",
   }
 };
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -395,26 +395,23 @@ function DeleteSignon() {
     removeButton.setAttribute("disabled", "true");
     removeAllButton.setAttribute("disabled", "true");
   }
   tree.view.selection.selectEventsSuppressed = false;
   FinalizeSignonDeletions(syncNeeded);
 }
 
 function DeleteAllSignons() {
-  let prompter = Cc["@mozilla.org/embedcomp/prompt-service;1"]
-                           .getService(Ci.nsIPromptService);
-
   // Confirm the user wants to remove all passwords
   let dummy = { value: false };
-  if (prompter.confirmEx(window,
-                         kSignonBundle.getString("removeAllPasswordsTitle"),
-                         kSignonBundle.getString("removeAllPasswordsPrompt"),
-                         prompter.STD_YES_NO_BUTTONS + prompter.BUTTON_POS_1_DEFAULT,
-                         null, null, null, null, dummy) == 1) // 1 == "No" button
+  if (Services.prompt.confirmEx(window,
+    kSignonBundle.getString("removeAllPasswordsTitle"),
+    kSignonBundle.getString("removeAllPasswordsPrompt"),
+    Services.prompt.STD_YES_NO_BUTTONS + Services.prompt.BUTTON_POS_1_DEFAULT,
+    null, null, null, null, dummy) == 1) // 1 == "No" button
     return;
 
   let syncNeeded = signonsTreeView._filterSet.length != 0;
   let view = signonsTreeView;
   let table = GetVisibleLogins();
 
   // remove all items from table and place in deleted table
   for (let i = 0; i < table.length; i++) {
@@ -450,23 +447,22 @@ function TogglePasswordVisible() {
 
   // Notify observers that the password visibility toggling is
   // completed.  (Mostly useful for tests)
   Services.obs.notifyObservers(null, "passwordmgr-password-toggle-complete");
   Services.telemetry.getHistogramById("PWMGR_MANAGE_VISIBILITY_TOGGLED").add(showingPasswords);
 }
 
 function AskUserShowPasswords() {
-  let prompter = Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci.nsIPromptService);
   let dummy = { value: false };
 
   // Confirm the user wants to display passwords
-  return prompter.confirmEx(window,
+  return Services.prompt.confirmEx(window,
           null,
-          kSignonBundle.getString("noMasterPasswordPrompt"), prompter.STD_YES_NO_BUTTONS,
+          kSignonBundle.getString("noMasterPasswordPrompt"), Services.prompt.STD_YES_NO_BUTTONS,
           null, null, null, null, dummy) == 0; // 0=="Yes" button
 }
 
 function FinalizeSignonDeletions(syncNeeded) {
   for (let s = 0; s < deletedSignons.length; s++) {
     Services.logins.removeLogin(deletedSignons[s]);
     Services.telemetry.getHistogramById("PWMGR_MANAGE_DELETED").add(1);
   }
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -82,22 +82,22 @@ LoginManagerPromptFactory.prototype = {
       return;
     }
 
     // If login manger has logins for this host, defer prompting if we're
     // already waiting on a master password entry.
     var prompt = this._asyncPrompts[hashKey];
     var prompter = prompt.prompter;
     var [hostname, httpRealm] = prompter._getAuthTarget(prompt.channel, prompt.authInfo);
-    var hasLogins = (prompter._pwmgr.countLogins(hostname, null, httpRealm) > 0);
+    var hasLogins = (Services.logins.countLogins(hostname, null, httpRealm) > 0);
     if (!hasLogins && LoginHelper.schemeUpgrades && hostname.startsWith("https://")) {
       let httpHostname = hostname.replace(/^https:\/\//, "http://");
-      hasLogins = (prompter._pwmgr.countLogins(httpHostname, null, httpRealm) > 0);
+      hasLogins = (Services.logins.countLogins(httpHostname, null, httpRealm) > 0);
     }
-    if (hasLogins && prompter._pwmgr.uiBusy) {
+    if (hasLogins && Services.logins.uiBusy) {
       this.log("_doAsyncPrompt:run bypassed, master password UI busy");
       return;
     }
 
     // Allow only a limited number of authentication dialogs when they are all
     // canceled by the user.
     var cancelationCounter = (prompter._browser && prompter._browser.canceledAuthenticationPromptCounter) || { count: 0, id: 0 };
     if (prompt.channel) {
@@ -246,40 +246,20 @@ LoginManagerPrompter.prototype = {
                                           Ci.nsIAuthPrompt2,
                                           Ci.nsILoginManagerPrompter]),
 
   _factory: null,
   _chromeWindow: null,
   _browser: null,
   _opener: null,
 
-  __pwmgr: null, // Password Manager service
-  get _pwmgr() {
-    if (!this.__pwmgr)
-      this.__pwmgr = Cc["@mozilla.org/login-manager;1"].
-                     getService(Ci.nsILoginManager);
-    return this.__pwmgr;
-  },
-
-  __promptService: null, // Prompt service for user interaction
-  get _promptService() {
-    if (!this.__promptService)
-      this.__promptService =
-          Cc["@mozilla.org/embedcomp/prompt-service;1"].
-          getService(Ci.nsIPromptService);
-    return this.__promptService;
-  },
-
-
   __strBundle: null, // String bundle for L10N
   get _strBundle() {
     if (!this.__strBundle) {
-      var bunService = Cc["@mozilla.org/intl/stringbundle;1"].
-                       getService(Ci.nsIStringBundleService);
-      this.__strBundle = bunService.createBundle(
+      this.__strBundle = Services.strings.createBundle(
                   "chrome://passwordmgr/locale/passwordmgr.properties");
       if (!this.__strBundle)
         throw new Error("String bundle for Login Manager not present!");
     }
 
     return this.__strBundle;
   },
 
@@ -328,17 +308,17 @@ LoginManagerPrompter.prototype = {
                                      Cr.NS_ERROR_NOT_IMPLEMENTED);
 
     this.log("===== prompt() called =====");
 
     if (aDefaultText) {
       aResult.value = aDefaultText;
     }
 
-    return this._promptService.prompt(this._chromeWindow,
+    return Services.prompt.prompt(this._chromeWindow,
            aDialogTitle, aText, aResult, null, {});
   },
 
 
   /**
    * Looks up a username and password in the database. Will prompt the user
    * with a dialog, even if a username and password are found.
    */
@@ -358,25 +338,25 @@ LoginManagerPrompter.prototype = {
     // If hostname is null, we can't save this login.
     if (hostname) {
       var canRememberLogin;
       if (this._inPrivateBrowsing)
         canRememberLogin = false;
       else
         canRememberLogin = (aSavePassword ==
                             Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
-                           this._pwmgr.getLoginSavingEnabled(hostname);
+                           Services.logins.getLoginSavingEnabled(hostname);
 
       // if checkBoxLabel is null, the checkbox won't be shown at all.
       if (canRememberLogin)
         checkBoxLabel = this._getLocalizedString("rememberPassword");
 
       // Look for existing logins.
-      var foundLogins = this._pwmgr.findLogins({}, hostname, null,
-                                  realm);
+      var foundLogins = Services.logins.findLogins({}, hostname, null,
+                                                   realm);
 
       // XXX Like the original code, we can't deal with multiple
       // account selection. (bug 227632)
       if (foundLogins.length > 0) {
         selectedLogin = foundLogins[0];
 
         // If the caller provided a username, try to use it. If they
         // provided only a password, this will try to find a password-only
@@ -390,17 +370,17 @@ LoginManagerPrompter.prototype = {
           aUsername.value = selectedLogin.username;
           // If the caller provided a password, prefer it.
           if (!aPassword.value)
             aPassword.value = selectedLogin.password;
         }
       }
     }
 
-    var ok = this._promptService.promptUsernameAndPassword(this._chromeWindow,
+    var ok = Services.prompt.promptUsernameAndPassword(this._chromeWindow,
                 aDialogTitle, aText, aUsername, aPassword,
                 checkBoxLabel, checkBox);
 
     if (!ok || !checkBox.value || !hostname)
       return ok;
 
     if (!aPassword.value) {
       this.log("No password entered, so won't offer to save.");
@@ -416,17 +396,17 @@ LoginManagerPrompter.prototype = {
     // changed, save as a new login.
     let newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
                    createInstance(Ci.nsILoginInfo);
     newLogin.init(hostname, null, realm,
                   aUsername.value, aPassword.value, "", "");
     if (!selectedLogin) {
       // add as new
       this.log("New login seen for " + realm);
-      this._pwmgr.addLogin(newLogin);
+      Services.logins.addLogin(newLogin);
     } else if (aPassword.value != selectedLogin.password) {
       // update password
       this.log("Updating password for  " + realm);
       this._updateLogin(selectedLogin, newLogin);
     } else {
       this.log("Login unchanged, no further action needed.");
       this._updateLogin(selectedLogin);
     }
@@ -456,54 +436,54 @@ LoginManagerPrompter.prototype = {
     var [hostname, realm, username] = this._getRealmInfo(aPasswordRealm);
 
     username = decodeURIComponent(username);
 
     // If hostname is null, we can't save this login.
     if (hostname && !this._inPrivateBrowsing) {
       var canRememberLogin = (aSavePassword ==
                               Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
-                             this._pwmgr.getLoginSavingEnabled(hostname);
+                             Services.logins.getLoginSavingEnabled(hostname);
 
       // if checkBoxLabel is null, the checkbox won't be shown at all.
       if (canRememberLogin)
         checkBoxLabel = this._getLocalizedString("rememberPassword");
 
       if (!aPassword.value) {
         // Look for existing logins.
-        var foundLogins = this._pwmgr.findLogins({}, hostname, null,
-                                          realm);
+        var foundLogins = Services.logins.findLogins({}, hostname, null,
+                                                     realm);
 
         // XXX Like the original code, we can't deal with multiple
         // account selection (bug 227632). We can deal with finding the
         // account based on the supplied username - but in this case we'll
         // just return the first match.
         for (var i = 0; i < foundLogins.length; ++i) {
           if (foundLogins[i].username == username) {
             aPassword.value = foundLogins[i].password;
             // wallet returned straight away, so this mimics that code
             return true;
           }
         }
       }
     }
 
-    var ok = this._promptService.promptPassword(this._chromeWindow, aDialogTitle,
-                                                aText, aPassword,
-                                                checkBoxLabel, checkBox);
+    var ok = Services.prompt.promptPassword(this._chromeWindow, aDialogTitle,
+                                            aText, aPassword,
+                                            checkBoxLabel, checkBox);
 
     if (ok && checkBox.value && hostname && aPassword.value) {
       var newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
                      createInstance(Ci.nsILoginInfo);
       newLogin.init(hostname, null, realm, username,
                     aPassword.value, "", "");
 
       this.log("New login seen for " + realm);
 
-      this._pwmgr.addLogin(newLogin);
+      Services.logins.addLogin(newLogin);
     }
 
     return ok;
   },
 
   /* ---------- nsIAuthPrompt helpers ---------- */
 
 
@@ -594,17 +574,17 @@ LoginManagerPrompter.prototype = {
 
           this.log("Autologin enabled, skipping auth prompt.");
           canAutologin = true;
         }
 
         checkbox.value = true;
       }
 
-      var canRememberLogin = this._pwmgr.getLoginSavingEnabled(hostname);
+      var canRememberLogin = Services.logins.getLoginSavingEnabled(hostname);
       if (this._inPrivateBrowsing)
         canRememberLogin = false;
 
       // if checkboxLabel is null, the checkbox won't be shown at all.
       notifyObj = this._getPopupNote() || this._getNotifyBox();
       if (canRememberLogin && !notifyObj)
         checkboxLabel = this._getLocalizedString("rememberPassword");
     } catch (e) {
@@ -613,19 +593,19 @@ LoginManagerPrompter.prototype = {
       Components.utils.reportError("LoginManagerPrompter: " +
           "Epic fail in promptAuth: " + e + "\n");
     }
 
     var ok = canAutologin;
     if (!ok) {
       if (this._chromeWindow)
         PromptUtils.fireDialogEvent(this._chromeWindow, "DOMWillOpenModalDialog", this._browser);
-      ok = this._promptService.promptAuth(this._chromeWindow,
-                                          aChannel, aLevel, aAuthInfo,
-                                          checkboxLabel, checkbox);
+      ok = Services.prompt.promptAuth(this._chromeWindow,
+                                      aChannel, aLevel, aAuthInfo,
+                                      checkboxLabel, checkbox);
     }
 
     // If there's a notification box, use it to allow the user to
     // determine if the login should be saved. If there isn't a
     // notification box, only save the login if the user set the
     // checkbox to do so.
     var rememberLogin = notifyObj ? canRememberLogin : checkbox.value;
     if (!ok || !rememberLogin || epicfail)
@@ -652,17 +632,17 @@ LoginManagerPrompter.prototype = {
                     username, password, "", "");
       if (!selectedLogin) {
         this.log("New login seen for " + username +
                  " @ " + hostname + " (" + httpRealm + ")");
 
         if (notifyObj)
           this._showSaveLoginNotification(notifyObj, newLogin);
         else
-          this._pwmgr.addLogin(newLogin);
+          Services.logins.addLogin(newLogin);
       } else if (password != selectedLogin.password) {
         this.log("Updating password for " + username +
                  " @ " + hostname + " (" + httpRealm + ")");
         if (notifyObj)
           this._showChangeLoginNotification(notifyObj,
                                             selectedLogin, newLogin);
         else
           this._updateLogin(selectedLogin, newLogin);
@@ -1089,47 +1069,42 @@ LoginManagerPrompter.prototype = {
     var rememberButtonAccessKey =
           this._getLocalizedString("notifyBarRememberPasswordButtonAccessKey");
 
     var displayHost = this._getShortDisplayHost(aLogin.hostname);
     var notificationText = this._getLocalizedString(
                                   "rememberPasswordMsgNoUsername",
                                   [displayHost]);
 
-    // The callbacks in |buttons| have a closure to access the variables
-    // in scope here; set one to |this._pwmgr| so we can get back to pwmgr
-    // without a getService() call.
-    var pwmgr = this._pwmgr;
-
     // Notification is a PopupNotification
     if (aNotifyObj == this._getPopupNote()) {
       this._showLoginCaptureDoorhanger(aLogin, "password-save");
     } else {
       var notNowButtonText =
             this._getLocalizedString("notifyBarNotNowButtonText");
       var notNowButtonAccessKey =
             this._getLocalizedString("notifyBarNotNowButtonAccessKey");
       var buttons = [
         // "Remember" button
         {
           label:     rememberButtonText,
           accessKey: rememberButtonAccessKey,
           popup:     null,
           callback(aNotifyObj, aButton) {
-            pwmgr.addLogin(aLogin);
+            Services.logins.addLogin(aLogin);
           }
         },
 
         // "Never for this site" button
         {
           label:     neverButtonText,
           accessKey: neverButtonAccessKey,
           popup:     null,
           callback(aNotifyObj, aButton) {
-            pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
+            Services.logins.setLoginSavingEnabled(aLogin.hostname, false);
           }
         },
 
         // "Not now" button
         {
           label:     notNowButtonText,
           accessKey: notNowButtonAccessKey,
           popup:     null,
@@ -1197,31 +1172,31 @@ LoginManagerPrompter.prototype = {
     var neverButtonText    = this._getLocalizedString(
                                     "neverForSiteButtonText");
     var rememberButtonText = this._getLocalizedString(
                                     "rememberButtonText");
     var notNowButtonText   = this._getLocalizedString(
                                     "notNowButtonText");
 
     this.log("Prompting user to save/ignore login");
-    var userChoice = this._promptService.confirmEx(this._chromeWindow,
-                                        dialogTitle, dialogText,
-                                        buttonFlags, rememberButtonText,
-                                        notNowButtonText, neverButtonText,
-                                        null, {});
+    var userChoice = Services.prompt.confirmEx(this._chromeWindow,
+                                               dialogTitle, dialogText,
+                                               buttonFlags, rememberButtonText,
+                                               notNowButtonText, neverButtonText,
+                                               null, {});
     //  Returns:
     //   0 - Save the login
     //   1 - Ignore the login this time
     //   2 - Never save logins for this site
     if (userChoice == 2) {
       this.log("Disabling " + aLogin.hostname + " logins by request.");
-      this._pwmgr.setLoginSavingEnabled(aLogin.hostname, false);
+      Services.logins.setLoginSavingEnabled(aLogin.hostname, false);
     } else if (userChoice == 0) {
       this.log("Saving login for " + aLogin.hostname);
-      this._pwmgr.addLogin(aLogin);
+      Services.logins.addLogin(aLogin);
     } else {
       // userChoice == 1 --> just ignore the login.
       this.log("Ignoring login.");
     }
 
     Services.obs.notifyObservers(aLogin, "passwordmgr-prompt-save");
   },
 
@@ -1267,21 +1242,16 @@ LoginManagerPrompter.prototype = {
           this._getLocalizedString("notifyBarUpdateButtonAccessKey");
 
     // We reuse the existing message, even if it expects a username, until we
     // switch to the final terminology in bug 1144856.
     var displayHost = this._getShortDisplayHost(aOldLogin.hostname);
     var notificationText = this._getLocalizedString("updatePasswordMsg",
                                                     [displayHost]);
 
-    // The callbacks in |buttons| have a closure to access the variables
-    // in scope here; set one to |this._pwmgr| so we can get back to pwmgr
-    // without a getService() call.
-    var self = this;
-
     // Notification is a PopupNotification
     if (aNotifyObj == this._getPopupNote()) {
       aOldLogin.hostname = aNewLogin.hostname;
       aOldLogin.formSubmitURL = aNewLogin.formSubmitURL;
       aOldLogin.password = aNewLogin.password;
       aOldLogin.username = aNewLogin.username;
       this._showLoginCaptureDoorhanger(aOldLogin, "password-change");
     } else {
@@ -1291,17 +1261,17 @@ LoginManagerPrompter.prototype = {
             this._getLocalizedString("notifyBarDontChangeButtonAccessKey");
       var buttons = [
         // "Yes" button
         {
           label:     changeButtonText,
           accessKey: changeButtonAccessKey,
           popup:     null,
           callback(aNotifyObj, aButton) {
-            self._updateLogin(aOldLogin, aNewLogin);
+            Services.logins._updateLogin(aOldLogin, aNewLogin);
           }
         },
 
         // "No" button
         {
           label:     dontChangeButtonText,
           accessKey: dontChangeButtonAccessKey,
           popup:     null,
@@ -1334,20 +1304,20 @@ LoginManagerPrompter.prototype = {
     else
       dialogText  = this._getLocalizedString(
                               "updatePasswordMsgNoUser");
 
     var dialogTitle = this._getLocalizedString(
                                 "passwordChangeTitle");
 
     // returns 0 for yes, 1 for no.
-    var ok = !this._promptService.confirmEx(this._chromeWindow,
-                            dialogTitle, dialogText, buttonFlags,
-                            null, null, null,
-                            null, {});
+    var ok = !Services.prompt.confirmEx(this._chromeWindow,
+                                        dialogTitle, dialogText, buttonFlags,
+                                        null, null, null,
+                                        null, {});
     if (ok) {
       this.log("Updating password for user " + aOldLogin.username);
       this._updateLogin(aOldLogin, aNewLogin);
     }
 
     let oldGUID = aOldLogin.QueryInterface(Ci.nsILoginMetaInfo).guid;
     Services.obs.notifyObservers(aNewLogin, "passwordmgr-prompt-change", oldGUID);
   },
@@ -1369,20 +1339,20 @@ LoginManagerPrompter.prototype = {
 
     var usernames = logins.map(l => l.username);
     var dialogText  = this._getLocalizedString("userSelectText2");
     var dialogTitle = this._getLocalizedString("passwordChangeTitle");
     var selectedIndex = { value: null };
 
     // If user selects ok, outparam.value is set to the index
     // of the selected username.
-    var ok = this._promptService.select(this._chromeWindow,
-                            dialogTitle, dialogText,
-                            usernames.length, usernames,
-                            selectedIndex);
+    var ok = Services.prompt.select(this._chromeWindow,
+                                    dialogTitle, dialogText,
+                                    usernames.length, usernames,
+                                    selectedIndex);
     if (ok) {
       // Now that we know which login to use, modify its password.
       var selectedLogin = logins[selectedIndex.value];
       this.log("Updating password for user " + selectedLogin.username);
       var newLoginWithUsername = Cc["@mozilla.org/login-manager/loginInfo;1"].
                      createInstance(Ci.nsILoginInfo);
       newLoginWithUsername.init(aNewLogin.hostname,
                                 aNewLogin.formSubmitURL, aNewLogin.httpRealm,
@@ -1411,17 +1381,17 @@ LoginManagerPrompter.prototype = {
       propBag.setProperty("username", aNewLogin.username);
       // Explicitly set the password change time here (even though it would
       // be changed automatically), to ensure that it's exactly the same
       // value as timeLastUsed.
       propBag.setProperty("timePasswordChanged", now);
     }
     propBag.setProperty("timeLastUsed", now);
     propBag.setProperty("timesUsedIncrement", 1);
-    this._pwmgr.modifyLogin(login, propBag);
+    Services.logins.modifyLogin(login, propBag);
   },
 
   /**
    * Given a content DOM window, returns the chrome window and browser it's in.
    */
   _getChromeWindow(aWindow) {
     // Handle non-e10s toolkit consumers.
     if (!Cu.isCrossProcessWrapper(aWindow)) {
@@ -1585,23 +1555,21 @@ LoginManagerPrompter.prototype = {
   /**
    * Converts a login's hostname field (a URL) to a short string for
    * prompting purposes. Eg, "http://foo.com" --> "foo.com", or
    * "ftp://www.site.co.uk" --> "site.co.uk".
    */
   _getShortDisplayHost(aURIString) {
     var displayHost;
 
-    var eTLDService = Cc["@mozilla.org/network/effective-tld-service;1"].
-                      getService(Ci.nsIEffectiveTLDService);
     var idnService = Cc["@mozilla.org/network/idn-service;1"].
                      getService(Ci.nsIIDNService);
     try {
       var uri = Services.io.newURI(aURIString);
-      var baseDomain = eTLDService.getBaseDomain(uri);
+      var baseDomain = Services.eTLD.getBaseDomain(uri);
       displayHost = idnService.convertToDisplayIDN(baseDomain, {});
     } catch (e) {
       this.log("_getShortDisplayHost couldn't process " + aURIString);
     }
 
     if (!displayHost)
       displayHost = aURIString;
 
--- a/toolkit/components/passwordmgr/storage-mozStorage.js
+++ b/toolkit/components/passwordmgr/storage-mozStorage.js
@@ -72,24 +72,16 @@ LoginManagerStorage_mozStorage.prototype
 
   __profileDir: null,  // nsIFile for the user's profile dir
   get _profileDir() {
     if (!this.__profileDir)
       this.__profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
     return this.__profileDir;
   },
 
-  __storageService: null, // Storage service for using mozStorage
-  get _storageService() {
-    if (!this.__storageService)
-      this.__storageService = Cc["@mozilla.org/storage/service;1"].
-                              getService(Ci.mozIStorageService);
-    return this.__storageService;
-  },
-
   __uuidService: null,
   get _uuidService() {
     if (!this.__uuidService)
       this.__uuidService = Cc["@mozilla.org/uuid-generator;1"].
                            getService(Ci.nsIUUIDGenerator);
     return this.__uuidService;
   },
 
@@ -827,17 +819,17 @@ LoginManagerStorage_mozStorage.prototype
   /**
    * Attempts to initialize the database. This creates the file if it doesn't
    * exist, performs any migrations, etc. Return if this is the first run.
    */
   _dbInit() {
     this.log("Initializing Database");
     let isFirstRun = false;
     try {
-      this._dbConnection = this._storageService.openDatabase(this._signonsFile);
+      this._dbConnection = Services.storage.openDatabase(this._signonsFile);
       // Get the version of the schema in the file. It will be 0 if the
       // database has not been created yet.
       let version = this._dbConnection.schemaVersion;
       if (version == 0) {
         this._dbCreate();
         isFirstRun = true;
       } else if (version != DB_VERSION) {
         this._dbMigrate(version);
@@ -1238,17 +1230,17 @@ LoginManagerStorage_mozStorage.prototype
    * closes the database connection, deletes the database file.
    */
   _dbCleanup(backup) {
     this.log("Cleaning up DB file - close & remove & backup=" + backup);
 
     // Create backup file
     if (backup) {
       let backupFile = this._signonsFile.leafName + ".corrupt";
-      this._storageService.backupDatabaseFile(this._signonsFile, backupFile);
+      Services.storage.backupDatabaseFile(this._signonsFile, backupFile);
     }
 
     this._dbClose();
     this._signonsFile.remove(false);
   }
 
 }; // end of nsLoginManagerStorage_mozStorage implementation
 
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_fields.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_fields.js
@@ -1,25 +1,23 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 add_task(async function test() {
   await new Promise(resolve => {
 
-  let pwmgr = Cc["@mozilla.org/login-manager;1"].
-                getService(Ci.nsILoginManager);
-  pwmgr.removeAllLogins();
+  Services.logins.removeAllLogins();
 
   // add login data
   let nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
                                                  Ci.nsILoginInfo, "init");
   let login = new nsLoginInfo("http://example.com/", "http://example.com/", null,
                               "user", "password", "u1", "p1");
-  pwmgr.addLogin(login);
+  Services.logins.addLogin(login);
 
   // Open the password manager dialog
   const PWMGR_DLG = "chrome://passwordmgr/content/passwordManager.xul";
   let pwmgrdlg = window.openDialog(PWMGR_DLG, "Toolkit:PasswordManager", "");
   SimpleTest.waitForFocus(doTest, pwmgrdlg);
 
   function doTest() {
     let doc = pwmgrdlg.document;
@@ -49,17 +47,17 @@ add_task(async function test() {
        "Last Changed column is displayed");
 
     // cleanup
     Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
       if (aSubject.location == pwmgrdlg.location && aTopic == "domwindowclosed") {
         // unregister ourself
         Services.ww.unregisterNotification(notification);
 
-        pwmgr.removeAllLogins();
+        Services.logins.removeAllLogins();
 
         resolve();
       }
     });
 
     pwmgrdlg.close();
   }
 
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
@@ -1,18 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 add_task(async function test() {
   await new Promise(resolve => {
-
-    let pwmgr = Cc["@mozilla.org/login-manager;1"].
-                getService(Ci.nsILoginManager);
-    pwmgr.removeAllLogins();
+    Services.logins.removeAllLogins();
 
     // Add some initial logins
     let urls = [
         "http://example.com/",
         "http://example.org/",
         "http://mozilla.com/",
         "http://mozilla.org/",
         "http://spreadfirefox.com/",
@@ -44,18 +41,18 @@ add_task(async function test() {
         "super secret",
         "absolutely",
         "mozilla",
         "mozilla.com",
     ];
     let nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
                                                  Ci.nsILoginInfo, "init");
     for (let i = 0; i < 10; i++)
-        pwmgr.addLogin(new nsLoginInfo(urls[i], urls[i], null, users[i], pwds[i],
-                                       "u" + (i + 1), "p" + (i + 1)));
+      Services.logins.addLogin(new nsLoginInfo(urls[i], urls[i], null, users[i], pwds[i],
+                                               "u" + (i + 1), "p" + (i + 1)));
 
     // Open the password manager dialog
     const PWMGR_DLG = "chrome://passwordmgr/content/passwordManager.xul";
     let pwmgrdlg = window.openDialog(PWMGR_DLG, "Toolkit:PasswordManager", "");
     SimpleTest.waitForFocus(doTest, pwmgrdlg);
 
     // the meat of the test
     function doTest() {
@@ -190,17 +187,17 @@ add_task(async function test() {
                 expectedValues = pwds.slice().sort();
                 checkColumnEntries(2, expectedValues);
                 checkSortDirection(passwordCol, true);
                 // cleanup
                 Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
                     // unregister ourself
                     Services.ww.unregisterNotification(notification);
 
-                    pwmgr.removeAllLogins();
+                    Services.logins.removeAllLogins();
                     resolve();
                 });
                 pwmgrdlg.close();
             }
         }
 
         // Toggle Show Passwords to display Password column, then start tests
         toggleShowPasswords(runNextTest);
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
@@ -1,18 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 add_task(async function test() {
   await new Promise(resolve => {
-
-    let pwmgr = Cc["@mozilla.org/login-manager;1"].
-                getService(Ci.nsILoginManager);
-    pwmgr.removeAllLogins();
+    Services.logins.removeAllLogins();
 
     // Add some initial logins
     let urls = [
         "http://example.com/",
         "http://example.org/",
         "http://mozilla.com/",
         "http://mozilla.org/",
         "http://spreadfirefox.com/",
@@ -31,17 +28,17 @@ add_task(async function test() {
         new nsLoginInfo(urls[3], urls[3], null, "ehsan", "mypass", "u4", "p4"),
         new nsLoginInfo(urls[4], urls[4], null, "john", "smith", "u5", "p5"),
         new nsLoginInfo(urls[5], urls[5], null, "what?", "very secret", "u6", "p6"),
         new nsLoginInfo(urls[6], urls[6], null, "really?", "super secret", "u7", "p7"),
         new nsLoginInfo(urls[7], urls[7], null, "you sure?", "absolutely", "u8", "p8"),
         new nsLoginInfo(urls[8], urls[8], null, "my user name", "mozilla", "u9", "p9"),
         new nsLoginInfo(urls[9], urls[9], null, "my username", "mozilla.com", "u10", "p10"),
     ];
-    logins.forEach(login => pwmgr.addLogin(login));
+    logins.forEach(login => Services.logins.addLogin(login));
 
     // Open the password manager dialog
     const PWMGR_DLG = "chrome://passwordmgr/content/passwordManager.xul";
     let pwmgrdlg = window.openDialog(PWMGR_DLG, "Toolkit:PasswordManager", "");
     SimpleTest.waitForFocus(doTest, pwmgrdlg);
 
     // the meat of the test
     function doTest() {
@@ -176,17 +173,17 @@ add_task(async function test() {
         }
 
         function lastStep() {
             // cleanup
             Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
                 // unregister ourself
                 Services.ww.unregisterNotification(notification);
 
-                pwmgr.removeAllLogins();
+                Services.logins.removeAllLogins();
                 finish();
             });
             pwmgrdlg.close();
         }
 
         step1();
     }
   });
--- a/toolkit/components/passwordmgr/test/browser/browser_username_select_dialog.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_username_select_dialog.js
@@ -2,20 +2,18 @@
  * Test username selection dialog, on password update from a p-only form,
  * when there are multiple saved logins on the domain.
  */
 
 // Copied from prompt_common.js. TODO: share the code.
 function getSelectDialogDoc() {
   // Trudge through all the open windows, until we find the one
   // that has selectDialog.xul loaded.
-  var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
-           getService(Ci.nsIWindowMediator);
-  // var enumerator = wm.getEnumerator("navigator:browser");
-  var enumerator = wm.getXULWindowEnumerator(null);
+  // var enumerator = Services.wm.getEnumerator("navigator:browser");
+  var enumerator = Services.wm.getXULWindowEnumerator(null);
 
   while (enumerator.hasMoreElements()) {
     var win = enumerator.getNext();
     var windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
 
     var containedDocShells = windowDocShell.getDocShellEnumerator(
                                       Ci.nsIDocShellTreeItem.typeChrome,
                                       Ci.nsIDocShell.ENUMERATE_FORWARDS);
--- a/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
+++ b/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
@@ -58,31 +58,31 @@ function loadNextTest() {
       break;
 
     case 3:
       popupNotifications = normalWindowPopupNotifications;
       iframe = normalWindowIframe;
       break;
 
     case 4:
-      pwmgr.addLogin(login);
+      Services.logins.addLogin(login);
       break;
 
     case 5:
       popupNotifications = privateWindowPopupNotifications;
       iframe = privateWindowIframe;
       break;
 
     case 6:
       popupNotifications = normalWindowPopupNotifications;
       iframe = normalWindowIframe;
       break;
 
     case 7:
-      pwmgr.addLogin(login);
+      Services.logins.addLogin(login);
       break;
 
     case 8:
       popupNotifications = privateWindowPopupNotifications;
       iframe = privateWindowIframe;
       break;
 
     case 9:
@@ -147,17 +147,17 @@ function checkTest() {
       ok(!popup, "checking for no popup notification");
       break;
 
     case 6:
       // run outside of private mode, popup notification should appear
       popup = getPopup(popupNotifications, "password-change");
       ok(popup, "got popup notification");
       popup.remove();
-      pwmgr.removeLogin(login);
+      Services.logins.removeLogin(login);
       break;
 
     case 7:
       // verify that the user/pass pair was autofilled
       gotUser = iframe.contentDocument.getElementById("user").textContent;
       gotPass = iframe.contentDocument.getElementById("pass").textContent;
       is(gotUser, "notifyu1", "Checking submitted username");
       is(gotPass, "notifyp1", "Checking submitted password");
@@ -180,17 +180,17 @@ function checkTest() {
       break;
 
     case 10:
       // verify that the user/pass pair was autofilled
       gotUser = iframe.contentDocument.getElementById("user").textContent;
       gotPass = iframe.contentDocument.getElementById("pass").textContent;
       is(gotUser, "notifyu1", "Checking submitted username");
       is(gotPass, "notifyp1", "Checking submitted password");
-      pwmgr.removeLogin(login);
+      Services.logins.removeLogin(login);
       break;
 
     default:
       ok(false, "Unexpected call to checkTest for test #" + testNum);
 
   }
 }
 
@@ -257,25 +257,21 @@ function handleLoad(aEvent) {
       aWin.close();
     });
 
     SpecialPowers.removeObserver(observer, "passwordmgr-processed-form");
     SimpleTest.finish();
   }
 }
 
-var pwmgr = Cc["@mozilla.org/login-manager;1"].
-            getService(Ci.nsILoginManager);
-ok(pwmgr != null, "Access pwmgr");
-
 // We need to make sure no logins have been stored by previous tests
 // for forms in |url|, otherwise the change password notification
 // would turn into a prompt, and the test will fail.
 var url = "http://test2.example.com";
-is(pwmgr.countLogins(url, "", null), 0, "No logins should be stored for " + url);
+is(Services.logins.countLogins(url, "", null), 0, "No logins should be stored for " + url);
 
 var nsLoginInfo = new SpecialPowers.wrap(SpecialPowers.Components).Constructor("@mozilla.org/login-manager/loginInfo;1",
                                              Ci.nsILoginInfo, "init");
 var login = new nsLoginInfo(url, url, null, "notifyu1", "notifyp1", "user", "pass");
 
 var normalWindow;
 var privateWindow;
 
@@ -313,9 +309,8 @@ testOnWindow(false, function(aWin) {
   });
 });
 
 SimpleTest.waitForExplicitFinish();
 </script>
 </pre>
 </body>
 </html>
-
--- a/toolkit/components/passwordmgr/test/mochitest/test_autofill_password-only.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_autofill_password-only.html
@@ -12,17 +12,17 @@ Login Manager test: Bug 444968
 <script>
 let pwmgrCommonScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
 pwmgrCommonScript.sendSyncMessage("setupParent", { selfFilling: true });
 
 SimpleTest.waitForExplicitFinish();
 
 let chromeScript = runInParent(function chromeSetup() {
   const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
-  let pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
+  const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 
   let login1A  = Cc["@mozilla.org/login-manager/loginInfo;1"].
                  createInstance(Ci.nsILoginInfo);
   let login1B  = Cc["@mozilla.org/login-manager/loginInfo;1"].
                  createInstance(Ci.nsILoginInfo);
   let login2A  = Cc["@mozilla.org/login-manager/loginInfo;1"].
                  createInstance(Ci.nsILoginInfo);
   let login2B  = Cc["@mozilla.org/login-manager/loginInfo;1"].
@@ -37,28 +37,28 @@ let chromeScript = runInParent(function 
 
   login2A.init("http://mochi.test:8888", "http://bug444968-2", null,
                "testuser2A", "testpass2A", "", "");
   login2B.init("http://mochi.test:8888", "http://bug444968-2", null,
                "", "testpass2B", "", "");
   login2C.init("http://mochi.test:8888", "http://bug444968-2", null,
                "testuser2C", "testpass2C", "", "");
 
-  pwmgr.addLogin(login1A);
-  pwmgr.addLogin(login1B);
-  pwmgr.addLogin(login2A);
-  pwmgr.addLogin(login2B);
-  pwmgr.addLogin(login2C);
+  Services.logins.addLogin(login1A);
+  Services.logins.addLogin(login1B);
+  Services.logins.addLogin(login2A);
+  Services.logins.addLogin(login2B);
+  Services.logins.addLogin(login2C);
 
   addMessageListener("removeLogins", function removeLogins() {
-    pwmgr.removeLogin(login1A);
-    pwmgr.removeLogin(login1B);
-    pwmgr.removeLogin(login2A);
-    pwmgr.removeLogin(login2B);
-    pwmgr.removeLogin(login2C);
+    Services.logins.removeLogin(login1A);
+    Services.logins.removeLogin(login1B);
+    Services.logins.removeLogin(login2A);
+    Services.logins.removeLogin(login2B);
+    Services.logins.removeLogin(login2C);
   });
 });
 
 SimpleTest.registerCleanupFunction(() => chromeScript.sendSyncMessage("removeLogins"));
 
 registerRunTests();
 </script>
 
--- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_html5.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_html5.html
@@ -9,19 +9,17 @@
 </head>
 <body>
 Login Manager test: html5 input types (email, tel, url, etc.)
 <script>
 runChecksAfterCommonInit(() => startTest());
 
 runInParent(function setup() {
   const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
-  let pwmgr = Cc["@mozilla.org/login-manager;1"].
-              getService(Ci.nsILoginManager);
-
+  const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
   login1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
   login2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
   login3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
   login4 = Cc["@mozilla.org/login-manager/loginInfo;1"].
            createInstance(Ci.nsILoginInfo);
@@ -30,20 +28,20 @@ runInParent(function setup() {
               "testuser@example.com", "testpass1", "", "");
   login2.init("http://mochi.test:8888", "http://bug600551-2", null,
               "555-555-5555", "testpass2", "", "");
   login3.init("http://mochi.test:8888", "http://bug600551-3", null,
               "http://mozilla.org", "testpass3", "", "");
   login4.init("http://mochi.test:8888", "http://bug600551-4", null,
               "123456789", "testpass4", "", "");
 
-  pwmgr.addLogin(login1);
-  pwmgr.addLogin(login2);
-  pwmgr.addLogin(login3);
-  pwmgr.addLogin(login4);
+  Services.logins.addLogin(login1);
+  Services.logins.addLogin(login2);
+  Services.logins.addLogin(login3);
+  Services.logins.addLogin(login4);
 });
 </script>
 
 <p id="display"></p>
 <div id="content" style="display: none">
 
   <form id="form1" action="http://bug600551-1">
     <input  type="email"    name="uname">
--- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwonly.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_pwonly.html
@@ -8,19 +8,17 @@
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 Login Manager test: forms and logins without a username.
 <script>
 runChecksAfterCommonInit(() => startTest());
 runInParent(() => {
   const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
-  var pwmgr = Cc["@mozilla.org/login-manager;1"]
-              .getService(Ci.nsILoginManager);
-
+  const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
   var nsLoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1", Ci.nsILoginInfo);
 
   // pwlogin1 uses a unique formSubmitURL, to check forms where no other logins
   // will apply. pwlogin2 uses the normal formSubmitURL, so that we can test
   // forms with a mix of username and non-username logins that might apply.
   //
   // Note: pwlogin2 is deleted at the end of the test.
 
@@ -29,18 +27,18 @@ runInParent(() => {
 
   pwlogin1.init("http://mochi.test:8888", "http://mochi.test:1111", null,
                 "", "1234", "uname", "pword");
 
   pwlogin2.init("http://mochi.test:8888", "http://mochi.test:8888", null,
                 "", "1234", "uname", "pword");
 
 
-  pwmgr.addLogin(pwlogin1);
-  pwmgr.addLogin(pwlogin2);
+  Services.logins.addLogin(pwlogin1);
+  Services.logins.addLogin(pwlogin2);
 });
 </script>
 <p id="display"></p>
 
 <div id="content" style="display: none">
 
 
 <!-- simple form: no username field, 1 password field -->
@@ -205,9 +203,8 @@ function startTest() {
     checkUnmodifiedForm(13);
 
     SimpleTest.finish();
 }
 </script>
 </pre>
 </body>
 </html>
-
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt.html
@@ -26,17 +26,17 @@ var isOk;
 // Force parent to not look for tab-modal prompts, as they're not used for auth prompts.
 isTabModal = false;
 
 let prompterParent = runInParent(() => {
   const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
   const promptFac = Cc["@mozilla.org/passwordmanager/authpromptfactory;1"].
                     getService(Ci.nsIPromptFactory);
 
-  Cu.import("resource://gre/modules/Services.jsm");
+  let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
   let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
   let prompter1 = promptFac.getPrompt(chromeWin, Ci.nsIAuthPrompt);
 
   addMessageListener("proxyPrompter", function onMessage(msg) {
     let rv = prompter1[msg.methodName](...msg.args);
     return {
       rv,
       // Send the args back to content so out/inout args can be checked.
@@ -47,20 +47,18 @@ let prompterParent = runInParent(() => {
 
 let prompter1 = new PrompterProxy(prompterParent);
 
 const defaultTitle = "the title";
 const defaultMsg = "the message";
 
 function initLogins() {
   const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
+  const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
   var login1, login2A, login2B, login2C, login2D, login2E;
-  var pwmgr = Cc["@mozilla.org/login-manager;1"].
-              getService(Ci.nsILoginManager);
-
   login1  = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login2A = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login2B = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login2C = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
@@ -77,22 +75,22 @@ function initLogins() {
                "user2name", "user2pass", "", "");
   login2C.init("http://example2.com", null, "http://example2.com",
                "user3.name@host", "user3pass", "", "");
   login2D.init("http://example2.com", null, "http://example2.com",
                "100@beef", "user3pass", "", "");
   login2E.init("http://example2.com", null, "http://example2.com",
                "100%beef", "user3pass", "", "");
 
-  pwmgr.addLogin(login1);
-  pwmgr.addLogin(login2A);
-  pwmgr.addLogin(login2B);
-  pwmgr.addLogin(login2C);
-  pwmgr.addLogin(login2D);
-  pwmgr.addLogin(login2E);
+  Services.logins.addLogin(login1);
+  Services.logins.addLogin(login2A);
+  Services.logins.addLogin(login2B);
+  Services.logins.addLogin(login2C);
+  Services.logins.addLogin(login2D);
+  Services.logins.addLogin(login2E);
 }
 
 add_task(async function setup() {
   runInParent(initLogins);
 });
 
 add_task(async function test_prompt_accept() {
   state = {
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_http.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_http.html
@@ -24,20 +24,17 @@ var iframe = document.getElementById("if
 isTabModal = false;
 
 const AUTHENTICATE_PATH = new URL("authenticate.sjs", window.location.href).pathname;
 
 let chromeScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
 
 runInParent(() => {
   const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-  Cu.import("resource://gre/modules/Services.jsm");
-
-  let pwmgr = Cc["@mozilla.org/login-manager;1"].
-              getService(Ci.nsILoginManager);
+  const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 
   let login3A, login3B, login4;
   login3A = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login3B = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login4  = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
@@ -64,23 +61,23 @@ runInParent(() => {
                            "httpsUser", "httpsPass", "", "");
   // HTTP and HTTPS version of the same domain and realm but with different passwords.
   dedupeHttpUpgradeLogin.init("http://example.org", null, "schemeUpgradeDedupe",
                               "dedupeUser", "httpPass", "", "");
   dedupeHttpsUpgradeLogin.init("https://example.org", null, "schemeUpgradeDedupe",
                                "dedupeUser", "httpsPass", "", "");
 
 
-  pwmgr.addLogin(login3A);
-  pwmgr.addLogin(login3B);
-  pwmgr.addLogin(login4);
-  pwmgr.addLogin(httpUpgradeLogin);
-  pwmgr.addLogin(httpsDowngradeLogin);
-  pwmgr.addLogin(dedupeHttpUpgradeLogin);
-  pwmgr.addLogin(dedupeHttpsUpgradeLogin);
+  Services.logins.addLogin(login3A);
+  Services.logins.addLogin(login3B);
+  Services.logins.addLogin(login4);
+  Services.logins.addLogin(httpUpgradeLogin);
+  Services.logins.addLogin(httpsDowngradeLogin);
+  Services.logins.addLogin(dedupeHttpUpgradeLogin);
+  Services.logins.addLogin(dedupeHttpsUpgradeLogin);
 });
 
 add_task(async function test_iframe() {
   let state = {
     msg: "http://mochi.test:8888 is requesting your username and password. The site says: “mochitest”",
     title: "Authentication Required",
     textValue: "mochiuser1",
     passValue: "mochipass1",
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth.html
@@ -40,57 +40,51 @@ let prompterParent = runInParent(() => {
   const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
   const promptFac = Cc["@mozilla.org/passwordmanager/authpromptfactory;1"].
                     getService(Ci.nsIPromptFactory);
 
   Cu.import("resource://gre/modules/Services.jsm");
   let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
   let prompter2 = promptFac.getPrompt(chromeWin, Ci.nsIAuthPrompt2);
 
-  let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
   let channels = {};
-  channels.channel1 = ioService.newChannel2("http://example.com",
-                                            null,
-                                            null,
-                                            null, // aLoadingNode
-                                            Services.
-                                            scriptSecurityManager.getSystemPrincipal(),
-                                            null, // aTriggeringPrincipal
-                                            Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                            Ci.nsIContentPolicy.TYPE_OTHER);
+  channels.channel1 = Services.io.newChannel2("http://example.com",
+                                              null,
+                                              null,
+                                              null, // aLoadingNode
+                                              Services.
+                                              scriptSecurityManager.getSystemPrincipal(),
+                                              null, // aTriggeringPrincipal
+                                              Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                              Ci.nsIContentPolicy.TYPE_OTHER);
 
-  channels.channel2 = ioService.newChannel2("http://example2.com",
-                                            null,
-                                            null,
-                                            null, // aLoadingNode
-                                            Services.
-                                            scriptSecurityManager.getSystemPrincipal(),
-                                            null, // aTriggeringPrincipal
-                                            Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                            Ci.nsIContentPolicy.TYPE_OTHER);
+  channels.channel2 = Services.io.newChannel2("http://example2.com",
+                                              null,
+                                              null,
+                                              null, // aLoadingNode
+                                              Services.
+                                              scriptSecurityManager.getSystemPrincipal(),
+                                              null, // aTriggeringPrincipal
+                                              Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                              Ci.nsIContentPolicy.TYPE_OTHER);
 
   addMessageListener("proxyPrompter", function onMessage(msg) {
     let args = [...msg.args];
     let channelName = args.shift();
     // Replace the channel name string (arg. 0) with the channel by that name.
     args.unshift(channels[channelName]);
 
     let rv = prompter2[msg.methodName](...args);
     return {
       rv,
       // Send the args back to content so out/inout args can be checked.
       args: msg.args,
     };
   });
 
-  Cu.import("resource://gre/modules/Services.jsm");
-
-  let pwmgr = Cc["@mozilla.org/login-manager;1"].
-              getService(Ci.nsILoginManager);
-
   let login1, login2A, login2B, login2C, login2D, login2E;
   login1  = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login2A = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login2B = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login2C = Cc["@mozilla.org/login-manager/loginInfo;1"].
@@ -108,22 +102,22 @@ let prompterParent = runInParent(() => {
                "user2name", "user2pass", "", "");
   login2C.init("http://example2.com", null, "http://example2.com",
                "user3.name@host", "user3pass", "", "");
   login2D.init("http://example2.com", null, "http://example2.com",
                "100@beef", "user3pass", "", "");
   login2E.init("http://example2.com", null, "http://example2.com",
                "100%beef", "user3pass", "", "");
 
-  pwmgr.addLogin(login1);
-  pwmgr.addLogin(login2A);
-  pwmgr.addLogin(login2B);
-  pwmgr.addLogin(login2C);
-  pwmgr.addLogin(login2D);
-  pwmgr.addLogin(login2E);
+  Services.logins.addLogin(login1);
+  Services.logins.addLogin(login2A);
+  Services.logins.addLogin(login2B);
+  Services.logins.addLogin(login2C);
+  Services.logins.addLogin(login2D);
+  Services.logins.addLogin(login2E);
 });
 
 let prompter2 = new PrompterProxy(prompterParent);
 
 add_task(async function test_accept() {
   state = {
     msg: "http://example.com is requesting your username and password. The site says: “some realm”",
     title: "Authentication Required",
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
@@ -20,19 +20,16 @@
 <script class="testbody" type="text/javascript">
 var state, action;
 var pwmgr;
 var proxyLogin;
 var isOk;
 var mozproxy, proxiedHost = "http://mochi.test:8888";
 var proxyChannel;
 var systemPrincipal = SpecialPowers.Services.scriptSecurityManager.getSystemPrincipal();
-var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
-
-var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
 
 var level = Ci.nsIAuthPrompt2.LEVEL_NONE;
 
 var proxyAuthinfo = {
   username: "",
   password: "",
   domain: "",
 
@@ -51,18 +48,17 @@ const Ci_promptFac = Ci.nsIPromptFactory
 ok(Ci_promptFac != null, "Access Ci.nsIPromptFactory");
 
 const promptFac = Cc_promptFac.getService(Ci_promptFac);
 ok(promptFac != null, "promptFac getService()");
 
 var prompter2 = promptFac.getPrompt(window, Ci.nsIAuthPrompt2);
 
 function initLogins(pi) {
-  pwmgr = Cc["@mozilla.org/login-manager;1"].
-          getService(Ci.nsILoginManager);
+  pwmgr = SpecialPowers.Services.logins;
 
   mozproxy = "moz-proxy://" + SpecialPowers.wrap(pi).host + ":" +
               SpecialPowers.wrap(pi).port;
 
   proxyLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
                createInstance(Ci.nsILoginInfo);
 
   proxyLogin.init(mozproxy, null, "Proxy Realm",
@@ -97,43 +93,40 @@ var resolveCallback = SpecialPowers.wrap
     // I'm cheating a bit here... We should probably do some magic foo to get
     // something implementing nsIProxiedProtocolHandler and then call
     // NewProxiedChannel(), so we have something that's definately a proxied
     // channel. But Mochitests use a proxy for a number of hosts, so just
     // requesting a normal channel will give us a channel that's proxied.
     // The proxyChannel needs to move to at least on-modify-request to
     // have valid ProxyInfo, but we use OnStartRequest during startup()
     // for simplicity.
-    proxyChannel = ioService.newChannel2(proxiedHost,
-                                         null,
-                                         null,
-                                         null, // aLoadingNode
-                                         systemPrincipal,
-                                         null, // aTriggeringPrincipal
-                                         Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                         Ci.nsIContentPolicy.TYPE_OTHER);
+    proxyChannel = SpecialPowers.Services.io.newChannel2(proxiedHost,
+                                                         null,
+                                                         null,
+                                                         null, // aLoadingNode
+                                                         systemPrincipal,
+                                                         null, // aTriggeringPrincipal
+                                                         Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                                         Ci.nsIContentPolicy.TYPE_OTHER);
     proxyChannel.asyncOpen2(SpecialPowers.wrapCallbackObject(new proxyChannelListener()));
   }
 });
 
 function startup() {
   // Need to allow for arbitrary network servers defined in PAC instead of a hardcoded moz-proxy.
-  var ios = SpecialPowers.Cc["@mozilla.org/network/io-service;1"].
-    getService(SpecialPowers.Ci.nsIIOService);
-
   var pps = SpecialPowers.Cc["@mozilla.org/network/protocol-proxy-service;1"].getService();
 
-  var channel = ios.newChannel2("http://example.com",
-                                null,
-                                null,
-                                null, // aLoadingNode
-                                systemPrincipal,
-                                null, // aTriggeringPrincipal
-                                Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
-                                Ci.nsIContentPolicy.TYPE_OTHER);
+  var channel = SpecialPowers.Services.io.newChannel2("http://example.com",
+                                                      null,
+                                                      null,
+                                                      null, // aLoadingNode
+                                                      systemPrincipal,
+                                                      null, // aTriggeringPrincipal
+                                                      Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL,
+                                                      Ci.nsIContentPolicy.TYPE_OTHER);
   pps.asyncResolve(channel, 0, resolveCallback);
 }
 
 startup();
 
 add_task(async function setup() {
   info("Waiting for startup to complete...");
   await startupComplete;
@@ -175,17 +168,17 @@ add_task(async function test_noAutologin
   is(proxyAuthinfo.username, "proxuser", "Checking returned username");
   is(proxyAuthinfo.password, "proxpass", "Checking returned password");
 });
 
 add_task(async function test_autologin() {
   // test proxy login (with autologin)
 
   // Enable the autologin pref.
-  prefs.setBoolPref("signon.autologin.proxy", true);
+  SpecialPowers.Services.prefs.setBoolPref("signon.autologin.proxy", true);
 
   proxyAuthinfo.username = "";
   proxyAuthinfo.password = "";
   proxyAuthinfo.realm    = "Proxy Realm";
   proxyAuthinfo.flags    = Ci.nsIAuthInformation.AUTH_PROXY;
 
   time1 = pwmgr.findLogins({}, mozproxy, null, "Proxy Realm")[0].QueryInterface(Ci.nsILoginMetaInfo).timeLastUsed;
   isOk = prompter2.promptAuth(proxyChannel, level, proxyAuthinfo);
@@ -247,17 +240,17 @@ add_task(async function test_autologin_p
     buttonClick: "ok",
   };
 
   proxyAuthinfo.username = "";
   proxyAuthinfo.password = "";
   proxyAuthinfo.realm    = "Proxy Realm";
   proxyAuthinfo.flags    = Ci.nsIAuthInformation.AUTH_PROXY;
 
-  prefs.clearUserPref("signon.autologin.proxy");
+  SpecialPowers.Services.prefs.clearUserPref("signon.autologin.proxy");
 
   // XXX check for and kill popup notification??
   // XXX check for checkbox / checkstate on old prompts?
   // XXX check NTLM domain stuff
 });
 </script>
 </pre>
 </body>
--- a/toolkit/components/passwordmgr/test/mochitest/test_username_focus.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_username_focus.html
@@ -13,18 +13,17 @@
 </head>
 <body>
 <script>
 let pwmgrCommonScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
 
 let readyPromise = registerRunTests();
 let chromeScript = runInParent(function chromeSetup() {
   const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
-  let pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
-
+  const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
   let login1A  = Cc["@mozilla.org/login-manager/loginInfo;1"].
                  createInstance(Ci.nsILoginInfo);
   let login1B  = Cc["@mozilla.org/login-manager/loginInfo;1"].
                  createInstance(Ci.nsILoginInfo);
   let login2A  = Cc["@mozilla.org/login-manager/loginInfo;1"].
                  createInstance(Ci.nsILoginInfo);
   let login2B  = Cc["@mozilla.org/login-manager/loginInfo;1"].
                  createInstance(Ci.nsILoginInfo);
@@ -34,19 +33,19 @@ let chromeScript = runInParent(function 
   login1A.init("http://mochi.test:8888", "http://username-focus-1", null,
                "testuser1A", "testpass1A", "", "");
 
   login2A.init("http://mochi.test:8888", "http://username-focus-2", null,
                "testuser2A", "testpass2A", "", "");
   login2B.init("http://mochi.test:8888", "http://username-focus-2", null,
                "testuser2B", "testpass2B", "", "");
 
-  pwmgr.addLogin(login1A);
-  pwmgr.addLogin(login2A);
-  pwmgr.addLogin(login2B);
+  Services.logins.addLogin(login1A);
+  Services.logins.addLogin(login2A);
+  Services.logins.addLogin(login2B);
 });
 </script>
 
 <p id="display"></p>
 <div id="content">
   <!-- first 3 forms have a matching user+pass login -->
 
   <!-- user+pass form. -->
--- a/toolkit/components/passwordmgr/test/prompt_common.js
+++ b/toolkit/components/passwordmgr/test/prompt_common.js
@@ -42,20 +42,18 @@ var observer = SpecialPowers.wrapCallbac
         else
             startCallbackTimer(); // try again in a bit
     }
 });
 
 function getDialogDoc() {
   // Find the <browser> which contains notifyWindow, by looking
   // through all the open windows and all the <browsers> in each.
-  var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
-           getService(Ci.nsIWindowMediator);
-  // var enumerator = wm.getEnumerator("navigator:browser");
-  var enumerator = wm.getXULWindowEnumerator(null);
+  // var enumerator = SpecialPowers.Services.wm.getEnumerator("navigator:browser");
+  var enumerator = SpecialPowers.Services.wm.getXULWindowEnumerator(null);
 
   while (enumerator.hasMoreElements()) {
     var win = enumerator.getNext();
     var windowDocShell = win.QueryInterface(Ci.nsIXULWindow).docShell;
 
     var containedDocShells = windowDocShell.getDocShellEnumerator(
                                       Ci.nsIDocShellTreeItem.typeChrome,
                                       Ci.nsIDocShell.ENUMERATE_FORWARDS);
--- a/toolkit/components/passwordmgr/test/pwmgr_common.js
+++ b/toolkit/components/passwordmgr/test/pwmgr_common.js
@@ -123,16 +123,17 @@ function doKey(aKey, modifier) {
 
 /**
  * Init with a common login
  * If selfFilling is true or non-undefined, fires an event at the page so that
  * the test can start checking filled-in values. Tests that check observer
  * notifications might be confused by this.
  */
 function commonInit(selfFilling) {
+  // eslint-disable-next-line mozilla/use-services
   var pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"].
               getService(SpecialPowers.Ci.nsILoginManager);
   ok(pwmgr != null, "Access LoginManager");
 
   // Check that initial state has no logins
   var logins = pwmgr.getAllLogins();
   is(logins.length, 0, "Not expecting logins to be present");
   var disabledHosts = pwmgr.getAllDisabledHosts();
--- a/toolkit/components/passwordmgr/test/test_master_password.html
+++ b/toolkit/components/passwordmgr/test/test_master_password.html
@@ -12,18 +12,17 @@
 Login Manager test: master password.
 <script>
 "use strict";
 
 commonInit();
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 
-var pwmgr   = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
-                           .getService(SpecialPowers.Ci.nsILoginManager);
+var pwmgr   = SpecialPowers.Services.logins;
 var pwcrypt = SpecialPowers.Cc["@mozilla.org/login-manager/crypto/SDR;1"]
                            .getService(Ci.nsILoginManagerCrypto);
 
 var nsLoginInfo = new SpecialPowers.wrap(SpecialPowers.Components).Constructor("@mozilla.org/login-manager/loginInfo;1", Ci.nsILoginInfo);
 
 var exampleCom = "http://example.com/tests/toolkit/components/passwordmgr/test/";
 var exampleOrg = "http://example.org/tests/toolkit/components/passwordmgr/test/";
 
@@ -300,9 +299,8 @@ SimpleTest.registerCleanupFunction(funct
     pwmgr.removeLogin(login2);
 });
 
 window.addEventListener("runTests", startTest1);
 </script>
 </pre>
 </body>
 </html>
-
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -9,22 +9,21 @@
     <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 
     <script class="testbody" type="text/javascript">
         SimpleTest.waitForExplicitFinish();
         SimpleTest.requestFlakyTimeout("untriaged");
 
         const { NetUtil } = SpecialPowers.Cu.import("resource://gre/modules/NetUtil.jsm");
 
-        var prefs = Cc["@mozilla.org/preferences-service;1"].
-                        getService(Ci.nsIPrefBranch);
-        prefs.setIntPref("network.auth.subresource-http-auth-allow", 2);
+        SpecialPowers.Services.prefs.setIntPref("network.auth.subresource-http-auth-allow", 2);
         // Class monitoring number of open dialog windows
         // It checks there is always open just a single dialog per application
         function dialogMonitor() {
+            // eslint-disable-next-line mozilla/use-services
             var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                                                .getService(Ci.nsIObserverService);
             observerService.addObserver(this, "domwindowopened");
             observerService.addObserver(this, "domwindowclosed");
         }
 
         /*
          * As documented in Bug 718543, checking equality of objects pulled
@@ -52,16 +51,17 @@
                     this.windowsOpen++;
                     this.windowsRegistered++;
                 } else if (topic === "domwindowclosed") {
                     this.windowsOpen--;
                 }
             },
 
             shutdown() {
+                // eslint-disable-next-line mozilla/use-services
                 var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
                                                .getService(Ci.nsIObserverService);
                 observerService.removeObserver(this, "domwindowopened");
                 observerService.removeObserver(this, "domwindowclosed");
             },
 
             reset() {
                 this.windowsOpen = 0;
@@ -69,18 +69,17 @@
             }
         });
 
         var monitor = new dialogMonitor();
 
         var pwmgr, logins = [];
 
         function initLogins(pi) {
-            pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
-                                 .getService(Ci.nsILoginManager);
+            pwmgr = SpecialPowers.Services.logins;
 
             function addLogin(host, realm, user, pass) {
                 var login = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"]
                                          .createInstance(Ci.nsILoginInfo);
                 login.init(host, null, realm, user, pass, "", "");
                 pwmgr.addLogin(login);
                 logins.push(login);
             }
--- a/toolkit/components/passwordmgr/test/test_xhr.html
+++ b/toolkit/components/passwordmgr/test/test_xhr.html
@@ -15,40 +15,37 @@ Login Manager test: XHR prompt
 <div id="content" style="display: none">
   <iframe id="iframe"></iframe>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: XHR prompts. **/
-var pwmgr, login1, login2;
+var login1, login2;
 
 function initLogins() {
-  pwmgr = Cc["@mozilla.org/login-manager;1"].
-          getService(Ci.nsILoginManager);
-
   login1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
   login2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
             createInstance(Ci.nsILoginInfo);
 
   login1.init("http://mochi.test:8888", null, "xhr",
                "xhruser1", "xhrpass1", "", "");
   login2.init("http://mochi.test:8888", null, "xhr2",
                "xhruser2", "xhrpass2", "", "");
 
-  pwmgr.addLogin(login1);
-  pwmgr.addLogin(login2);
+  SpecialPowers.Services.logins.addLogin(login1);
+  SpecialPowers.Services.logins.addLogin(login2);
 }
 
 function finishTest() {
   ok(true, "finishTest removing testing logins...");
-  pwmgr.removeLogin(login1);
-  pwmgr.removeLogin(login2);
+  SpecialPowers.Services.logins.removeLogin(login1);
+  SpecialPowers.Services.logins.removeLogin(login2);
 
   SimpleTest.finish();
 }
 
 function handleDialog(doc, testNum) {
   ok(true, "handleDialog running for test " + testNum);
 
   var clickOK = true;
--- a/toolkit/components/passwordmgr/test/test_xml_load.html
+++ b/toolkit/components/passwordmgr/test/test_xml_load.html
@@ -15,34 +15,31 @@ Login Manager test: XML prompt
 <div id="content" style="display: none">
   <iframe id="iframe"></iframe>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 /** Test for Login Manager: XML prompts. **/
-var pwmgr, login1, login2;
+var login1, login2;
 
 function initLogins() {
-  pwmgr = SpecialPowers.Cc["@mozilla.org/login-manager;1"]
-                       .getService(Ci.nsILoginManager);
-
   login1 = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"]
                         .createInstance(Ci.nsILoginInfo);
   login2 = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"]
                         .createInstance(Ci.nsILoginInfo);
 
   login1.init("http://mochi.test:8888", null, "xml",
                "xmluser1", "xmlpass1", "", "");
   login2.init("http://mochi.test:8888", null, "xml2",
                "xmluser2", "xmlpass2", "", "");
 
-  pwmgr.addLogin(login1);
-  pwmgr.addLogin(login2);
+  SpecialPowers.Services.logins.addLogin(login1);
+  SpecialPowers.Services.logins.addLogin(login2);
 }
 
 function handleDialog(doc, testNum) {
   ok(true, "handleDialog running for test " + testNum);
 
   var clickOK = true;
   var userfield = doc.getElementById("loginTextbox");
   var passfield = doc.getElementById("password1Textbox");
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-services.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/use-services.js
@@ -19,18 +19,18 @@ const path = require("path");
  * file.
  */
 var servicesASTParser = {
   identifiers: {},
   // These interfaces are difficult/not possible to get via processing.
   result: {
     "nsIPrefBranch": "prefs",
     "nsIPrefService": "prefs",
-    "nsIXULRuntime": "appInfo",
-    "nsIXULAppInfo": "appInfo",
+    "nsIXULRuntime": "appinfo",
+    "nsIXULAppInfo": "appinfo",
     "nsIDirectoryService": "dirsvc",
     "nsIProperties": "dirsvc",
     "nsIFrameScriptLoader": "mm",
     "nsIProcessScriptLoader": "ppmm",
     "nsIIOService": "io",
     "nsIIOService2": "io",
     "nsISpeculativeConnect": "io",
     "nsICookieManager": "cookies"