Bug 1549814 - LoginHelper.searchLoginsWithObject always returns an array so no need to check for a falsy return value. r?MattN draft
authorpulselistener
Sat, 18 May 2019 06:46:56 +0000
changeset 2008556 7300216bdb6b21f26810126d97b74166289272cf
parent 2008555 8324a3a088cce5cfc4365b7d77d53db280cef668
child 2008557 b02820c04fd4decc214e905811ec42d0ed7c32f0
push id363922
push userreviewbot
push dateSat, 18 May 2019 06:47:24 +0000
treeherdertry@8bf9b3332afe [default view] [failures only]
reviewersMattN
bugs1549814
milestone68.0a1
Bug 1549814 - LoginHelper.searchLoginsWithObject always returns an array so no need to check for a falsy return value. r?MattN Differential Revision: https://phabricator.services.mozilla.com/D31712 Differential Diff: PHID-DIFF-2ngrvlumrmlv67s3kufz
browser/components/aboutlogins/AboutLoginsParent.jsm
--- a/browser/components/aboutlogins/AboutLoginsParent.jsm
+++ b/browser/components/aboutlogins/AboutLoginsParent.jsm
@@ -73,18 +73,18 @@ var AboutLoginsParent = {
       case "AboutLogins:DeleteLogin": {
         let login = LoginHelper.vanillaObjectToLogin(message.data.login);
         Services.logins.removeLogin(login);
         break;
       }
       case "AboutLogins:OpenSite": {
         let guid = message.data.login.guid;
         let logins = LoginHelper.searchLoginsWithObject({guid});
-        if (!logins || logins.length != 1) {
-          log.warn(`AboutLogins:OpenSite: expected to find a login for guid: ${guid} but found ${(logins || []).length}`);
+        if (logins.length != 1) {
+          log.warn(`AboutLogins:OpenSite: expected to find a login for guid: ${guid} but found ${logins.length}`);
           return;
         }
 
         message.target.ownerGlobal.openWebLinkIn(logins[0].hostname, "tab", {relatedToCurrent: true});
         break;
       }
       case "AboutLogins:Subscribe": {
         if (!ChromeUtils.nondeterministicGetWeakSetKeys(this._subscribers).length) {
@@ -94,18 +94,18 @@ var AboutLoginsParent = {
 
         let messageManager = message.target.messageManager;
         messageManager.sendAsyncMessage("AboutLogins:AllLogins", this.getAllLogins());
         break;
       }
       case "AboutLogins:UpdateLogin": {
         let loginUpdates = message.data.login;
         let logins = LoginHelper.searchLoginsWithObject({guid: loginUpdates.guid});
-        if (!logins || logins.length != 1) {
-          log.warn(`AboutLogins:UpdateLogin: expected to find a login for guid: ${loginUpdates.guid} but found ${(logins || []).length}`);
+        if (logins.length != 1) {
+          log.warn(`AboutLogins:UpdateLogin: expected to find a login for guid: ${loginUpdates.guid} but found ${logins.length}`);
           return;
         }
 
         let modifiedLogin = logins[0].clone();
         if (loginUpdates.hasOwnProperty("username")) {
           modifiedLogin.username = loginUpdates.username;
         }
         if (loginUpdates.hasOwnProperty("password")) {