Bug 1552059 - Port bug 1551657: Adapt to array changes of nsILoginManager.findLogins, JS part; r=benc
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 16 May 2019 12:48:38 +1200
changeset 26619 f0afd7103595c78dae5ee9ec3ccb0c8d5dfeb610
parent 26618 f2aa9a4e1426738e9c21363660bba4fa453e8f3e
child 26620 e69be81d45d626cf7e810df27cfee08f00e80b89
push id15923
push usergeoff@darktrojan.net
push dateThu, 16 May 2019 01:22:28 +0000
treeherdercomm-central@f0afd7103595 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenc
bugs1552059, 1551657
Bug 1552059 - Port bug 1551657: Adapt to array changes of nsILoginManager.findLogins, JS part; r=benc
calendar/base/modules/utils/calAuthUtils.jsm
chat/components/src/imAccounts.js
editor/ui/composer/content/publishprefs.js
mailnews/base/src/msgOAuth2Module.js
mailnews/compose/test/unit/test_smtpPassword2.js
mailnews/compose/test/unit/test_smtpPasswordFailure1.js
mailnews/compose/test/unit/test_smtpPasswordFailure2.js
mailnews/compose/test/unit/test_smtpPasswordFailure3.js
mailnews/imap/test/unit/test_imapPasswordFailure.js
mailnews/local/test/unit/test_pop3Password3.js
mailnews/local/test/unit/test_pop3PasswordFailure.js
mailnews/local/test/unit/test_pop3PasswordFailure2.js
mailnews/local/test/unit/test_pop3PasswordFailure3.js
mailnews/news/test/unit/test_nntpPassword3.js
mailnews/news/test/unit/test_nntpPasswordFailure.js
--- a/calendar/base/modules/utils/calAuthUtils.jsm
+++ b/calendar/base/modules/utils/calAuthUtils.jsm
@@ -47,17 +47,17 @@ var calauth = {
          * @param {String} aPasswordRealm       The realm to retrieve password info for
          * @return {PasswordInfo}               The retrieved password information
          */
         getPasswordInfo(aPasswordRealm) {
             let username;
             let password;
             let found = false;
 
-            let logins = Services.logins.findLogins({}, aPasswordRealm.prePath, null, aPasswordRealm.realm);
+            let logins = Services.logins.findLogins(aPasswordRealm.prePath, null, aPasswordRealm.realm);
             if (logins.length) {
                 username = logins[0].username;
                 password = logins[0].password;
                 found = true;
             }
             if (found) {
                 let keyStr = aPasswordRealm.prePath + ":" + aPasswordRealm.realm;
                 let now = new Date();
@@ -263,17 +263,17 @@ var calauth = {
         let origin = this._ensureOrigin(aOrigin);
 
         if (!Services.logins.getLoginSavingEnabled(origin)) {
             throw new Components.Exception("Password saving is disabled for " + origin,
                                            Cr.NS_ERROR_NOT_AVAILABLE);
         }
 
         try {
-            let logins = Services.logins.findLogins({}, origin, null, aRealm);
+            let logins = Services.logins.findLogins(origin, null, aRealm);
 
             let newLoginInfo = Cc["@mozilla.org/login-manager/loginInfo;1"]
                                  .createInstance(Ci.nsILoginInfo);
             newLoginInfo.init(origin, null, aRealm, aUsername, aPassword, "", "");
             if (logins.length > 0) {
                 Services.logins.modifyLogin(logins[0], newLoginInfo);
             } else {
                 Services.logins.addLogin(newLoginInfo);
@@ -299,17 +299,17 @@ var calauth = {
 
         if (typeof aPassword != "object") {
             throw new Components.Exception("", Cr.NS_ERROR_XPC_NEED_OUT_OBJECT);
         }
 
         let origin = this._ensureOrigin(aOrigin);
 
         try {
-            let logins = Services.logins.findLogins({}, origin, null, aRealm);
+            let logins = Services.logins.findLogins(origin, null, aRealm);
             for (let loginInfo of logins) {
                 if (loginInfo.username == aUsername) {
                     aPassword.value = loginInfo.password;
                     return true;
                 }
             }
         } catch (exc) {
             cal.ASSERT(false, exc);
@@ -326,17 +326,17 @@ var calauth = {
      * @return {Boolean}            Could the user be removed?
      */
     passwordManagerRemove: function(aUsername, aOrigin, aRealm) {
         cal.ASSERT(aUsername);
 
         let origin = this._ensureOrigin(aOrigin);
 
         try {
-            let logins = Services.logins.findLogins({}, origin, null, aRealm);
+            let logins = Services.logins.findLogins(origin, null, aRealm);
             for (let loginInfo of logins) {
                 if (loginInfo.username == aUsername) {
                     Services.logins.removeLogin(loginInfo);
                     return true;
                 }
             }
         } catch (exc) {
             // If no logins are found, fall through to the return statement below.
--- a/chat/components/src/imAccounts.js
+++ b/chat/components/src/imAccounts.js
@@ -500,17 +500,17 @@ imAccount.prototype = {
 
     // Avoid prompting the user for the master password more than once at startup.
     if (gUserCanceledMasterPasswordPrompt)
       return "";
 
     let passwordURI = "im://" + this.protocol.id;
     let logins;
     try {
-      logins = Services.logins.findLogins({}, passwordURI, null, passwordURI);
+      logins = Services.logins.findLogins(passwordURI, null, passwordURI);
     } catch (e) {
       this._handleMasterPasswordException(e);
       return "";
     }
     let normalizedName = this.normalizedName;
     for (let login of logins) {
       if (login.username == normalizedName) {
         this._password = login.password;
@@ -542,17 +542,17 @@ imAccount.prototype = {
     if (gUserCanceledMasterPasswordPrompt)
       return;
     let newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"]
                    .createInstance(Ci.nsILoginInfo);
     let passwordURI = "im://" + this.protocol.id;
     newLogin.init(passwordURI, null, passwordURI, this.normalizedName,
                   aPassword, "", "");
     try {
-      let logins = Services.logins.findLogins({}, passwordURI, null, passwordURI);
+      let logins = Services.logins.findLogins(passwordURI, null, passwordURI);
       let saved = false;
       for (let login of logins) {
         if (newLogin.matches(login, true)) {
           if (aPassword)
             Services.logins.modifyLogin(login, newLogin);
           else
             Services.logins.removeLogin(login);
           saved = true;
@@ -617,17 +617,17 @@ imAccount.prototype = {
   // Delete the account (from the preferences, mozStorage, and call unInit).
   remove() {
     let login = Cc["@mozilla.org/login-manager/loginInfo;1"]
                 .createInstance(Ci.nsILoginInfo);
     let passwordURI = "im://" + this.protocol.id;
     // Note: the normalizedName may not be exactly right if the
     // protocol plugin is missing.
     login.init(passwordURI, null, passwordURI, this.normalizedName, "", "", "");
-    let logins = Services.logins.findLogins({}, passwordURI, null, passwordURI);
+    let logins = Services.logins.findLogins(passwordURI, null, passwordURI);
     for (let l of logins) {
       if (login.matches(l, true)) {
         Services.logins.removeLogin(l);
         break;
       }
     }
     if (this.connected || this.connecting)
       this.disconnect();
--- a/editor/ui/composer/content/publishprefs.js
+++ b/editor/ui/composer/content/publishprefs.js
@@ -807,17 +807,17 @@ function FormatDirForPublishing(dir)
 }
 
 function GetSavedPassword(publishData)
 {
   if (!publishData || !publishData.publishUrl)
     return "";
 
   let url = GetUrlForPasswordManager(publishData);
-  let logins = Services.logins.findLogins({}, url, null, url);
+  let logins = Services.logins.findLogins(url, null, url);
 
   for (let i = 0; i < logins.length; i++) {
     if (logins[i].username == publishData.username)
       return logins[i].password;
   }
 
   return "";
 }
@@ -825,17 +825,17 @@ function GetSavedPassword(publishData)
 function SavePassword(publishData)
 {
   if (!publishData || !publishData.publishUrl || !publishData.username)
     return false;
 
   let url = GetUrlForPasswordManager(publishData);
 
   // Remove existing entry by finding all logins that match.
-  let logins = Services.logins.findLogins({}, url, null, url);
+  let logins = Services.logins.findLogins(url, null, url);
 
   for (let i = 0; i < logins.length; i++) {
     if (logins[i].username == publishData.username) {
       Services.logins.removeLogin(logins[i]);
       break;
     }
   }
 
--- a/mailnews/base/src/msgOAuth2Module.js
+++ b/mailnews/base/src/msgOAuth2Module.js
@@ -85,27 +85,27 @@ OAuth2Module.prototype = {
       get: () => this.refreshToken,
       set: (token) => this.refreshToken = token,
     });
 
     return true;
   },
 
   get refreshToken() {
-    let logins = Services.logins.findLogins({}, this._loginUrl, null, this._scope);
+    let logins = Services.logins.findLogins(this._loginUrl, null, this._scope);
     for (let login of logins) {
       if (login.username == this._username)
         return login.password;
     }
     return "";
   },
   set refreshToken(token) {
     // Check if we already have a login with this username, and modify the
     // password on that, if we do.
-    let logins = Services.logins.findLogins({}, this._loginUrl, null, this._scope);
+    let logins = Services.logins.findLogins(this._loginUrl, null, this._scope);
     for (let login of logins) {
       if (login.username == this._username) {
         if (token) {
           let propBag = Cc["@mozilla.org/hash-property-bag;1"].
                         createInstance(Ci.nsIWritablePropertyBag);
           propBag.setProperty("password", token);
           Services.logins.modifyLogin(login, propBag);
         } else {
--- a/mailnews/compose/test/unit/test_smtpPassword2.js
+++ b/mailnews/compose/test/unit/test_smtpPassword2.js
@@ -24,41 +24,38 @@ add_task(async function() {
   var smtpServer1 = getBasicSmtpServer();
   var smtpServer2 = getBasicSmtpServer();
 
   smtpServer1.authMethod = 3;
   smtpServer1.username = kUser1;
   smtpServer2.authMethod = 3;
   smtpServer2.username = kUser2;
 
-  var count = {};
+  // Test - Check there are two logins to begin with.
+  let logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
-  // Test - Check there are two logins to begin with.
-  let logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
-
-  Assert.equal(count.value, 2);
+  Assert.equal(logins.length, 2);
 
   // These will either be one way around or the other.
   if (logins[0].username == kUser1) {
     Assert.equal(logins[1].username, kUser2);
   } else {
     Assert.equal(logins[0].username, kUser2);
     Assert.equal(logins[1].username, kUser1);
   }
 
   // Test - Remove a login via the incoming server
   smtpServer1.forgetPassword();
 
-  logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
+  logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
   // should be one login left for kUser2
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUser2);
 
   // Test - Remove the other login via the incoming server
   smtpServer2.forgetPassword();
 
-  logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
+  logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
   // There should be no login left.
-  Assert.equal(count.value, 0);
   Assert.equal(logins.length, 0);
 });
--- a/mailnews/compose/test/unit/test_smtpPasswordFailure1.js
+++ b/mailnews/compose/test/unit/test_smtpPasswordFailure1.js
@@ -101,24 +101,20 @@ add_task(async function() {
                                       false, {}, {});
 
     server.performTest();
 
     dump("End Send\n");
 
     Assert.equal(attempt, 2);
 
-    // Check that we haven't forgetton the login even though we've retried and
-    // canceled.
-    let count = {};
-    let logins = Services.logins
-                         .findLogins(count, "smtp://localhost", null,
-                                     "smtp://localhost");
+    // Check that we haven't forgetton the login even though we've retried and cancelled.
+    let logins = Services.logins.findLogins("smtp://localhost", null, "smtp://localhost");
 
-    Assert.equal(count.value, 1);
+    Assert.equal(logins.length, 1);
     Assert.equal(logins[0].username, kUsername);
     Assert.equal(logins[0].password, kInvalidPassword);
   } catch (e) {
     do_throw(e);
   } finally {
     server.stop();
 
     var thread = gThreadManager.currentThread;
--- a/mailnews/compose/test/unit/test_smtpPasswordFailure2.js
+++ b/mailnews/compose/test/unit/test_smtpPasswordFailure2.js
@@ -128,23 +128,20 @@ add_task(async function() {
                                        "AUTH LOGIN",
                                        // then we enter the correct password
                                        "AUTH PLAIN " + AuthPLAIN.encodeLine(kUsername, kValidPassword),
                                        "MAIL FROM:<" + kSender + "> BODY=8BITMIME SIZE=159",
                                        "RCPT TO:<" + kTo + ">",
                                        "DATA"]);
 
 
-      // Now check the new one has been saved.
-      let count = {};
-      let logins = Services.logins
-                           .findLogins(count, "smtp://localhost", null,
-                                       "smtp://localhost");
+    // Now check the new one has been saved.
+    let logins = Services.logins.findLogins("smtp://localhost", null, "smtp://localhost");
 
-    Assert.equal(count.value, 1);
+    Assert.equal(logins.length, 1);
     Assert.equal(logins[0].username, kUsername);
     Assert.equal(logins[0].password, kValidPassword);
     do_test_finished();
   } catch (e) {
     do_throw(e);
   } finally {
     server.stop();
 
--- a/mailnews/compose/test/unit/test_smtpPasswordFailure3.js
+++ b/mailnews/compose/test/unit/test_smtpPasswordFailure3.js
@@ -111,22 +111,19 @@ add_task(async function() {
 });
 
 var URLListener = {
   OnStartRunningUrl(url) {},
   OnStopRunningUrl(url, rc) {
     // Check for ok status.
     Assert.equal(rc, 0);
     // Now check the new password has been saved.
-    let count = {};
-    let logins = Services.logins
-                         .findLogins(count, "smtp://localhost", null,
-                                     "smtp://localhost");
+    let logins = Services.logins.findLogins("smtp://localhost", null, "smtp://localhost");
 
-    Assert.equal(count.value, 1);
+    Assert.equal(logins.length, 1);
     Assert.equal(logins[0].username, kUsername);
     Assert.equal(logins[0].password, kValidPassword);
 
     server.stop();
 
     var thread = gThreadManager.currentThread;
     while (thread.hasPendingEvents())
       thread.processNextEvent(true);
--- a/mailnews/imap/test/unit/test_imapPasswordFailure.js
+++ b/mailnews/imap/test/unit/test_imapPasswordFailure.js
@@ -101,53 +101,47 @@ add_task(async function() {
   dump("\nfinished subscribe 1\n\n");
 
   Assert.equal(attempt, 2);
 
   let rootFolder = incomingServer.rootFolder;
   Assert.ok(rootFolder.containsChildNamed("Inbox"));
   Assert.ok(!rootFolder.containsChildNamed("Subscribed"));
 
-  // Check that we haven't forgotten the login even though we've retried and
-  // canceled.
+  // Check that we haven't forgotten the login even though we've retried and cancelled.
+  let logins = Services.logins.findLogins("imap://localhost", null, "imap://localhost");
 
-  let count = {};
-  let logins = Services.logins.findLogins(count, "imap://localhost", null,
-                                          "imap://localhost");
-
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kInvalidPassword);
 
   server.resetTest();
 
   dump("\nperformExpand 2\n\n");
 
   incomingServer.performExpand(gDummyMsgWindow);
   server.performTest("SUBSCRIBE");
 
   dump("\nfinished subscribe 2\n");
 
   Assert.ok(rootFolder.containsChildNamed("Inbox"));
   Assert.ok(rootFolder.containsChildNamed("Subscribed"));
 
   // Now check the new one has been saved.
-  logins = Services.logins.findLogins(count, "imap://localhost", null,
-                                      "imap://localhost");
+  logins = Services.logins.findLogins("imap://localhost", null, "imap://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kValidPassword);
 
   // Remove the login via the incoming server.
   incomingServer.forgetPassword();
-  logins = Services.logins.findLogins(count, "imap://localhost", null,
-                                      "imap://localhost");
+  logins = Services.logins.findLogins("imap://localhost", null, "imap://localhost");
 
-  Assert.equal(count.value, 0);
+  Assert.equal(logins.length, 0);
 
   do_timeout(500, endTest);
 });
 
 function endTest() {
   incomingServer.closeCachedConnections();
   server.stop();
 
--- a/mailnews/local/test/unit/test_pop3Password3.js
+++ b/mailnews/local/test/unit/test_pop3Password3.js
@@ -23,51 +23,47 @@ add_task(async function() {
   localAccountUtils.loadLocalMailAccount();
 
   let incomingServer1 = MailServices.accounts.createIncomingServer(kUser1, kHostname,
                                                                    kProtocol);
 
   let incomingServer2 = MailServices.accounts.createIncomingServer(kUser2, kHostname,
                                                                    kProtocol);
 
-  var count = {};
+  // Test - Check there are two logins to begin with.
+  var logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
-  // Test - Check there are two logins to begin with.
-  var logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
-
-  Assert.equal(count.value, 2);
   Assert.equal(logins.length, 2);
 
   // These will either be one way around or the other.
   if (logins[0].username == kUser1) {
     Assert.equal(logins[1].username, kUser2);
   } else {
     Assert.equal(logins[0].username, kUser2);
     Assert.equal(logins[1].username, kUser1);
   }
 
   // Test - Remove a login via the incoming server
   incomingServer1.forgetPassword();
 
-  logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
+  logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
   // should be one login left for kUser2
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUser2);
 
   // Bug 561056 - Expand username to also contain domain (i.e. full email).
   incomingServer2.realUsername = kUser2 + "@local.host";
 
-  logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
+  logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
   // There should still be the one login left for kUser2
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUser2);
 
   // Change username to another one.
   incomingServer2.realUsername = "testpop";
 
-  logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
+  logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
   // There should be no login left.
-  Assert.equal(count.value, 0);
   Assert.equal(logins.length, 0);
 });
--- a/mailnews/local/test/unit/test_pop3PasswordFailure.js
+++ b/mailnews/local/test/unit/test_pop3PasswordFailure.js
@@ -127,44 +127,39 @@ function* getMail1() {
   // Now get mail
   getPopMail();
   yield false;
 
   dump("\nGot Mail 1\n");
 
   Assert.equal(attempt, 2);
 
-  // Check that we haven't forgotten the login even though we've retried and
-  // canceled.
-  let count = {};
-  let logins = Services.logins.findLogins(count, "mailbox://localhost", null,
-                                          "mailbox://localhost");
+  // Check that we haven't forgotten the login even though we've retried and cancelled.
+  let logins = Services.logins.findLogins("mailbox://localhost", null, "mailbox://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kInvalidPassword);
 
   server.resetTest();
   yield true;
 }
 
 function* getMail2() {
   dump("\nGet Mail 2\n");
 
   // Now get the mail
   getPopMail();
   yield false;
   dump("\nGot Mail 2\n");
 
   // Now check the new one has been saved.
-  let count = {};
-  let logins = Services.logins.findLogins(count, "mailbox://localhost", null,
-                                          "mailbox://localhost");
+  let logins = Services.logins.findLogins("mailbox://localhost", null, "mailbox://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kValidPassword);
   yield true;
 }
 
 function* end_test() {
   do_test_finished();
 }
--- a/mailnews/local/test/unit/test_pop3PasswordFailure2.js
+++ b/mailnews/local/test/unit/test_pop3PasswordFailure2.js
@@ -19,17 +19,16 @@ load("../../../resources/asyncTestUtils.
 load("../../../resources/alertTestUtils.js");
 load("../../../resources/passwordStorage.js");
 load("../../../resources/mailTestUtils.js");
 
 var server;
 var daemon;
 var incomingServer;
 var attempt = 0;
-var count = {};
 var logins;
 
 var kUserName = "testpop3";
 var kInvalidPassword = "pop3test";
 var kValidPassword = "testpop3";
 
 /* exported alert, confirmEx, promptPasswordPS */
 function alert(aDialogText, aText) {
@@ -125,22 +124,20 @@ function* getMail1() {
 
   // Now get mail
   getPopMail();
   yield false;
   dump("\nGot Mail 1\n");
 
   Assert.equal(attempt, 2);
 
-  // Check that we haven't forgetton the login even though we've retried and
-  // canceled.
-  logins = Services.logins.findLogins(count, "mailbox://localhost", null,
-                                      "mailbox://localhost");
+  // Check that we haven't forgetton the login even though we've retried and cancelled.
+  logins = Services.logins.findLogins("mailbox://localhost", null, "mailbox://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kInvalidPassword);
 
   server.resetTest();
   yield true;
 }
 
 function* getMail2() {
@@ -149,20 +146,19 @@ function* getMail2() {
   // Now get the mail
   getPopMail();
   yield false;
   dump("\nGot Mail 2\n");
 }
 
 function* endTest() {
   // Now check the new one has been saved.
-  logins = Services.logins.findLogins(count, "mailbox://localhost", null,
-                                      "mailbox://localhost");
+  logins = Services.logins.findLogins("mailbox://localhost", null, "mailbox://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kValidPassword);
   yield true;
 }
 
 function run_test() {
   // Disable new mail notifications
   Services.prefs.setBoolPref("mail.biff.play_sound", false);
--- a/mailnews/local/test/unit/test_pop3PasswordFailure3.js
+++ b/mailnews/local/test/unit/test_pop3PasswordFailure3.js
@@ -21,17 +21,16 @@ load("../../../resources/asyncTestUtils.
 load("../../../resources/alertTestUtils.js");
 load("../../../resources/passwordStorage.js");
 load("../../../resources/mailTestUtils.js");
 
 var server;
 var daemon;
 var incomingServer;
 var attempt = 0;
-var count = {};
 var logins;
 
 var kUserName = "testpop3";
 var kInvalidPassword = "pop3test";
 var kValidPassword = "testpop3";
 
 /* exported alert, confirmEx, promptPasswordPS */
 function alert(aDialogText, aText) {
@@ -127,22 +126,20 @@ function* getMail1() {
 
   // Now get mail
   getPopMail();
   yield false;
   dump("\nGot Mail 1\n");
 
   Assert.equal(attempt, 2);
 
-  // Check that we haven't forgetton the login even though we've retried and
-  // canceled.
-  logins = Services.logins.findLogins(count, "mailbox://localhost", null,
-                                      "mailbox://localhost");
+  // Check that we haven't forgetton the login even though we've retried and cancelled.
+  logins = Services.logins.findLogins("mailbox://localhost", null, "mailbox://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kInvalidPassword);
 
   server.resetTest();
   yield true;
 }
 
 function* getMail2() {
@@ -151,20 +148,19 @@ function* getMail2() {
   // Now get the mail
   getPopMail();
   yield false;
   dump("\nGot Mail 2\n");
 }
 
 function* endTest() {
   // Now check the new one has been saved.
-  logins = Services.logins.findLogins(count, "mailbox://localhost", null,
-                                      "mailbox://localhost");
+  logins = Services.logins.findLogins("mailbox://localhost", null, "mailbox://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kValidPassword);
   yield true;
 }
 
 function run_test() {
   // Disable new mail notifications
   Services.prefs.setBoolPref("mail.biff.play_sound", false);
--- a/mailnews/news/test/unit/test_nntpPassword3.js
+++ b/mailnews/news/test/unit/test_nntpPassword3.js
@@ -20,25 +20,23 @@ add_task(async function() {
   await setupForPassword("signons-mailnews1.8.json");
 
   // Set up the basic accounts and folders.
   localAccountUtils.loadLocalMailAccount();
 
   var incomingServer = MailServices.accounts.createIncomingServer(null, kHostname,
                                                                   kProtocol);
 
-  var count = {};
+  // Test - Check there is a password to begin with...
+  var logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
-  // Test - Check there is a password to begin with...
-  var logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
-
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUsername);
   Assert.equal(logins[0].password, kPassword);
 
   // Test - Remove the news password login via the incoming server
   incomingServer.forgetPassword();
 
-  logins = Services.logins.findLogins(count, kServerUrl, null, kServerUrl);
+  logins = Services.logins.findLogins(kServerUrl, null, kServerUrl);
 
   // should be no passwords left...
-  Assert.equal(count.value, 0);
+  Assert.equal(logins.length, 0);
 });
--- a/mailnews/news/test/unit/test_nntpPasswordFailure.js
+++ b/mailnews/news/test/unit/test_nntpPasswordFailure.js
@@ -21,17 +21,16 @@ load("../../../resources/alertTestUtils.
 load("../../../resources/passwordStorage.js");
 load("../../../resources/mailTestUtils.js");
 
 var server;
 var daemon;
 var incomingServer;
 var folder;
 var attempt = 0;
-var count = {};
 var logins;
 
 var kUserName = "testnews";
 var kInvalidPassword = "newstest";
 var kValidPassword = "notallama";
 
 /* exported alert, confirmEx, promptUsernameAndPasswordPS */
 function alert(aDialogText, aText) {
@@ -122,22 +121,20 @@ function* getMail1() {
 
   // Now get mail
   getMail();
   yield false;
   dump("\nGot Mail 1\n");
 
   Assert.equal(attempt, 2);
 
-  // Check that we haven't forgotten the login even though we've retried and
-  // canceled.
-  logins = Services.logins.findLogins(count, "news://localhost", null,
-                                      "news://localhost");
+  // Check that we haven't forgotten the login even though we've retried and cancelled.
+  logins = Services.logins.findLogins("news://localhost", null, "news://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kInvalidPassword);
 
   server.resetTest();
   yield true;
 }
 
 function* getMail2() {
@@ -146,20 +143,19 @@ function* getMail2() {
   // Now get the mail
   getMail();
   yield false;
   dump("\nGot Mail 2\n");
 }
 
 function* endTest() {
   // Now check the new one has been saved.
-  logins = Services.logins.findLogins(count, "news://localhost", null,
-                                      "news://localhost");
+  logins = Services.logins.findLogins("news://localhost", null, "news://localhost");
 
-  Assert.equal(count.value, 1);
+  Assert.equal(logins.length, 1);
   Assert.equal(logins[0].username, kUserName);
   Assert.equal(logins[0].password, kValidPassword);
   yield true;
 }
 
 function run_test() {
   // Disable new mail notifications
   Services.prefs.setBoolPref("mail.biff.play_sound", false);