Bug 1386283 - Enable eslint 'brace-style' and 'curly' rules on passwordmgr with --fix. r=mconley
authorMatthew Noorenberghe <mozilla@noorenberghe.ca>
Thu, 10 Jan 2019 19:26:48 +0000
changeset 453333 16ce9a71ff04850dd34a71759852bca9a62a413d
parent 453332 06cb65fac0f343d8feb6ef780d1e176dad0effae
child 453334 3994da3447c34fbf333b51776fd91afeb7fa1dbf
push id35352
push userdvarga@mozilla.com
push dateFri, 11 Jan 2019 04:12:48 +0000
treeherdermozilla-central@65326bd78f83 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1386283
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1386283 - Enable eslint 'brace-style' and 'curly' rules on passwordmgr with --fix. r=mconley ignore-this-changeset for blame Differential Revision: https://phabricator.services.mozilla.com/D16110
toolkit/components/passwordmgr/.eslintrc.js
toolkit/components/passwordmgr/LoginHelper.jsm
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/passwordmgr/crypto-SDR.js
toolkit/components/passwordmgr/nsLoginInfo.js
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/nsLoginManagerPrompter.js
toolkit/components/passwordmgr/storage-json.js
toolkit/components/passwordmgr/storage-mozStorage.js
toolkit/components/passwordmgr/test/.eslintrc.js
toolkit/components/passwordmgr/test/browser/.eslintrc.js
toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.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/browser/subtst_notifications_11.html
toolkit/components/passwordmgr/test/chrome/notification_common.js
toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_3.html
toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html
toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_2.html
toolkit/components/passwordmgr/test/mochitest/test_bug_776171.html
toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
toolkit/components/passwordmgr/test/mochitest/test_xhr_2.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
toolkit/components/passwordmgr/test/unit/head.js
toolkit/components/passwordmgr/test/unit/test_OSCrypto_win.js
toolkit/components/passwordmgr/test/unit/test_disabled_hosts.js
toolkit/components/passwordmgr/test/unit/test_legacy_empty_formSubmitURL.js
toolkit/components/passwordmgr/test/unit/test_legacy_validation.js
toolkit/components/passwordmgr/test/unit/test_logins_change.js
toolkit/components/passwordmgr/test/unit/test_logins_decrypt_failure.js
toolkit/components/passwordmgr/test/unit/test_logins_metainfo.js
toolkit/components/passwordmgr/test/unit/test_logins_search.js
toolkit/components/passwordmgr/test/unit/test_module_LoginImport.js
toolkit/components/passwordmgr/test/unit/test_module_LoginStore.js
toolkit/components/passwordmgr/test/unit/test_notifications.js
toolkit/components/passwordmgr/test/unit/test_storage.js
toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
--- a/toolkit/components/passwordmgr/.eslintrc.js
+++ b/toolkit/components/passwordmgr/.eslintrc.js
@@ -1,13 +1,14 @@
 "use strict";
 
 module.exports = {
+  "rules": {
+    "brace-style": ["error", "1tbs", {"allowSingleLine": false}],
 
-  "rules": {
     // XXX Bug 1358949 - This should be reduced down - probably to 20 or to
     // be removed & synced with the mozilla/recommended value.
     "complexity": ["error", 56],
 
     "indent": ["error", 2, {
       ignoredNodes: ["ConditionalExpression"],
       ArrayExpression: "first",
       SwitchCase: 1,
@@ -20,11 +21,12 @@ module.exports = {
       FunctionDeclaration: {
         parameters: "first",
       },
       MemberExpression: "off",
       ObjectExpression: "first",
       outerIIFEBody: 0,
     }],
 
+    "curly": ["error", "all"],
     "no-unused-vars": ["error", {"args": "none", "vars": "local", "varsIgnorePattern": "^(ids|ignored|unused)$"}],
   }
 };
--- a/toolkit/components/passwordmgr/LoginHelper.jsm
+++ b/toolkit/components/passwordmgr/LoginHelper.jsm
@@ -245,41 +245,46 @@ var LoginHelper = {
     return false;
   },
 
   doLoginsMatch(aLogin1, aLogin2, {
     ignorePassword = false,
     ignoreSchemes = false,
   }) {
     if (aLogin1.httpRealm != aLogin2.httpRealm ||
-        aLogin1.username != aLogin2.username)
+        aLogin1.username != aLogin2.username) {
       return false;
+    }
 
-    if (!ignorePassword && aLogin1.password != aLogin2.password)
+    if (!ignorePassword && aLogin1.password != aLogin2.password) {
       return false;
+    }
 
     if (ignoreSchemes) {
       let login1HostPort = this.maybeGetHostPortForURL(aLogin1.hostname);
       let login2HostPort = this.maybeGetHostPortForURL(aLogin2.hostname);
-      if (login1HostPort != login2HostPort)
+      if (login1HostPort != login2HostPort) {
         return false;
+      }
 
       if (aLogin1.formSubmitURL != "" && aLogin2.formSubmitURL != "" &&
           this.maybeGetHostPortForURL(aLogin1.formSubmitURL) !=
           this.maybeGetHostPortForURL(aLogin2.formSubmitURL)) {
         return false;
       }
     } else {
-      if (aLogin1.hostname != aLogin2.hostname)
+      if (aLogin1.hostname != aLogin2.hostname) {
         return false;
+      }
 
       // If either formSubmitURL is blank (but not null), then match.
       if (aLogin1.formSubmitURL != "" && aLogin2.formSubmitURL != "" &&
-          aLogin1.formSubmitURL != aLogin2.formSubmitURL)
+          aLogin1.formSubmitURL != aLogin2.formSubmitURL) {
         return false;
+      }
     }
 
     // The .usernameField and .passwordField values are ignored.
 
     return true;
   },
 
   /**
@@ -560,18 +565,19 @@ var LoginHelper = {
    *
    * @param {Element} element
    *                  the field we want to check.
    *
    * @returns {Boolean} true if the field type is one
    *                    of the username types.
    */
   isUsernameFieldType(element) {
-    if (ChromeUtils.getClassName(element) !== "HTMLInputElement")
+    if (ChromeUtils.getClassName(element) !== "HTMLInputElement") {
       return false;
+    }
 
     if (!element.isConnected) {
       // If the element isn't connected then it isn't visible to the user so
       // shouldn't be considered. It must have been connected in the past.
       return false;
     }
 
     let fieldType = (element.hasAttribute("type") ?
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -152,20 +152,21 @@ prefBranch.addObserver("", observer.onPr
 
 observer.onPrefChange(); // read initial values
 
 
 // This object maps to the "child" process (even in the single-process case).
 var LoginManagerContent = {
   __formFillService: null, // FormFillController, for username autocompleting
   get _formFillService() {
-    if (!this.__formFillService)
+    if (!this.__formFillService) {
       this.__formFillService =
                       Cc["@mozilla.org/satchel/form-fill-controller;1"].
                       getService(Ci.nsIFormFillController);
+    }
     return this.__formFillService;
   },
 
   _getRandomId() {
     return Cc["@mozilla.org/uuid-generator;1"]
              .getService(Ci.nsIUUIDGenerator).generateUUID().toString();
   },
 
@@ -207,33 +208,35 @@ var LoginManagerContent = {
     let request = this._requests.get(data.requestId);
 
     this._requests.delete(data.requestId);
 
     let count = this._managers.get(msg.target);
     if (--count === 0) {
       this._managers.delete(msg.target);
 
-      for (let message of this._messages)
+      for (let message of this._messages) {
         msg.target.removeMessageListener(message, this);
+      }
     } else {
       this._managers.set(msg.target, count);
     }
 
     return request;
   },
 
   _sendRequest(messageManager, requestData,
                name, messageData) {
     let count;
     if (!(count = this._managers.get(messageManager))) {
       this._managers.set(messageManager, 1);
 
-      for (let message of this._messages)
+      for (let message of this._messages) {
         messageManager.addMessageListener(message, this);
+      }
     } else {
       this._managers.set(messageManager, ++count);
     }
 
     let requestId = this._getRandomId();
     messageData.requestId = requestId;
 
     messageManager.sendAsyncMessage(name, messageData);
@@ -601,40 +604,46 @@ var LoginManagerContent = {
     log("maybeOpenAutocompleteAfterFocus: Opening the autocomplete popup");
     this._formFillService.showPopup();
   },
 
   /**
    * Listens for DOMAutoComplete and blur events on an input field.
    */
   onUsernameInput(event) {
-    if (!event.isTrusted)
+    if (!event.isTrusted) {
       return;
+    }
 
-    if (!gEnabled)
+    if (!gEnabled) {
       return;
+    }
 
     var acInputField = event.target;
 
     // This is probably a bit over-conservatative.
-    if (ChromeUtils.getClassName(acInputField.ownerDocument) != "HTMLDocument")
+    if (ChromeUtils.getClassName(acInputField.ownerDocument) != "HTMLDocument") {
       return;
+    }
 
-    if (!LoginHelper.isUsernameFieldType(acInputField))
+    if (!LoginHelper.isUsernameFieldType(acInputField)) {
       return;
+    }
 
     var acForm = LoginFormFactory.createFromField(acInputField);
-    if (!acForm)
+    if (!acForm) {
       return;
+    }
 
     // If the username is blank, bail out now -- we don't want
     // fillForm() to try filling in a login without a username
     // to filter on (bug 471906).
-    if (!acInputField.value)
+    if (!acInputField.value) {
       return;
+    }
 
     log("onUsernameInput from", event.type);
 
     let doc = acForm.ownerDocument;
     let formOrigin = LoginUtils._getPasswordOrigin(doc.documentURI);
     let recipes = LoginRecipesContent.getRecipes(formOrigin, doc.defaultView);
 
     // Make sure the username field fillForm will use is the
@@ -788,21 +797,22 @@ var LoginManagerContent = {
           continue;
         }
 
         usernameField = element;
         break;
       }
     }
 
-    if (!usernameField)
+    if (!usernameField) {
       log("(form -- no username field found)");
-    else
+    } else {
       log("Username field ", usernameField, "has name/value:",
           usernameField.name, "/", usernameField.value);
+    }
 
     // If we're not submitting a form (it's a page load), there are no
     // password field values for us to use for identifying fields. So,
     // just assume the first password field is the one to be filled in.
     if (!isSubmission || pwFields.length == 1) {
       var passwordField = pwFields[0].element;
       log("Password field", passwordField, "has name: ", passwordField.name);
       return [usernameField, passwordField, null];
@@ -919,18 +929,19 @@ var LoginManagerContent = {
     if (PrivateBrowsingUtils.isContentWindowPrivate(win)) {
       // We won't do anything in private browsing mode anyway,
       // so there's no need to perform further checks.
       log("(form submission ignored in private browsing mode)");
       return;
     }
 
     // If password saving is disabled (globally or for host), bail out now.
-    if (!gEnabled)
+    if (!gEnabled) {
       return;
+    }
 
     var hostname = LoginUtils._getPasswordOrigin(doc.documentURI);
     if (!hostname) {
       log("(form submission ignored -- invalid hostname)");
       return;
     }
 
     let formSubmitURL = LoginUtils._getActionOrigin(form);
@@ -938,18 +949,19 @@ var LoginManagerContent = {
 
     let recipes = LoginRecipesContent.getRecipes(hostname, win);
 
     // Get the appropriate fields from the form.
     var [usernameField, newPasswordField, oldPasswordField] =
           this._getFormFields(form, true, recipes);
 
     // Need at least 1 valid password field to do anything.
-    if (newPasswordField == null)
+    if (newPasswordField == null) {
       return;
+    }
 
     // Check for autocomplete=off attribute. We don't use it to prevent
     // autofilling (for existing logins), but won't save logins when it's
     // present and the storeWhenAutocompleteOff pref is false.
     // XXX spin out a bug that we don't update timeLastUsed in this case?
     if ((this._isAutocompleteDisabled(form) ||
          this._isAutocompleteDisabled(usernameField) ||
          this._isAutocompleteDisabled(newPasswordField) ||
@@ -1125,26 +1137,29 @@ var LoginManagerContent = {
       // Discard logins which have username/password values that don't
       // fit into the fields (as specified by the maxlength attribute).
       // The user couldn't enter these values anyway, and it helps
       // with sites that have an extra PIN to be entered (bug 391514)
       var maxUsernameLen = Number.MAX_VALUE;
       var maxPasswordLen = Number.MAX_VALUE;
 
       // If attribute wasn't set, default is -1.
-      if (usernameField && usernameField.maxLength >= 0)
+      if (usernameField && usernameField.maxLength >= 0) {
         maxUsernameLen = usernameField.maxLength;
-      if (passwordField.maxLength >= 0)
+      }
+      if (passwordField.maxLength >= 0) {
         maxPasswordLen = passwordField.maxLength;
+      }
 
       var logins = foundLogins.filter(function(l) {
         var fit = (l.username.length <= maxUsernameLen &&
                    l.password.length <= maxPasswordLen);
-        if (!fit)
+        if (!fit) {
           log("Ignored", l.username, "login: won't fit");
+        }
 
         return fit;
       }, this);
 
       if (logins.length == 0) {
         log("form not filled, none of the logins fit in the field");
         autofillResult = AUTOFILL_RESULT.NO_LOGINS_FIT;
         return;
@@ -1187,20 +1202,21 @@ var LoginManagerContent = {
       } else if (logins.length == 1) {
         selectedLogin = logins[0];
       } else {
         // We have multiple logins. Handle a special case here, for sites
         // which have a normal user+pass login *and* a password-only login
         // (eg, a PIN). Prefer the login that matches the type of the form
         // (user+pass or pass-only) when there's exactly one that matches.
         let matchingLogins;
-        if (usernameField)
+        if (usernameField) {
           matchingLogins = logins.filter(l => l.username);
-        else
+        } else {
           matchingLogins = logins.filter(l => !l.username);
+        }
 
         if (matchingLogins.length != 1) {
           log("Multiple logins for form, so not filling any.");
           autofillResult = AUTOFILL_RESULT.MULTIPLE_LOGINS;
           return;
         }
 
         selectedLogin = matchingLogins[0];
@@ -1408,18 +1424,19 @@ var LoginUtils = {
    * Get the parts of the URL we want for identification.
    * Strip out things like the userPass portion
    */
   _getPasswordOrigin(uriString, allowJS) {
     var realm = "";
     try {
       var uri = Services.io.newURI(uriString);
 
-      if (allowJS && uri.scheme == "javascript")
+      if (allowJS && uri.scheme == "javascript") {
         return "javascript:";
+      }
 
       // Build this manually instead of using prePath to avoid including the userPass portion.
       realm = uri.scheme + "://" + uri.displayHostPort;
     } catch (e) {
       // bug 159484 - disallow url types that don't support a hostPort.
       // (although we handle "javascript:..." as a special case above.)
       log("Couldn't parse origin for", uriString, e);
       realm = null;
@@ -1427,34 +1444,37 @@ var LoginUtils = {
 
     return realm;
   },
 
   _getActionOrigin(form) {
     var uriString = form.action;
 
     // A blank or missing action submits to where it came from.
-    if (uriString == "")
-      uriString = form.baseURI; // ala bug 297761
+    if (uriString == "") {
+      uriString = form.baseURI;
+    } // ala bug 297761
 
     return this._getPasswordOrigin(uriString, true);
   },
 };
 
 // nsIAutoCompleteResult implementation
 function UserAutoCompleteResult(aSearchString, matchingLogins, {isSecure, messageManager, isPasswordField}) {
   function loginSort(a, b) {
     var userA = a.username.toLowerCase();
     var userB = b.username.toLowerCase();
 
-    if (userA < userB)
+    if (userA < userB) {
       return -1;
+    }
 
-    if (userA > userB)
+    if (userA > userB) {
       return 1;
+    }
 
     return 0;
   }
 
   function findDuplicates(loginList) {
     let seen = new Set();
     let duplicates = new Set();
     for (let login of loginList) {
@@ -1581,18 +1601,19 @@ UserAutoCompleteResult.prototype = {
     }
     if (this._showInsecureFieldWarning) {
       index--;
     }
 
     var [removedLogin] = this.logins.splice(index, 1);
 
     this.matchCount--;
-    if (this.defaultIndex > this.logins.length)
+    if (this.defaultIndex > this.logins.length) {
       this.defaultIndex--;
+    }
 
     if (removeFromDB) {
       if (this._messageManager) {
         let vanilla = LoginHelper.loginToVanillaObject(removedLogin);
         this._messageManager.sendAsyncMessage("RemoteLogins:removeLogin",
                                               { login: vanilla });
       } else {
         Services.logins.removeLogin(removedLogin);
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -164,25 +164,36 @@ let signonsTreeView = {
     }
   },
   isEditable(row, col) {
     if (col.id == "userCol" || col.id == "passwordCol") {
       return true;
     }
     return false;
   },
-  isSeparator(index) { return false; },
-  isSorted() { return false; },
-  isContainer(index) { return false; },
+  isSeparator(index) {
+    return false;
+  },
+  isSorted() {
+    return false;
+  },
+  isContainer(index) {
+    return false;
+  },
   cycleHeader(column) {},
-  getRowProperties(row) { return ""; },
-  getColumnProperties(column) { return ""; },
+  getRowProperties(row) {
+    return "";
+  },
+  getColumnProperties(column) {
+    return "";
+  },
   getCellProperties(row, column) {
-    if (column.element.getAttribute("id") == "siteCol")
+    if (column.element.getAttribute("id") == "siteCol") {
       return "ltr";
+    }
 
     return "";
   },
   setCellText(row, col, value) {
     let table = GetVisibleLogins();
     function _editLogin(field) {
       if (value == table[row][field]) {
         return;
@@ -230,20 +241,22 @@ function SortTree(column, ascending) {
         valB = b[column].toLowerCase();
         break;
 
       default:
         valA = a[column];
         valB = b[column];
     }
 
-    if (valA < valB)
+    if (valA < valB) {
       return -1;
-    if (valA > valB)
+    }
+    if (valA > valB) {
       return 1;
+    }
     return 0;
   }
 
   // do the sort
   table.sort(compareFunc);
   if (!ascending) {
     table.reverse();
   }
@@ -378,18 +391,19 @@ function DeleteSignon() {
 
 function DeleteAllSignons() {
   // Confirm the user wants to remove all passwords
   let dummy = { value: false };
   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
+                                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++) {
     deletedSignons.push(table[i]);
@@ -541,27 +555,31 @@ function SignonClearFilter() {
 
 function FocusFilterBox() {
   if (filterField.getAttribute("focused") != "true") {
     filterField.focus();
   }
 }
 
 function SignonMatchesFilter(aSignon, aFilterValue) {
-  if (aSignon.hostname.toLowerCase().includes(aFilterValue))
+  if (aSignon.hostname.toLowerCase().includes(aFilterValue)) {
     return true;
+  }
   if (aSignon.username &&
-      aSignon.username.toLowerCase().includes(aFilterValue))
+      aSignon.username.toLowerCase().includes(aFilterValue)) {
     return true;
+  }
   if (aSignon.httpRealm &&
-      aSignon.httpRealm.toLowerCase().includes(aFilterValue))
+      aSignon.httpRealm.toLowerCase().includes(aFilterValue)) {
     return true;
+  }
   if (showingPasswords && aSignon.password &&
-      aSignon.password.toLowerCase().includes(aFilterValue))
+      aSignon.password.toLowerCase().includes(aFilterValue)) {
     return true;
+  }
 
   return false;
 }
 
 function _filterPasswords(aFilterValue, view) {
   aFilterValue = aFilterValue.toLowerCase();
   return signons.filter(s => SignonMatchesFilter(s, aFilterValue));
 }
@@ -596,18 +614,19 @@ function FilterPasswords() {
   let oldRowCount = signonsTreeView.rowCount;
   signonsTreeView.rowCount = 0;
   signonsTree.treeBoxObject.rowCountChanged(0, -oldRowCount);
   // Set up the filtered display
   signonsTreeView.rowCount = signonsTreeView._filterSet.length;
   signonsTree.treeBoxObject.rowCountChanged(0, signonsTreeView.rowCount);
 
   // if the view is not empty then select the first item
-  if (signonsTreeView.rowCount > 0)
+  if (signonsTreeView.rowCount > 0) {
     signonsTreeView.selection.select(0);
+  }
 
   signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionFiltered");
   removeAllButton.setAttribute("label", kSignonBundle.getString("removeAllShown.label"));
   removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAllShown.accesskey"));
 }
 
 function CopySiteUrl() {
   // Copy selected site url to clipboard
@@ -616,18 +635,19 @@ function CopySiteUrl() {
   let row = signonsTree.currentIndex;
   let url = signonsTreeView.getCellText(row, {id: "siteCol"});
   clipboard.copyString(url);
 }
 
 function CopyPassword() {
   // Don't copy passwords if we aren't already showing the passwords & a master
   // password hasn't been entered.
-  if (!showingPasswords && !masterPasswordLogin())
+  if (!showingPasswords && !masterPasswordLogin()) {
     return;
+  }
   // Copy selected signon's password to clipboard
   let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].
                   getService(Ci.nsIClipboardHelper);
   let row = signonsTree.currentIndex;
   let password = signonsTreeView.getCellText(row, {id: "passwordCol" });
   clipboard.copyString(password);
   Services.telemetry.getHistogramById("PWMGR_MANAGE_COPIED_PASSWORD").add(1);
   Services.obs.notifyObservers(null, "weave:telemetry:histogram", "PWMGR_MANAGE_COPIED_PASSWORD");
@@ -702,18 +722,19 @@ function UpdateContextMenu() {
 
 function masterPasswordLogin(noPasswordCallback) {
   // This doesn't harm if passwords are not encrypted
   let tokendb = Cc["@mozilla.org/security/pk11tokendb;1"]
                     .createInstance(Ci.nsIPK11TokenDB);
   let token = tokendb.getInternalKeyToken();
 
   // If there is no master password, still give the user a chance to opt-out of displaying passwords
-  if (token.checkPassword(""))
+  if (token.checkPassword("")) {
     return noPasswordCallback ? noPasswordCallback() : true;
+  }
 
   // So there's a master password. But since checkPassword didn't succeed, we're logged out (per nsIPK11Token.idl).
   try {
     // Relogin and ask for the master password.
     token.login(true); // 'true' means always prompt for token password. User will be prompted until
     // clicking 'Cancel' or entering the correct password.
   } catch (e) {
     // An exception will be thrown if the user cancels the login prompt dialog.
--- a/toolkit/components/passwordmgr/crypto-SDR.js
+++ b/toolkit/components/passwordmgr/crypto-SDR.js
@@ -14,19 +14,20 @@ function LoginManagerCrypto_SDR() {
 
 LoginManagerCrypto_SDR.prototype = {
 
   classID: Components.ID("{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}"),
   QueryInterface: ChromeUtils.generateQI([Ci.nsILoginManagerCrypto]),
 
   __decoderRing: null,  // nsSecretDecoderRing service
   get _decoderRing() {
-    if (!this.__decoderRing)
+    if (!this.__decoderRing) {
       this.__decoderRing = Cc["@mozilla.org/security/sdr;1"].
                            getService(Ci.nsISecretDecoderRing);
+    }
     return this.__decoderRing;
   },
 
   __utfConverter: null, // UCS2 <--> UTF8 string conversion
   get _utfConverter() {
     if (!this.__utfConverter) {
       this.__utfConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
                             createInstance(Ci.nsIScriptableUnicodeConverter);
@@ -83,20 +84,21 @@ LoginManagerCrypto_SDR.prototype = {
         canceledMP = true;
         throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
       } else {
         throw Components.Exception("Couldn't encrypt string", Cr.NS_ERROR_FAILURE);
       }
     } finally {
       this._uiBusy = false;
       // If we triggered a master password prompt, notify observers.
-      if (!wasLoggedIn && this.isLoggedIn)
+      if (!wasLoggedIn && this.isLoggedIn) {
         this._notifyObservers("passwordmgr-crypto-login");
-      else if (canceledMP)
+      } else if (canceledMP) {
         this._notifyObservers("passwordmgr-crypto-loginCanceled");
+      }
     }
     return cipherText;
   },
 
 
   /*
    * encryptMany
    *
@@ -176,20 +178,21 @@ LoginManagerCrypto_SDR.prototype = {
         canceledMP = true;
         throw Components.Exception("User canceled master password entry", Cr.NS_ERROR_ABORT);
       } else {
         throw Components.Exception("Couldn't decrypt string", Cr.NS_ERROR_FAILURE);
       }
     } finally {
       this._uiBusy = false;
       // If we triggered a master password prompt, notify observers.
-      if (!wasLoggedIn && this.isLoggedIn)
+      if (!wasLoggedIn && this.isLoggedIn) {
         this._notifyObservers("passwordmgr-crypto-login");
-      else if (canceledMP)
+      } else if (canceledMP) {
         this._notifyObservers("passwordmgr-crypto-loginCanceled");
+      }
     }
 
     return plainText;
   },
 
 
   /*
    * uiBusy
--- a/toolkit/components/passwordmgr/nsLoginInfo.js
+++ b/toolkit/components/passwordmgr/nsLoginInfo.js
@@ -47,18 +47,19 @@ nsLoginInfo.prototype = {
 
   equals(aLogin) {
     if (this.hostname != aLogin.hostname ||
         this.formSubmitURL != aLogin.formSubmitURL ||
         this.httpRealm != aLogin.httpRealm ||
         this.username != aLogin.username ||
         this.password != aLogin.password ||
         this.usernameField != aLogin.usernameField ||
-        this.passwordField != aLogin.passwordField)
+        this.passwordField != aLogin.passwordField) {
       return false;
+    }
 
     return true;
   },
 
   clone() {
     let clone = Cc["@mozilla.org/login-manager/loginInfo;1"].
                 createInstance(Ci.nsILoginInfo);
     clone.init(this.hostname, this.formSubmitURL, this.httpRealm,
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -390,18 +390,19 @@ LoginManager.prototype = {
 
     let disabledHosts = [];
     for (let perm of Services.perms.enumerator) {
       if (perm.type == PERMISSION_SAVE_LOGINS && perm.capability == Services.perms.DENY_ACTION) {
         disabledHosts.push(perm.principal.URI.displayPrePath);
       }
     }
 
-    if (count)
-      count.value = disabledHosts.length; // needed for XPCOM
+    if (count) {
+      count.value = disabledHosts.length;
+    } // needed for XPCOM
 
     log.debug("getAllDisabledHosts: returning", disabledHosts.length, "disabled hosts.");
     return disabledHosts;
   },
 
 
   /**
    * Search for the known logins for entries matching the specified criteria.
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -67,18 +67,19 @@ LoginManagerPromptFactory.prototype = {
   _doAsyncPrompt() {
     if (this._asyncPromptInProgress) {
       this.log("_doAsyncPrompt bypassed, already in progress");
       return;
     }
 
     // Find the first prompt key we have in the queue
     var hashKey = null;
-    for (hashKey in this._asyncPrompts)
+    for (hashKey in this._asyncPrompts) {
       break;
+    }
 
     if (!hashKey) {
       this.log("_doAsyncPrompt:run bypassed, no prompts in the queue");
       return;
     }
 
     // If login manger has logins for this host, defer prompting if we're
     // already waiting on a master password entry.
@@ -141,20 +142,21 @@ LoginManagerPromptFactory.prototype = {
             cancelationCounter.count++;
           }
           if (prompter._browser) {
             prompter._browser.canceledAuthenticationPromptCounter = cancelationCounter;
           }
         }
 
         for (var consumer of prompt.consumers) {
-          if (!consumer.callback)
-            // Not having a callback means that consumer didn't provide it
-            // or canceled the notification
+          if (!consumer.callback) {
+          // Not having a callback means that consumer didn't provide it
+          // or canceled the notification
             continue;
+          }
 
           self.log("Calling back to " + consumer.callback + " ok=" + ok);
           try {
             if (ok) {
               consumer.callback.onAuthAvailable(consumer.context, prompt.authInfo);
             } else {
               consumer.callback.onAuthCancelled(consumer.context, !this.cancel);
             }
@@ -194,18 +196,19 @@ LoginManagerPromptFactory.prototype = {
       // notifying the callbacks of success/failure, since it's already
       // asking the user for input. Reusing a callback can be crashy.
       if (prompt.inProgress) {
         this.log("skipping a prompt in progress");
         continue;
       }
 
       for (var consumer of prompt.consumers) {
-        if (!consumer.callback)
+        if (!consumer.callback) {
           continue;
+        }
 
         this.log("Canceling async auth prompt callback " + consumer.callback);
         try {
           consumer.callback.onAuthCancelled(consumer.context, true);
         } catch (e) { /* Just ignore exceptions from the callback */ }
       }
     }
   },
@@ -249,18 +252,19 @@ LoginManagerPrompter.prototype = {
   _browser: null,
   _openerBrowser: null,
 
   __strBundle: null, // String bundle for L10N
   get _strBundle() {
     if (!this.__strBundle) {
       this.__strBundle = Services.strings.createBundle(
         "chrome://passwordmgr/locale/passwordmgr.properties");
-      if (!this.__strBundle)
+      if (!this.__strBundle) {
         throw new Error("String bundle for Login Manager not present!");
+      }
     }
 
     return this.__strBundle;
   },
 
 
   __ellipsis: null,
   get _ellipsis() {
@@ -296,19 +300,20 @@ LoginManagerPrompter.prototype = {
 
 
   /**
    * Wrapper around the prompt service prompt. Saving random fields here
    * doesn't really make sense and therefore isn't implemented.
    */
   prompt(aDialogTitle, aText, aPasswordRealm,
          aSavePassword, aDefaultText, aResult) {
-    if (aSavePassword != Ci.nsIAuthPrompt.SAVE_PASSWORD_NEVER)
+    if (aSavePassword != Ci.nsIAuthPrompt.SAVE_PASSWORD_NEVER) {
       throw new Components.Exception("prompt only supports SAVE_PASSWORD_NEVER",
                                      Cr.NS_ERROR_NOT_IMPLEMENTED);
+    }
 
     this.log("===== prompt() called =====");
 
     if (aDefaultText) {
       aResult.value = aDefaultText;
     }
 
     return Services.prompt.prompt(this._chromeWindow,
@@ -319,71 +324,77 @@ LoginManagerPrompter.prototype = {
   /**
    * Looks up a username and password in the database. Will prompt the user
    * with a dialog, even if a username and password are found.
    */
   promptUsernameAndPassword(aDialogTitle, aText, aPasswordRealm,
                             aSavePassword, aUsername, aPassword) {
     this.log("===== promptUsernameAndPassword() called =====");
 
-    if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION)
+    if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION) {
       throw new Components.Exception("promptUsernameAndPassword doesn't support SAVE_PASSWORD_FOR_SESSION",
                                      Cr.NS_ERROR_NOT_IMPLEMENTED);
+    }
 
     var selectedLogin = null;
     var checkBox = { value: false };
     var checkBoxLabel = null;
     var [hostname, realm, unused] = this._getRealmInfo(aPasswordRealm);
 
     // If hostname is null, we can't save this login.
     if (hostname) {
       var canRememberLogin;
-      if (this._inPrivateBrowsing)
+      if (this._inPrivateBrowsing) {
         canRememberLogin = false;
-      else
+      } else {
         canRememberLogin = (aSavePassword ==
                             Ci.nsIAuthPrompt.SAVE_PASSWORD_PERMANENTLY) &&
                            Services.logins.getLoginSavingEnabled(hostname);
+      }
 
       // if checkBoxLabel is null, the checkbox won't be shown at all.
-      if (canRememberLogin)
+      if (canRememberLogin) {
         checkBoxLabel = this._getLocalizedString("rememberPassword");
+      }
 
       // Look for existing logins.
       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
         // login (or return null if none exists).
-        if (aUsername.value)
+        if (aUsername.value) {
           selectedLogin = this._repickSelectedLogin(foundLogins,
                                                     aUsername.value);
+        }
 
         if (selectedLogin) {
           checkBox.value = true;
           aUsername.value = selectedLogin.username;
           // If the caller provided a password, prefer it.
-          if (!aPassword.value)
+          if (!aPassword.value) {
             aPassword.value = selectedLogin.password;
+          }
         }
       }
     }
 
     var ok = Services.prompt.promptUsernameAndPassword(this._chromeWindow,
                                                        aDialogTitle, aText, aUsername, aPassword,
                                                        checkBoxLabel, checkBox);
 
-    if (!ok || !checkBox.value || !hostname)
+    if (!ok || !checkBox.value || !hostname) {
       return ok;
+    }
 
     if (!aPassword.value) {
       this.log("No password entered, so won't offer to save.");
       return ok;
     }
 
     // XXX We can't prompt with multiple logins yet (bug 227632), so
     // the entered login might correspond to an existing login
@@ -420,35 +431,37 @@ LoginManagerPrompter.prototype = {
    * If a password is not found in the database, the user will be prompted
    * with a dialog with a text field and ok/cancel buttons. If the user
    * allows it, then the password will be saved in the database.
    */
   promptPassword(aDialogTitle, aText, aPasswordRealm,
                  aSavePassword, aPassword) {
     this.log("===== promptPassword called() =====");
 
-    if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION)
+    if (aSavePassword == Ci.nsIAuthPrompt.SAVE_PASSWORD_FOR_SESSION) {
       throw new Components.Exception("promptPassword doesn't support SAVE_PASSWORD_FOR_SESSION",
                                      Cr.NS_ERROR_NOT_IMPLEMENTED);
+    }
 
     var checkBox = { value: false };
     var checkBoxLabel = null;
     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) &&
                              Services.logins.getLoginSavingEnabled(hostname);
 
       // if checkBoxLabel is null, the checkbox won't be shown at all.
-      if (canRememberLogin)
+      if (canRememberLogin) {
         checkBoxLabel = this._getLocalizedString("rememberPassword");
+      }
 
       if (!aPassword.value) {
         // Look for existing logins.
         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
@@ -494,24 +507,26 @@ LoginManagerPrompter.prototype = {
    *
    * If aRealmString is in the format produced by NS_GetAuthKey for HTTP[S]
    * channels, e.g. "example.com:80 (httprealm)", null is returned for all
    * arguments to let callers know the login can't be saved because we don't
    * know whether it's http or https.
    */
   _getRealmInfo(aRealmString) {
     var httpRealm = /^.+ \(.+\)$/;
-    if (httpRealm.test(aRealmString))
+    if (httpRealm.test(aRealmString)) {
       return [null, null, null];
+    }
 
     var uri = Services.io.newURI(aRealmString);
     var pathname = "";
 
-    if (uri.pathQueryRef != "/")
+    if (uri.pathQueryRef != "/") {
       pathname = uri.pathQueryRef;
+    }
 
     var formattedHostname = this._getFormattedHostname(uri);
 
     return [formattedHostname, formattedHostname + pathname, uri.username];
   },
 
   /* ---------- nsIAuthPrompt2 prompts ---------- */
 
@@ -573,46 +588,50 @@ LoginManagerPrompter.prototype = {
           this.log("Autologin enabled, skipping auth prompt.");
           canAutologin = true;
         }
 
         checkbox.value = true;
       }
 
       var canRememberLogin = Services.logins.getLoginSavingEnabled(hostname);
-      if (this._inPrivateBrowsing)
+      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)
+      if (canRememberLogin && !notifyObj) {
         checkboxLabel = this._getLocalizedString("rememberPassword");
+      }
     } catch (e) {
       // Ignore any errors and display the prompt anyway.
       epicfail = true;
       Cu.reportError("LoginManagerPrompter: " +
           "Epic fail in promptAuth: " + e + "\n");
     }
 
     var ok = canAutologin;
     if (!ok) {
-      if (this._chromeWindow)
+      if (this._chromeWindow) {
         PromptUtils.fireDialogEvent(this._chromeWindow, "DOMWillOpenModalDialog", this._browser);
+      }
       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)
+    if (!ok || !rememberLogin || epicfail) {
       return ok;
+    }
 
     try {
       var [username, password] = this._GetAuthInfo(aAuthInfo);
 
       if (!password) {
         this.log("No password entered, so won't offer to save.");
         return ok;
       }
@@ -627,28 +646,30 @@ LoginManagerPrompter.prototype = {
       let newLogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
                      createInstance(Ci.nsILoginInfo);
       newLogin.init(hostname, null, httpRealm,
                     username, password, "", "");
       if (!selectedLogin) {
         this.log("New login seen for " + username +
                  " @ " + hostname + " (" + httpRealm + ")");
 
-        if (notifyObj)
+        if (notifyObj) {
           this._showSaveLoginNotification(notifyObj, newLogin);
-        else
+        } else {
           Services.logins.addLogin(newLogin);
+        }
       } else if (password != selectedLogin.password) {
         this.log("Updating password for " + username +
                  " @ " + hostname + " (" + httpRealm + ")");
-        if (notifyObj)
+        if (notifyObj) {
           this._showChangeLoginNotification(notifyObj,
                                             selectedLogin, newLogin);
-        else
+        } else {
           this._updateLogin(selectedLogin, newLogin);
+        }
       } else {
         this.log("Login unchanged, no further action needed.");
         this._updateLogin(selectedLogin);
       }
     } catch (e) {
       Cu.reportError("LoginManagerPrompter: " +
           "Fail2 in promptAuth: " + e + "\n");
     }
@@ -1123,20 +1144,22 @@ LoginManagerPrompter.prototype = {
                                   notificationText, buttons);
     }
 
     Services.obs.notifyObservers(aLogin, "passwordmgr-prompt-save");
   },
 
   _removeLoginNotifications() {
     var popupNote = this._getPopupNote();
-    if (popupNote)
+    if (popupNote) {
       popupNote = popupNote.getNotification("password");
-    if (popupNote)
+    }
+    if (popupNote) {
       popupNote.remove();
+    }
 
     var notifyBox = this._getNotifyBox();
     if (notifyBox) {
       var oldBar = notifyBox.getNotificationWithValue("password-save");
       if (oldBar) {
         this.log("Removing save-password notification bar.");
         notifyBox.removeNotification(oldBar);
       }
@@ -1293,21 +1316,22 @@ LoginManagerPrompter.prototype = {
 
   /**
    * Shows the Change Password dialog.
    */
   _showChangeLoginDialog(aOldLogin, aNewLogin) {
     const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
 
     var dialogText;
-    if (aOldLogin.username)
+    if (aOldLogin.username) {
       dialogText  = this._getLocalizedString("updatePasswordMsg",
                                              [aOldLogin.username]);
-    else
+    } else {
       dialogText  = this._getLocalizedString("updatePasswordMsgNoUser");
+    }
 
     var dialogTitle = this._getLocalizedString("passwordChangeTitle");
 
     // returns 0 for yes, 1 for no.
     var ok = !Services.prompt.confirmEx(this._chromeWindow,
                                         dialogTitle, dialogText, buttonFlags,
                                         null, null, null,
                                         null, {});
@@ -1473,38 +1497,41 @@ LoginManagerPrompter.prototype = {
 
 
   /**
    * The user might enter a login that isn't the one we prefilled, but
    * is the same as some other existing login. So, pick a login with a
    * matching username, or return null.
    */
   _repickSelectedLogin(foundLogins, username) {
-    for (var i = 0; i < foundLogins.length; i++)
-      if (foundLogins[i].username == username)
+    for (var i = 0; i < foundLogins.length; i++) {
+      if (foundLogins[i].username == username) {
         return foundLogins[i];
+      }
+    }
     return null;
   },
 
 
   /**
    * Can be called as:
    *   _getLocalizedString("key1");
    *   _getLocalizedString("key2", ["arg1"]);
    *   _getLocalizedString("key3", ["arg1", "arg2"]);
    *   (etc)
    *
    * Returns the localized string for the specified key,
    * formatted if required.
    *
    */
   _getLocalizedString(key, formatArgs) {
-    if (formatArgs)
+    if (formatArgs) {
       return this._strBundle.formatStringFromName(
         key, formatArgs, formatArgs.length);
+    }
     return this._strBundle.GetStringFromName(key);
   },
 
 
   /**
    * Sanitizes the specified username, by stripping quotes and truncating if
    * it's too long. This helps prevent an evil site from messing with the
    * "save password?" prompt too much.
@@ -1549,83 +1576,89 @@ LoginManagerPrompter.prototype = {
     try {
       var uri = Services.io.newURI(aURIString);
       var baseDomain = Services.eTLD.getBaseDomain(uri);
       displayHost = idnService.convertToDisplayIDN(baseDomain, {});
     } catch (e) {
       this.log("_getShortDisplayHost couldn't process " + aURIString);
     }
 
-    if (!displayHost)
+    if (!displayHost) {
       displayHost = aURIString;
+    }
 
     return displayHost;
   },
 
 
   /**
    * Returns the hostname and realm for which authentication is being
    * requested, in the format expected to be used with nsILoginInfo.
    */
   _getAuthTarget(aChannel, aAuthInfo) {
     var hostname, realm;
 
     // If our proxy is demanding authentication, don't use the
     // channel's actual destination.
     if (aAuthInfo.flags & Ci.nsIAuthInformation.AUTH_PROXY) {
       this.log("getAuthTarget is for proxy auth");
-      if (!(aChannel instanceof Ci.nsIProxiedChannel))
+      if (!(aChannel instanceof Ci.nsIProxiedChannel)) {
         throw new Error("proxy auth needs nsIProxiedChannel");
+      }
 
       var info = aChannel.proxyInfo;
-      if (!info)
+      if (!info) {
         throw new Error("proxy auth needs nsIProxyInfo");
+      }
 
       // Proxies don't have a scheme, but we'll use "moz-proxy://"
       // so that it's more obvious what the login is for.
       var idnService = Cc["@mozilla.org/network/idn-service;1"].
                        getService(Ci.nsIIDNService);
       hostname = "moz-proxy://" +
                   idnService.convertUTF8toACE(info.host) +
                   ":" + info.port;
       realm = aAuthInfo.realm;
-      if (!realm)
+      if (!realm) {
         realm = hostname;
+      }
 
       return [hostname, realm];
     }
 
     hostname = this._getFormattedHostname(aChannel.URI);
 
     // If a HTTP WWW-Authenticate header specified a realm, that value
     // will be available here. If it wasn't set or wasn't HTTP, we'll use
     // the formatted hostname instead.
     realm = aAuthInfo.realm;
-    if (!realm)
+    if (!realm) {
       realm = hostname;
+    }
 
     return [hostname, realm];
   },
 
 
   /**
    * Returns [username, password] as extracted from aAuthInfo (which
    * holds this info after having prompted the user).
    *
    * If the authentication was for a Windows domain, we'll prepend the
    * return username with the domain. (eg, "domain\user")
    */
   _GetAuthInfo(aAuthInfo) {
     var username, password;
 
     var flags = aAuthInfo.flags;
-    if (flags & Ci.nsIAuthInformation.NEED_DOMAIN && aAuthInfo.domain)
+    if (flags & Ci.nsIAuthInformation.NEED_DOMAIN && aAuthInfo.domain) {
       username = aAuthInfo.domain + "\\" + aAuthInfo.username;
-    else
+    } else {
       username = aAuthInfo.username;
+    }
 
     password = aAuthInfo.password;
 
     return [username, password];
   },
 
 
   /**
--- a/toolkit/components/passwordmgr/storage-json.js
+++ b/toolkit/components/passwordmgr/storage-json.js
@@ -29,19 +29,20 @@ this.LoginManagerStorage_json = function
 this.LoginManagerStorage_json.prototype = {
   classID: Components.ID("{c00c432d-a0c9-46d7-bef6-9c45b4d07341}"),
   QueryInterface: ChromeUtils.generateQI([Ci.nsILoginManagerStorage]),
 
   _xpcom_factory: XPCOMUtils.generateSingletonFactory(this.LoginManagerStorage_json),
 
   __crypto: null,  // nsILoginManagerCrypto service
   get _crypto() {
-    if (!this.__crypto)
+    if (!this.__crypto) {
       this.__crypto = Cc["@mozilla.org/login-manager/crypto/SDR;1"].
                       getService(Ci.nsILoginManagerCrypto);
+    }
     return this.__crypto;
   },
 
   initialize() {
     try {
       // Force initialization of the crypto module.
       // See bug 717490 comment 17.
       this._crypto;
@@ -133,24 +134,28 @@ this.LoginManagerStorage_json.prototype 
         this._store.data.logins.splice(foundIndex, 1);
       }
     } else {
       loginClone.guid = gUUIDGenerator.generateUUID().toString();
     }
 
     // Set timestamps
     let currentTime = Date.now();
-    if (!loginClone.timeCreated)
+    if (!loginClone.timeCreated) {
       loginClone.timeCreated = currentTime;
-    if (!loginClone.timeLastUsed)
+    }
+    if (!loginClone.timeLastUsed) {
       loginClone.timeLastUsed = currentTime;
-    if (!loginClone.timePasswordChanged)
+    }
+    if (!loginClone.timePasswordChanged) {
       loginClone.timePasswordChanged = currentTime;
-    if (!loginClone.timesUsed)
+    }
+    if (!loginClone.timesUsed) {
       loginClone.timesUsed = 1;
+    }
 
     this._store.data.logins.push({
       id:                  this._store.data.nextId++,
       hostname:            loginClone.hostname,
       httpRealm:           loginClone.httpRealm,
       formSubmitURL:       loginClone.formSubmitURL,
       usernameField:       loginClone.usernameField,
       passwordField:       loginClone.passwordField,
@@ -169,51 +174,54 @@ this.LoginManagerStorage_json.prototype 
     LoginHelper.notifyStorageChanged("addLogin", loginClone);
     return loginClone;
   },
 
   removeLogin(login) {
     this._store.ensureDataReady();
 
     let [idToDelete, storedLogin] = this._getIdForLogin(login);
-    if (!idToDelete)
+    if (!idToDelete) {
       throw new Error("No matching logins");
+    }
 
     let foundIndex = this._store.data.logins.findIndex(l => l.id == idToDelete);
     if (foundIndex != -1) {
       this._store.data.logins.splice(foundIndex, 1);
       this._store.saveSoon();
     }
 
     LoginHelper.notifyStorageChanged("removeLogin", storedLogin);
   },
 
   modifyLogin(oldLogin, newLoginData) {
     this._store.ensureDataReady();
 
     let [idToModify, oldStoredLogin] = this._getIdForLogin(oldLogin);
-    if (!idToModify)
+    if (!idToModify) {
       throw new Error("No matching logins");
+    }
 
     let newLogin = LoginHelper.buildModifiedLogin(oldStoredLogin, newLoginData);
 
     // Check if the new GUID is duplicate.
     if (newLogin.guid != oldStoredLogin.guid &&
         !this._isGuidUnique(newLogin.guid)) {
       throw new Error("specified GUID already exists");
     }
 
     // Look for an existing entry in case key properties changed.
     if (!newLogin.matches(oldLogin, true)) {
       let logins = this.findLogins({}, newLogin.hostname,
                                    newLogin.formSubmitURL,
                                    newLogin.httpRealm);
 
-      if (logins.some(login => newLogin.matches(login, true)))
+      if (logins.some(login => newLogin.matches(login, true))) {
         throw new Error("This login already exists.");
+      }
     }
 
     // Get the encrypted value of the username and password.
     let [encUsername, encPassword, encType] = this._encryptLogin(newLogin);
 
     for (let loginItem of this._store.data.logins) {
       if (loginItem.id == idToModify) {
         loginItem.hostname = newLogin.hostname;
@@ -242,18 +250,19 @@ this.LoginManagerStorage_json.prototype 
    */
   getAllLogins(count) {
     let [logins, ids] = this._searchLogins({});
 
     // decrypt entries for caller.
     logins = this._decryptLogins(logins);
 
     this.log("_getAllLogins: returning", logins.length, "logins.");
-    if (count)
-      count.value = logins.length; // needed for XPCOM
+    if (count) {
+      count.value = logins.length;
+    } // needed for XPCOM
     return logins;
   },
 
   /**
    * Public wrapper around _searchLogins to convert the nsIPropertyBag to a
    * JavaScript object and decrypt the results.
    *
    * @return {nsILoginInfo[]} which are decrypted.
@@ -391,19 +400,21 @@ this.LoginManagerStorage_json.prototype 
 
   findLogins(count, hostname, formSubmitURL, httpRealm) {
     let loginData = {
       hostname,
       formSubmitURL,
       httpRealm,
     };
     let matchData = { };
-    for (let field of ["hostname", "formSubmitURL", "httpRealm"])
-      if (loginData[field] != "")
+    for (let field of ["hostname", "formSubmitURL", "httpRealm"]) {
+      if (loginData[field] != "") {
         matchData[field] = loginData[field];
+      }
+    }
     let [logins, ids] = this._searchLogins(matchData);
 
     // Decrypt entries found for the caller.
     logins = this._decryptLogins(logins);
 
     this.log("_findLogins: returning", logins.length, "logins");
     count.value = logins.length; // needed for XPCOM
     return logins;
@@ -411,19 +422,21 @@ this.LoginManagerStorage_json.prototype 
 
   countLogins(hostname, formSubmitURL, httpRealm) {
     let loginData = {
       hostname,
       formSubmitURL,
       httpRealm,
     };
     let matchData = { };
-    for (let field of ["hostname", "formSubmitURL", "httpRealm"])
-      if (loginData[field] != "")
+    for (let field of ["hostname", "formSubmitURL", "httpRealm"]) {
+      if (loginData[field] != "") {
         matchData[field] = loginData[field];
+      }
+    }
     let [logins, ids] = this._searchLogins(matchData);
 
     this.log("_countLogins: counted logins:", logins.length);
     return logins.length;
   },
 
   get uiBusy() {
     return this._crypto.uiBusy;
@@ -435,33 +448,36 @@ this.LoginManagerStorage_json.prototype 
 
   /**
    * Returns an array with two items: [id, login]. If the login was not
    * found, both items will be null. The returned login contains the actual
    * stored login (useful for looking at the actual nsILoginMetaInfo values).
    */
   _getIdForLogin(login) {
     let matchData = { };
-    for (let field of ["hostname", "formSubmitURL", "httpRealm"])
-      if (login[field] != "")
+    for (let field of ["hostname", "formSubmitURL", "httpRealm"]) {
+      if (login[field] != "") {
         matchData[field] = login[field];
+      }
+    }
     let [logins, ids] = this._searchLogins(matchData);
 
     let id = null;
     let foundLogin = null;
 
     // The specified login isn't encrypted, so we need to ensure
     // the logins we're comparing with are decrypted. We decrypt one entry
     // at a time, lest _decryptLogins return fewer entries and screw up
     // indices between the two.
     for (let i = 0; i < logins.length; i++) {
       let [decryptedLogin] = this._decryptLogins([logins[i]]);
 
-      if (!decryptedLogin || !decryptedLogin.equals(login))
+      if (!decryptedLogin || !decryptedLogin.equals(login)) {
         continue;
+      }
 
       // We've found a match, set id and break
       foundLogin = decryptedLogin;
       id = ids[i];
       break;
     }
 
     return [id, foundLogin];
@@ -504,18 +520,19 @@ this.LoginManagerStorage_json.prototype 
 
     for (let login of logins) {
       try {
         login.username = this._crypto.decrypt(login.username);
         login.password = this._crypto.decrypt(login.password);
       } catch (e) {
         // If decryption failed (corrupt entry?), just skip it.
         // Rethrow other errors (like canceling entry of a master pw)
-        if (e.result == Cr.NS_ERROR_FAILURE)
+        if (e.result == Cr.NS_ERROR_FAILURE) {
           continue;
+        }
         throw e;
       }
       result.push(login);
     }
 
     return result;
   },
 };
--- a/toolkit/components/passwordmgr/storage-mozStorage.js
+++ b/toolkit/components/passwordmgr/storage-mozStorage.js
@@ -25,23 +25,25 @@ function Transaction(aDatabase) {
   try {
     this._db.beginTransaction();
     this._hasTransaction = true;
   } catch (e) { /* om nom nom exceptions */ }
 }
 
 Transaction.prototype = {
   commit() {
-    if (this._hasTransaction)
+    if (this._hasTransaction) {
       this._db.commitTransaction();
+    }
   },
 
   rollback() {
-    if (this._hasTransaction)
+    if (this._hasTransaction) {
       this._db.rollbackTransaction();
+    }
   },
 };
 
 
 function LoginManagerStorage_mozStorage() { }
 
 LoginManagerStorage_mozStorage.prototype = {
   classID: Components.ID("{8c2023b9-175c-477e-9761-44ae7b549756}"),
@@ -60,34 +62,37 @@ LoginManagerStorage_mozStorage.prototype
       return this._dbConnection;
     }
 
     throw new Components.Exception("Interface not available", Cr.NS_ERROR_NO_INTERFACE);
   },
 
   __crypto: null,  // nsILoginManagerCrypto service
   get _crypto() {
-    if (!this.__crypto)
+    if (!this.__crypto) {
       this.__crypto = Cc["@mozilla.org/login-manager/crypto/SDR;1"].
                       getService(Ci.nsILoginManagerCrypto);
+    }
     return this.__crypto;
   },
 
   __profileDir: null,  // nsIFile for the user's profile dir
   get _profileDir() {
-    if (!this.__profileDir)
+    if (!this.__profileDir) {
       this.__profileDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
+    }
     return this.__profileDir;
   },
 
   __uuidService: null,
   get _uuidService() {
-    if (!this.__uuidService)
+    if (!this.__uuidService) {
       this.__uuidService = Cc["@mozilla.org/uuid-generator;1"].
                            getService(Ci.nsIUUIDGenerator);
+    }
     return this.__uuidService;
   },
 
 
   // The current database schema.
   _dbSchema: {
     tables: {
       moz_logins:         "id                  INTEGER PRIMARY KEY," +
@@ -143,18 +148,19 @@ LoginManagerStorage_mozStorage.prototype
   _signonsFile: null,  // nsIFile for "signons.sqlite"
 
 
   /*
    * Internal method used by regression tests only.  It overrides the default
    * database location.
    */
   initWithFile(aDBFile) {
-    if (aDBFile)
+    if (aDBFile) {
       this._signonsFile = aDBFile;
+    }
 
     this.initialize();
   },
 
 
   initialize() {
     this._dbStmts = {};
 
@@ -176,18 +182,19 @@ LoginManagerStorage_mozStorage.prototype
       isFirstRun = this._dbInit();
 
       this._initialized = true;
 
       return Promise.resolve();
     } catch (e) {
       this.log("Initialization failed: " + e);
       // If the import fails on first run, we want to delete the db
-      if (isFirstRun && e == "Import failed")
+      if (isFirstRun && e == "Import failed") {
         this._dbCleanup(false);
+      }
       throw new Error("Initialization failed");
     }
   },
 
 
   /**
    * Internal method used by regression tests only.  It is called before
    * replacing this storage module with a new instance.
@@ -206,32 +213,37 @@ LoginManagerStorage_mozStorage.prototype
       this._encryptLogin(login);
 
     // Clone the login, so we don't modify the caller's object.
     let loginClone = login.clone();
 
     // Initialize the nsILoginMetaInfo fields, unless the caller gave us values
     loginClone.QueryInterface(Ci.nsILoginMetaInfo);
     if (loginClone.guid) {
-      if (!this._isGuidUnique(loginClone.guid))
+      if (!this._isGuidUnique(loginClone.guid)) {
         throw new Error("specified GUID already exists");
+      }
     } else {
       loginClone.guid = this._uuidService.generateUUID().toString();
     }
 
     // Set timestamps
     let currentTime = Date.now();
-    if (!loginClone.timeCreated)
+    if (!loginClone.timeCreated) {
       loginClone.timeCreated = currentTime;
-    if (!loginClone.timeLastUsed)
+    }
+    if (!loginClone.timeLastUsed) {
       loginClone.timeLastUsed = currentTime;
-    if (!loginClone.timePasswordChanged)
+    }
+    if (!loginClone.timePasswordChanged) {
       loginClone.timePasswordChanged = currentTime;
-    if (!loginClone.timesUsed)
+    }
+    if (!loginClone.timesUsed) {
       loginClone.timesUsed = 1;
+    }
 
     let query =
         "INSERT INTO moz_logins " +
         "(hostname, httpRealm, formSubmitURL, usernameField, " +
          "passwordField, encryptedUsername, encryptedPassword, " +
          "guid, encType, timeCreated, timeLastUsed, timePasswordChanged, " +
          "timesUsed) " +
         "VALUES (:hostname, :httpRealm, :formSubmitURL, :usernameField, " +
@@ -271,18 +283,19 @@ LoginManagerStorage_mozStorage.prototype
     // Send a notification that a login was added.
     LoginHelper.notifyStorageChanged("addLogin", loginClone);
     return loginClone;
   },
 
 
   removeLogin(login) {
     let [idToDelete, storedLogin] = this._getIdForLogin(login);
-    if (!idToDelete)
+    if (!idToDelete) {
       throw new Error("No matching logins");
+    }
 
     // Execute the statement & remove from DB
     let query  = "DELETE FROM moz_logins WHERE id = :id";
     let params = { id: idToDelete };
     let stmt;
     let transaction = new Transaction(this._dbConnection);
     try {
       stmt = this._dbCreateStatement(query, params);
@@ -298,35 +311,37 @@ LoginManagerStorage_mozStorage.prototype
         stmt.reset();
       }
     }
     LoginHelper.notifyStorageChanged("removeLogin", storedLogin);
   },
 
   modifyLogin(oldLogin, newLoginData) {
     let [idToModify, oldStoredLogin] = this._getIdForLogin(oldLogin);
-    if (!idToModify)
+    if (!idToModify) {
       throw new Error("No matching logins");
+    }
 
     let newLogin = LoginHelper.buildModifiedLogin(oldStoredLogin, newLoginData);
 
     // Check if the new GUID is duplicate.
     if (newLogin.guid != oldStoredLogin.guid &&
         !this._isGuidUnique(newLogin.guid)) {
       throw new Error("specified GUID already exists");
     }
 
     // Look for an existing entry in case key properties changed.
     if (!newLogin.matches(oldLogin, true)) {
       let logins = this.findLogins({}, newLogin.hostname,
                                    newLogin.formSubmitURL,
                                    newLogin.httpRealm);
 
-      if (logins.some(login => newLogin.matches(login, true)))
+      if (logins.some(login => newLogin.matches(login, true))) {
         throw new Error("This login already exists.");
+      }
     }
 
     // Get the encrypted value of the username and password.
     let [encUsername, encPassword, encType] = this._encryptLogin(newLogin);
 
     let query =
         "UPDATE moz_logins " +
         "SET hostname = :hostname, " +
@@ -383,18 +398,19 @@ LoginManagerStorage_mozStorage.prototype
    */
   getAllLogins(count) {
     let [logins, ids] = this._searchLogins({});
 
     // decrypt entries for caller.
     logins = this._decryptLogins(logins);
 
     this.log("_getAllLogins: returning " + logins.length + " logins.");
-    if (count)
-      count.value = logins.length; // needed for XPCOM
+    if (count) {
+      count.value = logins.length;
+    } // needed for XPCOM
     return logins;
   },
 
 
   /**
    * Public wrapper around _searchLogins to convert the nsIPropertyBag to a
    * JavaScript object and decrypt the results.
    *
@@ -550,18 +566,19 @@ LoginManagerStorage_mozStorage.prototype
       let query = "INSERT INTO moz_deleted_logins (guid, timeDeleted) VALUES (:guid, :timeDeleted)";
       let params = { guid: aLogin.guid,
                      timeDeleted: Date.now() };
       let stmt = this._dbCreateStatement(query, params);
       stmt.execute();
     } catch (ex) {
       throw ex;
     } finally {
-      if (stmt)
+      if (stmt) {
         stmt.reset();
+      }
     }
   },
 
 
   /**
    * Removes all logins from storage.
    */
   removeAllLogins() {
@@ -594,19 +611,21 @@ LoginManagerStorage_mozStorage.prototype
 
   findLogins(count, hostname, formSubmitURL, httpRealm) {
     let loginData = {
       hostname,
       formSubmitURL,
       httpRealm,
     };
     let matchData = { };
-    for (let field of ["hostname", "formSubmitURL", "httpRealm"])
-      if (loginData[field] != "")
+    for (let field of ["hostname", "formSubmitURL", "httpRealm"]) {
+      if (loginData[field] != "") {
         matchData[field] = loginData[field];
+      }
+    }
     let [logins, ids] = this._searchLogins(matchData);
 
     // Decrypt entries found for the caller.
     logins = this._decryptLogins(logins);
 
     this.log("_findLogins: returning " + logins.length + " logins");
     count.value = logins.length; // needed for XPCOM
     return logins;
@@ -659,33 +678,36 @@ LoginManagerStorage_mozStorage.prototype
 
   /**
    * Returns an array with two items: [id, login]. If the login was not
    * found, both items will be null. The returned login contains the actual
    * stored login (useful for looking at the actual nsILoginMetaInfo values).
    */
   _getIdForLogin(login) {
     let matchData = { };
-    for (let field of ["hostname", "formSubmitURL", "httpRealm"])
-      if (login[field] != "")
+    for (let field of ["hostname", "formSubmitURL", "httpRealm"]) {
+      if (login[field] != "") {
         matchData[field] = login[field];
+      }
+    }
     let [logins, ids] = this._searchLogins(matchData);
 
     let id = null;
     let foundLogin = null;
 
     // The specified login isn't encrypted, so we need to ensure
     // the logins we're comparing with are decrypted. We decrypt one entry
     // at a time, lest _decryptLogins return fewer entries and screw up
     // indices between the two.
     for (let i = 0; i < logins.length; i++) {
       let [decryptedLogin] = this._decryptLogins([logins[i]]);
 
-      if (!decryptedLogin || !decryptedLogin.equals(login))
+      if (!decryptedLogin || !decryptedLogin.equals(login)) {
         continue;
+      }
 
       // We've found a match, set id and break
       foundLogin = decryptedLogin;
       id = ids[i];
       break;
     }
 
     return [id, foundLogin];
@@ -778,18 +800,19 @@ LoginManagerStorage_mozStorage.prototype
 
     for (let login of logins) {
       try {
         login.username = this._crypto.decrypt(login.username);
         login.password = this._crypto.decrypt(login.password);
       } catch (e) {
         // If decryption failed (corrupt entry?), just skip it.
         // Rethrow other errors (like canceling entry of a master pw)
-        if (e.result == Cr.NS_ERROR_FAILURE)
+        if (e.result == Cr.NS_ERROR_FAILURE) {
           continue;
+        }
         throw e;
       }
       result.push(login);
     }
 
     return result;
   },
 
@@ -805,19 +828,21 @@ LoginManagerStorage_mozStorage.prototype
     let wrappedStmt = this._dbStmts[query];
     // Memoize the statements
     if (!wrappedStmt) {
       this.log("Creating new statement for query: " + query);
       wrappedStmt = this._dbConnection.createStatement(query);
       this._dbStmts[query] = wrappedStmt;
     }
     // Replace parameters, must be done 1 at a time
-    if (params)
-      for (let i in params)
+    if (params) {
+      for (let i in params) {
         wrappedStmt.params[i] = params[i];
+      }
+    }
     return wrappedStmt;
   },
 
 
   /**
    * 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.
    */
@@ -867,18 +892,19 @@ LoginManagerStorage_mozStorage.prototype
   _dbCreateSchema() {
     this._dbCreateTables();
     this._dbCreateIndices();
   },
 
 
   _dbCreateTables() {
     this.log("Creating Tables");
-    for (let name in this._dbSchema.tables)
+    for (let name in this._dbSchema.tables) {
       this._dbConnection.createTable(name, this._dbSchema.tables[name]);
+    }
   },
 
 
   _dbCreateIndices() {
     this.log("Creating Indices");
     for (let name in this._dbSchema.indices) {
       let index = this._dbSchema.indices[name];
       let statement = "CREATE INDEX IF NOT EXISTS " + name + " ON " + index.table +
@@ -894,19 +920,20 @@ LoginManagerStorage_mozStorage.prototype
     if (oldVersion > DB_VERSION) {
       this.log("Downgrading to version " + DB_VERSION);
       // User's DB is newer. Sanity check that our expected columns are
       // present, and if so mark the lower version and merrily continue
       // on. If the columns are borked, something is wrong so blow away
       // the DB and start from scratch. [Future incompatible upgrades
       // should swtich to a different table or file.]
 
-      if (!this._dbAreExpectedColumnsPresent())
+      if (!this._dbAreExpectedColumnsPresent()) {
         throw Components.Exception("DB is missing expected columns",
                                    Cr.NS_ERROR_FILE_CORRUPTED);
+      }
 
       // Change the stored version to the current version. If the user
       // runs the newer code again, it will see the lower version number
       // and re-upgrade (to fixup any entries the old code added).
       this._dbConnection.schemaVersion = DB_VERSION;
       return;
     }
 
@@ -947,18 +974,19 @@ LoginManagerStorage_mozStorage.prototype
     }
 
     // Get a list of IDs for existing logins
     let ids = [];
     query = "SELECT id FROM moz_logins WHERE guid isnull";
     let stmt;
     try {
       stmt = this._dbCreateStatement(query);
-      while (stmt.executeStep())
+      while (stmt.executeStep()) {
         ids.push(stmt.row.id);
+      }
     } catch (e) {
       this.log("Failed getting IDs: " + e);
       throw e;
     } finally {
       if (stmt) {
         stmt.reset();
       }
     }
@@ -1007,20 +1035,21 @@ LoginManagerStorage_mozStorage.prototype
     query = "SELECT id, encryptedUsername, encryptedPassword " +
                 "FROM moz_logins WHERE encType isnull";
     try {
       stmt = this._dbCreateStatement(query);
       while (stmt.executeStep()) {
         let params = { id: stmt.row.id };
         // We will tag base64 logins correctly, but no longer support their use.
         if (stmt.row.encryptedUsername.charAt(0) == "~" ||
-            stmt.row.encryptedPassword.charAt(0) == "~")
+            stmt.row.encryptedPassword.charAt(0) == "~") {
           params.encType = Ci.nsILoginManagerCrypto.ENCTYPE_BASE64;
-        else
+        } else {
           params.encType = Ci.nsILoginManagerCrypto.ENCTYPE_SDR;
+        }
         logins.push(params);
       }
     } catch (e) {
       this.log("Failed getting logins: " + e);
       throw e;
     } finally {
       if (stmt) {
         stmt.reset();
@@ -1061,18 +1090,19 @@ LoginManagerStorage_mozStorage.prototype
 
     // Get a list of IDs for existing logins.
     let ids = [];
     let stmt;
     query = "SELECT id FROM moz_logins WHERE timeCreated isnull OR " +
             "timeLastUsed isnull OR timePasswordChanged isnull OR timesUsed isnull";
     try {
       stmt = this._dbCreateStatement(query);
-      while (stmt.executeStep())
+      while (stmt.executeStep()) {
         ids.push(stmt.row.id);
+      }
     } catch (e) {
       this.log("Failed getting IDs: " + e);
       throw e;
     } finally {
       if (stmt) {
         stmt.reset();
       }
     }
--- a/toolkit/components/passwordmgr/test/.eslintrc.js
+++ b/toolkit/components/passwordmgr/test/.eslintrc.js
@@ -1,13 +1,13 @@
 "use strict";
 
 module.exports = {
   "extends": [
     "plugin:mozilla/mochitest-test",
     "plugin:mozilla/chrome-test"
   ],
   "rules": {
-    "brace-style": "off",
+    "brace-style": ["error", "1tbs", {"allowSingleLine": false}],
     "no-undef": "off",
     "no-unused-vars": "off",
   },
 };
--- a/toolkit/components/passwordmgr/test/browser/.eslintrc.js
+++ b/toolkit/components/passwordmgr/test/browser/.eslintrc.js
@@ -1,7 +1,11 @@
 "use strict";
 
 module.exports = {
   "extends": [
     "plugin:mozilla/browser-test"
-  ]
+  ],
+
+  rules:  {
+    "brace-style": ["error", "1tbs", {"allowSingleLine": false}],
+  },
 };
--- a/toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_DOMFormHasPassword.js
@@ -2,29 +2,32 @@ const ids = {
   INPUT_ID: "input1",
   FORM1_ID: "form1",
   FORM2_ID: "form2",
   CHANGE_INPUT_ID: "input2",
 };
 
 function task(contentIds) {
   let resolve;
-  let promise = new Promise(r => { resolve = r; });
+  let promise = new Promise(r => {
+    resolve = r;
+  });
 
   function unexpectedContentEvent(evt) {
     ok(false, "Received a " + evt.type + " event on content");
   }
 
   var gDoc = null;
 
   addEventListener("load", tabLoad, true);
 
   function tabLoad() {
-    if (content.location.href == "about:blank")
+    if (content.location.href == "about:blank") {
       return;
+    }
     removeEventListener("load", tabLoad, true);
 
     gDoc = content.document;
     gDoc.addEventListener("DOMFormHasPassword", unexpectedContentEvent);
     gDoc.defaultView.setTimeout(test_inputAdd, 0);
   }
 
   function test_inputAdd() {
--- a/toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_DOMInputPasswordAdded.js
@@ -5,17 +5,19 @@ const consts = {
   FORM1_ID: "form1",
   FORM2_ID: "form2",
   CHANGE_INPUT_ID: "input2",
   BODY_INPUT_ID: "input3",
 };
 
 function task(contentConsts) {
   let resolve;
-  let promise = new Promise(r => { resolve = r; });
+  let promise = new Promise(r => {
+    resolve = r;
+  });
 
   function unexpectedContentEvent(evt) {
     Assert.ok(false, "Received a " + evt.type + " event on content");
   }
 
   var gDoc = null;
 
   addEventListener("load", tabLoad, true);
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
@@ -40,19 +40,20 @@ add_task(async function test() {
       "very secret",
       "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++)
+    for (let i = 0; i < 10; i++) {
       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() {
@@ -67,19 +68,19 @@ add_task(async function test() {
       let toggleCalls = 0;
       function toggleShowPasswords(func) {
         let toggleButton = doc.getElementById("togglePasswords");
         let showMode = (toggleCalls++ % 2) == 0;
 
         // only watch for a confirmation dialog every other time being called
         if (showMode) {
           Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
-            if (aTopic == "domwindowclosed")
+            if (aTopic == "domwindowclosed") {
               Services.ww.unregisterNotification(notification);
-            else if (aTopic == "domwindowopened") {
+            } else if (aTopic == "domwindowopened") {
               let targetWin = aSubject;
               SimpleTest.waitForFocus(function() {
                 EventUtils.sendKey("RETURN", targetWin);
               }, targetWin);
             }
           });
         }
 
@@ -106,44 +107,47 @@ add_task(async function test() {
 
       function checkSortMarkers(activeCol) {
         let isOk = true;
         let col = null;
         let hasAttr = false;
         let treecols = activeCol.parentNode;
         for (let i = 0; i < treecols.childNodes.length; i++) {
           col = treecols.childNodes[i];
-          if (col.nodeName != "treecol")
+          if (col.nodeName != "treecol") {
             continue;
+          }
           hasAttr = col.hasAttribute("sortDirection");
           isOk &= col == activeCol ? hasAttr : !hasAttr;
         }
         ok(isOk, "Only " + activeCol.id + " has a sort marker");
       }
 
       function checkSortDirection(col, ascending) {
         checkSortMarkers(col);
         let direction = ascending ? "ascending" : "descending";
         is(col.getAttribute("sortDirection"), direction,
            col.id + ": sort direction is " + direction);
       }
 
       function checkColumnEntries(aCol, expectedValues) {
         let actualValues = getColumnEntries(aCol);
         is(actualValues.length, expectedValues.length, "Checking length of expected column");
-        for (let i = 0; i < expectedValues.length; i++)
+        for (let i = 0; i < expectedValues.length; i++) {
           is(actualValues[i], expectedValues[i], "Checking column entry #" + i);
+        }
       }
 
       function getColumnEntries(aCol) {
         let entries = [];
         let column = sTree.columns[aCol];
         let numRows = sTree.view.rowCount;
-        for (let i = 0; i < numRows; i++)
+        for (let i = 0; i < numRows; i++) {
           entries.push(sTree.view.getCellText(i, column));
+        }
         return entries;
       }
 
       let testCounter = 0;
       let expectedValues;
       function runNextTest() {
         switch (testCounter++) {
           case 0:
--- a/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
@@ -78,19 +78,19 @@ add_task(async function test() {
       let toggleCalls = 0;
       function toggleShowPasswords(func) {
         let toggleButton = doc.getElementById("togglePasswords");
         let showMode = (toggleCalls++ % 2) == 0;
 
         // only watch for a confirmation dialog every other time being called
         if (showMode) {
           Services.ww.registerNotification(function notification(aSubject, aTopic, aData) {
-            if (aTopic == "domwindowclosed")
+            if (aTopic == "domwindowclosed") {
               Services.ww.unregisterNotification(notification);
-            else if (aTopic == "domwindowopened") {
+            } else if (aTopic == "domwindowopened") {
               let targetWin = aSubject;
               SimpleTest.waitForFocus(function() {
                 EventUtils.sendKey("RETURN", targetWin);
               }, targetWin);
             }
           });
         }
 
@@ -136,20 +136,21 @@ add_task(async function test() {
               return;
           }
           tester();
           proceed();
         }
 
         function proceed() {
           // run the next test if necessary or proceed with the tests
-          if (testCounter != tests.length)
+          if (testCounter != tests.length) {
             runNextTest();
-          else
+          } else {
             endFunction();
+          }
         }
 
         function runNextTest() {
           let testCase = tests[testCounter++];
           setFilter(testCase.filter);
           setTimeout(runOneTest, 0, testCase);
         }
 
--- a/toolkit/components/passwordmgr/test/browser/browser_username_select_dialog.js
+++ b/toolkit/components/passwordmgr/test/browser/browser_username_select_dialog.js
@@ -9,22 +9,24 @@ function getSelectDialogDoc() {
   // that has selectDialog.xul loaded.
   // var enumerator = Services.wm.getEnumerator("navigator:browser");
   for (let {docShell} of Services.wm.getEnumerator(null)) {
     var containedDocShells = docShell.getDocShellEnumerator(
       docShell.typeChrome,
       docShell.ENUMERATE_FORWARDS);
     for (let childDocShell of containedDocShells) {
       // We don't want it if it's not done loading.
-      if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
+      if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE) {
         continue;
+      }
       var childDoc = childDocShell.contentViewer.DOMDocument;
 
-      if (childDoc.location.href == "chrome://global/content/selectDialog.xul")
+      if (childDoc.location.href == "chrome://global/content/selectDialog.xul") {
         return childDoc;
+      }
     }
   }
 
   return null;
 }
 
 let nsLoginInfo = new Components.Constructor("@mozilla.org/login-manager/loginInfo;1",
                                              Ci.nsILoginInfo, "init");
--- a/toolkit/components/passwordmgr/test/browser/subtst_notifications_11.html
+++ b/toolkit/components/passwordmgr/test/browser/subtst_notifications_11.html
@@ -11,15 +11,16 @@
 // Ignore the '?' and split on |
 [username, password, features, autoClose] = window.location.search.substring(1).split("|");
 
 var url = "subtst_notifications_11_popup.html?" + username + "|" + password;
 var popupWin = window.open(url, "subtst_11", features);
 
 // Popup window will call this function on form submission.
 function formSubmitted() {
-  if (autoClose)
+  if (autoClose) {
     popupWin.close();
+  }
 }
 
 </script>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/chrome/notification_common.js
+++ b/toolkit/components/passwordmgr/test/chrome/notification_common.js
@@ -96,10 +96,12 @@ function dumpNotifications() {
     var chromeWin =
         SpecialPowers.wrap(window.top).docShell.chromeEventHandler.ownerGlobal;
     var nb = chromeWin.getNotificationBox(window.top);
     notes = nb.allNotifications;
     ok(true, "Found " + notes.length + " notification bars.");
     for (let i = 0; i < notes.length; i++) {
       ok(true, "#" + i + ": " + notes[i].getAttribute("value"));
     }
-  } catch (e) { todo(false, "WOAH! " + e); }
+  } catch (e) {
+    todo(false, "WOAH! " + e);
+  }
 }
--- a/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_3.html
+++ b/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_3.html
@@ -17,13 +17,15 @@
 </form>
 
 <script>
 function submitForm() {
   form.submit();
 }
 
 var form      = document.getElementById("form");
-window.addEventListener("message", () => { submitForm(); });
+window.addEventListener("message", () => {
+  submitForm();
+});
 
 </script>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
+++ b/toolkit/components/passwordmgr/test/chrome/subtst_privbrowsing_4.html
@@ -23,19 +23,23 @@ function startAutocomplete() {
   userField.focus();
   synthesizeKey("KEY_ArrowDown");
   setTimeout(submitForm, 100);
 }
 
 function submitForm() {
   synthesizeKey("KEY_ArrowDown");
   synthesizeKey("KEY_Enter");
-  setTimeout(function() { form.submit(); }, 100);
+  setTimeout(function() {
+    form.submit();
+  }, 100);
 }
 
 var form      = document.getElementById("form");
 var userField = document.getElementById("user");
 
-window.addEventListener("message", () => { startAutocomplete(); });
+window.addEventListener("message", () => {
+  startAutocomplete();
+});
 
 </script>
 </body>
 </html>
--- a/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
+++ b/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
@@ -94,17 +94,19 @@ function loadNextTest() {
       break;
 
     default:
       ok(false, "Unexpected call to loadNextTest for test #" + testNum);
   }
 
   if (testNum === 7) {
     observer = SpecialPowers.wrapCallback(function(subject, topic, data) {
-      SimpleTest.executeSoon(() => { iframe.contentWindow.postMessage("go", "*"); });
+      SimpleTest.executeSoon(() => {
+        iframe.contentWindow.postMessage("go", "*");
+      });
     });
     SpecialPowers.addObserver(observer, "passwordmgr-processed-form");
   }
 
   ok(true, "Starting test #" + testNum);
   iframe.src = prefix + subtests[testNum - 1];
 }
 
@@ -216,20 +218,24 @@ function testOnWindow(aIsPrivate, aCallb
           BrowserTestUtils.loadURI(win.gBrowser, contentPage);
           return;
         }
         win.removeEventListener("DOMContentLoaded", onInnerLoad, true);
 
         win.content.addEventListener("load", function innerLoad2() {
           win.content.removeEventListener("load", innerLoad2);
           testWindows.push(win);
-          SimpleTest.executeSoon(function() { aCallback(win); });
+          SimpleTest.executeSoon(function() {
+            aCallback(win);
+          });
         }, false, true);
       }, true);
-      SimpleTest.executeSoon(function() { BrowserTestUtils.loadURI(win.gBrowser, contentPage); });
+      SimpleTest.executeSoon(function() {
+        BrowserTestUtils.loadURI(win.gBrowser, contentPage);
+      });
     });
   }, {capture: true, once: true});
 }
 
 var ignoreLoad = false;
 function handleLoad(aEvent) {
   // ignore every other load event ... We get one for loading the subtest (which
   // we want to ignore), and another when the subtest's form submits itself
--- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_1pw_2.html
@@ -89,17 +89,19 @@ runChecksAfterCommonInit(() => startTest
 function startTest() {
   var f;
 
   // Test various combinations of disabled/readonly inputs
   checkForm(1, "testpass"); // control
   checkUnmodifiedForm(2);
   checkUnmodifiedForm(3);
   checkForm(4, "testuser", "testpass"); // control
-  for (f = 5; f <= 8; f++) { checkUnmodifiedForm(f); }
+  for (f = 5; f <= 8; f++) {
+    checkUnmodifiedForm(f);
+  }
   // Test case-insensitive comparison of username field
   checkForm(9, "testuser", "testpass");
   checkForm(10, "TESTUSER", "testpass");
   checkForm(11, "TESTUSER", "testpass");
 
   SimpleTest.finish();
 }
 </script>
--- a/toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_2.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_basic_form_2pw_2.html
@@ -74,17 +74,19 @@ function checkSubmit(formNum) {
 
 function getFormSubmitButton(formNum) {
   var form = $("form" + formNum); // by id, not name
   ok(form != null, "getting form " + formNum);
 
   // we can't just call form.submit(), because that doesn't seem to
   // invoke the form onsubmit handler.
   var button = form.firstChild;
-  while (button && button.type != "submit") { button = button.nextSibling; }
+  while (button && button.type != "submit") {
+    button = button.nextSibling;
+  }
   ok(button != null, "getting form submit button");
 
   return button;
 }
 
 runChecksAfterCommonInit(startTest);
 
 </script>
--- a/toolkit/components/passwordmgr/test/mochitest/test_bug_776171.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_bug_776171.html
@@ -24,20 +24,21 @@ https://bugzilla.mozilla.org/show_bug.cg
  *    in this case, however, we have an entry without an identity
  *    for this path (that is a parent for auth2 path in the first step)
  */
 
 SimpleTest.waitForExplicitFinish();
 
 function doxhr(URL, user, pass, next) {
   var xhr = new XMLHttpRequest();
-  if (user && pass)
+  if (user && pass) {
     xhr.open("POST", URL, true, user, pass);
-  else
+  } else {
     xhr.open("POST", URL, true);
+  }
   xhr.onload = function() {
     is(xhr.status, 200, "Got status 200");
     next();
   };
   xhr.onerror = function() {
     ok(false, "request passed");
     finishTest();
   };
--- a/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_prompt_promptAuth_proxy.html
@@ -79,18 +79,21 @@ proxyChannelListener.prototype = {
   },
   onStopRequest(request, context, status) { },
 };
 
 var resolveCallback = SpecialPowers.wrapCallbackObject({
   QueryInterface(iid) {
     const interfaces = [Ci.nsIProtocolProxyCallback, Ci.nsISupports];
 
-    if (!interfaces.some( function(v) { return iid.equals(v); } ))
+    if (!interfaces.some( function(v) {
+      return iid.equals(v);
+    } )) {
       throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
+    }
     return this;
   },
 
   onProxyAvailable(req, uri, pi, status) {
     initLogins(pi);
 
     // I'm cheating a bit here... We should probably do some magic foo to get
     // something implementing nsIProxiedProtocolHandler and then call
--- a/toolkit/components/passwordmgr/test/mochitest/test_xhr_2.html
+++ b/toolkit/components/passwordmgr/test/mochitest/test_xhr_2.html
@@ -20,20 +20,21 @@ https://bugzilla.mozilla.org/show_bug.cg
  *
  * 1. connect authenticate.sjs that excepts user1:pass1 password
  * 2. connect authenticate.sjs that this time expects differentuser2:pass2 password
  *    we must use the creds that are provided to the xhr witch are different and expected
  */
 
 function doxhr(URL, user, pass, code, next) {
   var xhr = new XMLHttpRequest();
-  if (user && pass)
+  if (user && pass) {
     xhr.open("POST", URL, true, user, pass);
-  else
+  } else {
     xhr.open("POST", URL, true);
+  }
   xhr.onload = function() {
     is(xhr.status, code, "expected response code " + code);
     next();
   };
   xhr.onerror = function() {
     ok(false, "request passed");
     finishTest();
   };
--- a/toolkit/components/passwordmgr/test/prompt_common.js
+++ b/toolkit/components/passwordmgr/test/prompt_common.js
@@ -26,44 +26,50 @@ function startCallbackTimer() {
 }
 
 
 var observer = SpecialPowers.wrapCallbackObject({
   QueryInterface(iid) {
     const interfaces = [Ci.nsIObserver,
                         Ci.nsISupports, Ci.nsISupportsWeakReference];
 
-    if (!interfaces.some( function(v) { return iid.equals(v); } ))
+    if (!interfaces.some( function(v) {
+      return iid.equals(v);
+    } )) {
       throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
+    }
     return this;
   },
 
   observe(subject, topic, data) {
     var doc = getDialogDoc();
-    if (doc)
+    if (doc) {
       handleDialog(doc, testNum);
-    else
-      startCallbackTimer(); // try again in a bit
+    } 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 enumerator = SpecialPowers.Services.wm.getEnumerator("navigator:browser");
   for (let {docShell} of SpecialPowers.Services.wm.getXULWindowEnumerator(null)) {
     var containedDocShells = docShell.getDocShellEnumerator(
       docShell.typeChrome,
       docShell.ENUMERATE_FORWARDS);
     for (let childDocShell of containedDocShells) {
       // We don't want it if it's not done loading.
-      if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE)
+      if (childDocShell.busyFlags != Ci.nsIDocShell.BUSY_FLAGS_NONE) {
         continue;
+      }
       var childDoc = childDocShell.contentViewer.DOMDocument;
 
       // ok(true, "Got window: " + childDoc.location.href);
-      if (childDoc.location.href == "chrome://global/content/commonDialog.xul")
+      if (childDoc.location.href == "chrome://global/content/commonDialog.xul") {
         return childDoc;
+      }
     }
   }
 
   return null;
 }
--- a/toolkit/components/passwordmgr/test/pwmgr_common.js
+++ b/toolkit/components/passwordmgr/test/pwmgr_common.js
@@ -38,65 +38,72 @@ function $_(formNum, name) {
  * checkForm(#, "foo");
  */
 function checkForm(formNum, val1, val2, val3) {
   var e, form = document.getElementById("form" + formNum);
   ok(form, "Locating form " + formNum);
 
   var numToCheck = arguments.length - 1;
 
-  if (!numToCheck--)
+  if (!numToCheck--) {
     return;
+  }
   e = form.elements[0];
-  if (val1 == null)
+  if (val1 == null) {
     is(e.value, e.defaultValue, "Test default value of field " + e.name +
        " in form " + formNum);
-  else
+  } else {
     is(e.value, val1, "Test value of field " + e.name +
        " in form " + formNum);
+  }
 
 
-  if (!numToCheck--)
+  if (!numToCheck--) {
     return;
+  }
   e = form.elements[1];
-  if (val2 == null)
+  if (val2 == null) {
     is(e.value, e.defaultValue, "Test default value of field " + e.name +
        " in form " + formNum);
-  else
+  } else {
     is(e.value, val2, "Test value of field " + e.name +
        " in form " + formNum);
+  }
 
 
-  if (!numToCheck--)
+  if (!numToCheck--) {
     return;
+  }
   e = form.elements[2];
-  if (val3 == null)
+  if (val3 == null) {
     is(e.value, e.defaultValue, "Test default value of field " + e.name +
        " in form " + formNum);
-  else
+  } else {
     is(e.value, val3, "Test value of field " + e.name +
        " in form " + formNum);
+  }
 }
 
 /**
  * Check a form for unmodified values from when page was loaded.
  *
  * <form id="form#">
  * checkUnmodifiedForm(#);
  */
 function checkUnmodifiedForm(formNum) {
   var form = document.getElementById("form" + formNum);
   ok(form, "Locating form " + formNum);
 
   for (var i = 0; i < form.elements.length; i++) {
     var ele = form.elements[i];
 
     // No point in checking form submit/reset buttons.
-    if (ele.type == "submit" || ele.type == "reset")
+    if (ele.type == "submit" || ele.type == "reset") {
       continue;
+    }
 
     is(ele.value, ele.defaultValue, "Test to default value of field " +
        ele.name + " in form " + formNum);
   }
 }
 
 /**
  * Init with a common login
@@ -111,35 +118,37 @@ function commonInit(selfFilling) {
   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();
   if (disabledHosts.length) {
     ok(false, "Warning: wasn't expecting disabled hosts to be present.");
-    for (var host of disabledHosts)
+    for (var host of disabledHosts) {
       pwmgr.setLoginSavingEnabled(host, true);
+    }
   }
 
   // Add a login that's used in multiple tests
   var login = SpecialPowers.Cc["@mozilla.org/login-manager/loginInfo;1"].
               createInstance(SpecialPowers.Ci.nsILoginInfo);
   login.init("http://mochi.test:8888", "http://mochi.test:8888", null,
              "testuser", "testpass", "uname", "pword");
   pwmgr.addLogin(login);
 
   // Last sanity check
   logins = pwmgr.getAllLogins();
   is(logins.length, 1, "Checking for successful init login");
   disabledHosts = pwmgr.getAllDisabledHosts();
   is(disabledHosts.length, 0, "Checking for no disabled hosts");
 
-  if (selfFilling)
+  if (selfFilling) {
     return;
+  }
 
   if (this.sendAsyncMessage) {
     sendAsyncMessage("registerRunTests");
   } else {
     registerRunTests();
   }
 }
 
@@ -157,18 +166,19 @@ function registerRunTests() {
       form.appendChild(username);
       var password = document.createElement("input");
       password.name = "testpass";
       password.type = "password";
       form.appendChild(password);
 
       var observer = SpecialPowers.wrapCallback(function(subject, topic, data) {
         var formLikeRoot = subject;
-        if (formLikeRoot.id !== "observerforcer")
+        if (formLikeRoot.id !== "observerforcer") {
           return;
+        }
         SpecialPowers.removeObserver(observer, "passwordmgr-processed-form");
         formLikeRoot.remove();
         SimpleTest.executeSoon(() => {
           var runTestEvent = new Event("runTests");
           window.dispatchEvent(runTestEvent);
           resolve();
         });
       });
@@ -212,18 +222,19 @@ function setMasterPassword(enable) {
 function logoutMasterPassword() {
   var sdr = Cc["@mozilla.org/security/sdr;1"].getService(Ci.nsISecretDecoderRing);
   sdr.logoutAndTeardown();
 }
 
 function dumpLogins(pwmgr) {
   var logins = pwmgr.getAllLogins();
   ok(true, "----- dumpLogins: have " + logins.length + " logins. -----");
-  for (var i = 0; i < logins.length; i++)
+  for (var i = 0; i < logins.length; i++) {
     dumpLogin("login #" + i + " --- ", logins[i]);
+  }
 }
 
 function dumpLogin(label, login) {
   var loginText = "";
   loginText += "host: ";
   loginText += login.hostname;
   loginText += " / formURL: ";
   loginText += login.formSubmitURL;
--- a/toolkit/components/passwordmgr/test/test_master_password.html
+++ b/toolkit/components/passwordmgr/test/test_master_password.html
@@ -109,41 +109,45 @@ function handleDialog(doc, testNumber) {
       ok(false, "Uhh, unhandled switch for testNum #" + testNumber);
       break;
   }
 
   didDialog = true;
 
   if (!doNothing) {
     SpecialPowers.addObserver(outerWindowObserver, "outer-window-destroyed");
-    if (clickOK)
+    if (clickOK) {
       dialog.acceptDialog();
-    else
+    } else {
       dialog.cancelDialog();
+    }
   }
 
   ok(true, "handleDialog done for test " + testNumber);
 
-  if (testNumber == 4)
+  if (testNumber == 4) {
     checkTest4A();
+  }
 }
 
 var outerWindowObserver = {
   observe(id) {
     SpecialPowers.removeObserver(outerWindowObserver, "outer-window-destroyed");
     var func;
-    if (testNum == 1)
+    if (testNum == 1) {
       func = startTest2;
-    else if (testNum == 2)
+    } else if (testNum == 2) {
       func = startTest3;
+    }
 
     // For tests 3 and 4C, we use the 'continuation' mechanism, described
     // above.
-    if (func)
+    if (func) {
       setTimeout(func, 300);
+    }
   },
 };
 
 
 function startTest1() {
   ok(pwcrypt.isLoggedIn, "should be initially logged in (no MP)");
   enableMasterPassword();
   ok(!pwcrypt.isLoggedIn, "should be logged out after setting MP");
@@ -163,17 +167,19 @@ function startTest1() {
 function startTest2() {
   // Try again but click cancel.
   testNum++;
   startCallbackTimer();
   var failedAsExpected = false;
   logins = null;
   try {
     logins = pwmgr.getAllLogins();
-  } catch (e) { failedAsExpected = true; }
+  } catch (e) {
+    failedAsExpected = true;
+  }
   ok(didDialog, "handleDialog was invoked");
   ok(failedAsExpected, "getAllLogins should have thrown");
   is(logins, null, "shouldn't have gotten logins");
   ok(!pwcrypt.isLoggedIn, "should still be logged out");
 }
 
 function startTest3() {
   // Load a single iframe to trigger a MP
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -34,18 +34,19 @@
          */
         dialogMonitor.prototype = SpecialPowers.wrapCallbackObject({
           windowsOpen: 0,
           windowsRegistered: 0,
 
           QueryInterface(iid) {
             const interfaces = [Ci.nsIObserver, Ci.nsISupports];
 
-            if (!interfaces.some( function(v) { return iid.equals(v); } ))
+            if (!interfaces.some((v) => iid.equals(v))) {
               throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
+            }
             return this;
           },
 
           observe(subject, topic, data) {
             if (topic === "domwindowopened") {
               this.windowsOpen++;
               this.windowsRegistered++;
             } else if (topic === "domwindowclosed") {
@@ -103,33 +104,35 @@
           addLogin("http://example.com", "mochirealm5",
                    "user5name", "user5pass");
           addLogin("http://example.com", "mochirealm6",
                    "user6name", "user6pass");
         }
 
         function finishTest() {
           ok(true, "finishTest removing testing logins...");
-          for (i in logins)
+          for (i in logins) {
             pwmgr.removeLogin(logins[i]);
+          }
 
           var authMgr = SpecialPowers.Cc["@mozilla.org/network/http-auth-manager;1"]
                                      .getService(Ci.nsIHttpAuthManager);
           authMgr.clearAll();
 
           monitor.shutdown();
           SimpleTest.finish();
         }
 
         var resolveCallback = SpecialPowers.wrapCallbackObject({
           QueryInterface(iid) {
             const interfaces = [Ci.nsIProtocolProxyCallback, Ci.nsISupports];
 
-            if (!interfaces.some( function(v) { return iid.equals(v); } ))
+            if (!interfaces.some(v => iid.equals(v))) {
               throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
+            }
             return this;
           },
 
           onProxyAvailable(req, uri, pi, status) {
             initLogins(pi);
             doTest(testNum);
           },
         });
@@ -160,46 +163,43 @@
           iframe2a.onload = onFrameLoad;
           iframe2b.onload = onFrameLoad;
 
           startup();
         };
 
         var expectedLoads;
         var expectedDialogs;
-        function onFrameLoad()
-        {
+        function onFrameLoad() {
           if (--expectedLoads == 0) {
             // All pages expected to load has loaded, continue with the next test
             ok(true, "Expected frames loaded");
 
             doCheck(testNum);
             monitor.reset();
 
             testNum++;
             doTest(testNum);
           }
         }
 
-        function doTest(testNumber)
-        {
+        function doTest(testNumber) {
           /*
              * These contentDocument variables are located here,
              * rather than in the global scope, because SpecialPowers threw
              * errors (complaining that the objects were deleted)
              * when these were in the global scope.
              */
           var iframe1Doc = SpecialPowers.wrap(iframe1).contentDocument;
           var iframe2aDoc = SpecialPowers.wrap(iframe2a).contentDocument;
           var iframe2bDoc = SpecialPowers.wrap(iframe2b).contentDocument;
           var exampleCom = "http://example.com/tests/toolkit/components/passwordmgr/test/";
           var exampleOrg = "http://example.org/tests/toolkit/components/passwordmgr/test/";
 
-          switch (testNumber)
-          {
+          switch (testNumber) {
             case 1:
               // Load through a single proxy with authentication required 3 different
               // pages, first with one login, other two with their own different login.
               // We expect to show just a single dialog for proxy authentication and
               // then two dialogs to authenticate to login 1 and then login 2.
               ok(true, "doTest testNum 1");
               expectedLoads = 3;
               expectedDialogs = 3;
@@ -341,80 +341,80 @@
             case 9:
               finishTest();
               return;
           }
 
           startCallbackTimer();
         }
 
-        function handleDialog(doc, testNumber)
-        {
+        function handleDialog(doc, testNumber) {
           var dialog        = doc.getElementById("commonDialog");
 
-          switch (testNumber)
-          {
+          switch (testNumber) {
             case 1:
             case 2:
               dialog.acceptDialog();
               break;
 
             case 3:
               dialog.cancelDialog();
               setTimeout(onFrameLoad, 10); // there are no successful frames for test 3
               break;
 
             case 4:
-              if (expectedDialogs == 2)
+              if (expectedDialogs == 2) {
                 dialog.acceptDialog();
-              else
+              } else {
                 dialog.cancelDialog();
+              }
               break;
 
             case 5:
               dialog.cancelDialog();
               setTimeout(onFrameLoad, 10); // there are no successful frames for test 5
               break;
 
             case 6:
-              if (expectedDialogs == 2)
+              if (expectedDialogs == 2) {
                 dialog.acceptDialog();
-              else
+              } else {
                 dialog.cancelDialog();
+              }
               break;
 
             case 7:
               dialog.acceptDialog();
               break;
 
             case 8:
-              if (expectedDialogs == 3 || expectedDialogs == 1)
+              if (expectedDialogs == 3 || expectedDialogs == 1) {
                 dialog.acceptDialog();
-              else
+              } else {
                 dialog.cancelDialog();
+              }
               break;
 
             default:
               ok(false, "Unhandled testNum " + testNumber + " in handleDialog");
           }
 
-          if (--expectedDialogs > 0)
+          if (--expectedDialogs > 0) {
             startCallbackTimer();
+          }
         }
 
-        function doCheck(testNumber)
-        {
+        function doCheck(testNumber) {
           var iframe1Doc = SpecialPowers.wrap(iframe1).contentDocument;
           var iframe2aDoc = SpecialPowers.wrap(iframe2a).contentDocument;
           var iframe2bDoc = SpecialPowers.wrap(iframe2b).contentDocument;
           var authok1;
           var proxyok1;
           var footnote;
-          switch (testNumber)
-          {
+          switch (testNumber) {
             case 1:
               ok(true, "doCheck testNum 1");
               is(monitor.windowsRegistered, 3, "Registered 3 open dialogs");
 
               authok1 = iframe1Doc.getElementById("ok").textContent;
               proxyok1 = iframe1Doc.getElementById("proxy").textContent;
 
               var authok2a = iframe2aDoc.getElementById("ok").textContent;
--- a/toolkit/components/passwordmgr/test/test_xhr.html
+++ b/toolkit/components/passwordmgr/test/test_xhr.html
@@ -101,20 +101,21 @@ function handleDialog(doc, testNum) {
   // Explicitly cancel the dialog and report a fail in this failure
   // case, rather than letting the dialog get stuck due to an auth
   // failure and having the test timeout.
   if (!username && !password) {
     ok(false, "No values prefilled");
     clickOK = false;
   }
 
-  if (clickOK)
+  if (clickOK) {
     dialog.acceptDialog();
-  else
+  } else {
     dialog.cancelDialog();
+  }
 
   ok(true, "handleDialog done");
   didDialog = true;
 }
 
 var newWin;
 function xhrLoad(xmlDoc) {
   ok(true, "xhrLoad running for test " + testNum);
@@ -166,18 +167,19 @@ function doTest() {
       finishTest();
   }
 }
 
 function makeRequest(uri) {
   var request = new XMLHttpRequest();
   request.open("GET", uri, true);
   request.onreadystatechange = function() {
-    if (request.readyState == 4)
+    if (request.readyState == 4) {
       xhrLoad(request.responseXML);
+    }
   };
   request.send(null);
 }
 
 
 initLogins();
 
 // clear plain HTTP auth sessions before the test, to allow
--- a/toolkit/components/passwordmgr/test/test_xml_load.html
+++ b/toolkit/components/passwordmgr/test/test_xml_load.html
@@ -92,20 +92,21 @@ function handleDialog(doc, testNum) {
   // Explicitly cancel the dialog and report a fail in this failure
   // case, rather than letting the dialog get stuck due to an auth
   // failure and having the test timeout.
   if (!username && !password) {
     ok(false, "No values prefilled");
     clickOK = false;
   }
 
-  if (clickOK)
+  if (clickOK) {
     dialog.acceptDialog();
-  else
+  } else {
     dialog.cancelDialog();
+  }
 
   ok(true, "handleDialog done");
   didDialog = true;
 }
 
 var newWin;
 function xmlLoad(responseDoc) {
   ok(true, "xmlLoad running for test " + testNum);
--- a/toolkit/components/passwordmgr/test/unit/head.js
+++ b/toolkit/components/passwordmgr/test/unit/head.js
@@ -26,18 +26,17 @@ const LoginInfo =
                              "nsILoginInfo", "init");
 
 const TestData = LoginTestUtils.testData;
 const newPropertyBag = LoginHelper.newPropertyBag;
 
 /**
  * All the tests are implemented with add_task, this starts them automatically.
  */
-function run_test()
-{
+function run_test() {
   do_get_profile();
   run_next_test();
 }
 
 // Global helpers
 
 /**
  * Returns a reference to a temporary file that is guaranteed not to exist and
@@ -50,18 +49,17 @@ function getTempFile(leafName) {
 const RecipeHelpers = {
   initNewParent() {
     return (new LoginRecipesParent({ defaults: null })).initializationPromise;
   },
 };
 
 // Initialization functions common to all tests
 
-add_task(async function test_common_initialize()
-{
+add_task(async function test_common_initialize() {
   // Before initializing the service for the first time, we should copy the key
   // file required to decrypt the logins contained in the SQLite databases used
   // by migration tests.  This file is not required for the other tests.
   await OS.File.copy(do_get_file("data/key3.db").path,
                      OS.Path.join(OS.Constants.Path.profileDir, "key3.db"));
 
   // Ensure that the service and the storage module are initialized.
   await Services.logins.initializationPromise;
--- a/toolkit/components/passwordmgr/test/unit/test_OSCrypto_win.js
+++ b/toolkit/components/passwordmgr/test/unit/test_OSCrypto_win.js
@@ -8,18 +8,17 @@
 
 ChromeUtils.defineModuleGetter(this, "OSCrypto",
                                "resource://gre/modules/OSCrypto.jsm");
 
 var crypto = new OSCrypto();
 
 // Tests
 
-add_task(function test_getIELoginHash()
-{
+add_task(function test_getIELoginHash() {
   Assert.equal(crypto.getIELoginHash("https://bugzilla.mozilla.org/page.cgi"),
                "4A66FE96607885790F8E67B56EEE52AB539BAFB47D");
 
   Assert.equal(crypto.getIELoginHash("https://github.com/login"),
                "0112F7DCE67B8579EA01367678AA44AB9868B5A143");
 
   Assert.equal(crypto.getIELoginHash("https://login.live.com/login.srf"),
                "FBF92E5D804C82717A57856533B779676D92903688");
@@ -31,18 +30,17 @@ add_task(function test_getIELoginHash()
   Assert.equal(crypto.getIELoginHash("https://reviewboard.mozilla.org/account/login/"),
                "09141FD287E2E59A8B1D3BB5671537FD3D6B61337A");
 
   Assert.equal(crypto.getIELoginHash("https://www.facebook.com/"),
                "EF44D3E034009CB0FD1B1D81A1FF3F3335213BD796");
 
 });
 
-add_task(function test_decryptData_encryptData()
-{
+add_task(function test_decryptData_encryptData() {
   function decryptEncryptTest(key) {
     Assert.equal(crypto.decryptData(crypto.encryptData("", key), key),
                  "");
 
     Assert.equal(crypto.decryptData(crypto.encryptData("secret", key), key),
                  "secret");
 
     Assert.equal(crypto.decryptData(crypto.encryptData("https://www.mozilla.org", key),
--- a/toolkit/components/passwordmgr/test/unit/test_disabled_hosts.js
+++ b/toolkit/components/passwordmgr/test/unit/test_disabled_hosts.js
@@ -9,18 +9,17 @@
 
 "use strict";
 
 // Tests
 
 /**
  * Tests setLoginSavingEnabled and getAllDisabledHosts.
  */
-add_task(function test_setLoginSavingEnabled_getAllDisabledHosts()
-{
+add_task(function test_setLoginSavingEnabled_getAllDisabledHosts() {
   // Add some disabled hosts, and verify that different schemes for the same
   // domain are considered different hosts.
   let hostname1 = "http://disabled1.example.com";
   let hostname2 = "http://disabled2.example.com";
   let hostname3 = "https://disabled2.example.com";
   Services.logins.setLoginSavingEnabled(hostname1, false);
   Services.logins.setLoginSavingEnabled(hostname2, false);
   Services.logins.setLoginSavingEnabled(hostname3, false);
@@ -43,18 +42,17 @@ add_task(function test_setLoginSavingEna
   Services.logins.setLoginSavingEnabled(hostname3, true);
   LoginTestUtils.assertDisabledHostsEqual(Services.logins.getAllDisabledHosts(),
                                           []);
 });
 
 /**
  * Tests setLoginSavingEnabled and getLoginSavingEnabled.
  */
-add_task(function test_setLoginSavingEnabled_getLoginSavingEnabled()
-{
+add_task(function test_setLoginSavingEnabled_getLoginSavingEnabled() {
   let hostname1 = "http://disabled.example.com";
   let hostname2 = "https://disabled.example.com";
 
   // Hosts should not be disabled by default.
   Assert.ok(Services.logins.getLoginSavingEnabled(hostname1));
   Assert.ok(Services.logins.getLoginSavingEnabled(hostname2));
 
   // Test setting initial values.
@@ -71,32 +69,30 @@ add_task(function test_setLoginSavingEna
 
   // Clean up.
   Services.logins.setLoginSavingEnabled(hostname2, true);
 });
 
 /**
  * Tests setLoginSavingEnabled with invalid NUL characters in the hostname.
  */
-add_task(function test_setLoginSavingEnabled_invalid_characters()
-{
+add_task(function test_setLoginSavingEnabled_invalid_characters() {
   let hostname = "http://null\0X.example.com";
   Assert.throws(() => Services.logins.setLoginSavingEnabled(hostname, false),
                 /Invalid hostname/);
 
   // Verify that no data was stored by the previous call.
   LoginTestUtils.assertDisabledHostsEqual(Services.logins.getAllDisabledHosts(),
                                           []);
 });
 
 /**
  * Tests different values of the "signon.rememberSignons" property.
  */
-add_task(function test_rememberSignons()
-{
+add_task(function test_rememberSignons() {
   let hostname1 = "http://example.com";
   let hostname2 = "http://localhost";
 
   // The default value for the preference should be true.
   Assert.ok(Services.prefs.getBoolPref("signon.rememberSignons"));
 
   // Hosts should not be disabled by default.
   Services.logins.setLoginSavingEnabled(hostname1, false);
@@ -139,18 +135,17 @@ add_task(function test_rememberSignons()
   Services.logins.setLoginSavingEnabled(hostname2, true);
   LoginTestUtils.assertDisabledHostsEqual(Services.logins.getAllDisabledHosts(),
                                           []);
 });
 
 /**
  * Tests storing disabled hosts with non-ASCII characters where IDN is supported.
  */
-add_task(async function test_storage_setLoginSavingEnabled_nonascii_IDN_is_supported()
-{
+add_task(async function test_storage_setLoginSavingEnabled_nonascii_IDN_is_supported() {
   let hostname = "http://大.net";
   let encoding = "http://xn--pss.net";
 
   // Test adding disabled host with nonascii URL (http://大.net).
   Services.logins.setLoginSavingEnabled(hostname, false);
   await LoginTestUtils.reloadData();
   Assert.equal(Services.logins.getLoginSavingEnabled(hostname), false);
   Assert.equal(Services.logins.getLoginSavingEnabled(encoding), false);
@@ -166,18 +161,17 @@ add_task(async function test_storage_set
   LoginTestUtils.assertDisabledHostsEqual(Services.logins.getAllDisabledHosts(), [hostname]);
 
   LoginTestUtils.clearData();
 });
 
 /**
  * Tests storing disabled hosts with non-ASCII characters where IDN is not supported.
  */
-add_task(async function test_storage_setLoginSavingEnabled_nonascii_IDN_not_supported()
-{
+add_task(async function test_storage_setLoginSavingEnabled_nonascii_IDN_not_supported() {
   let hostname = "http://√.com";
   let encoding = "http://xn--19g.com";
 
   // Test adding disabled host with nonascii URL (http://√.com).
   Services.logins.setLoginSavingEnabled(hostname, false);
   await LoginTestUtils.reloadData();
   Assert.equal(Services.logins.getLoginSavingEnabled(hostname), false);
   Assert.equal(Services.logins.getLoginSavingEnabled(encoding), false);
--- a/toolkit/components/passwordmgr/test/unit/test_legacy_empty_formSubmitURL.js
+++ b/toolkit/components/passwordmgr/test/unit/test_legacy_empty_formSubmitURL.js
@@ -38,18 +38,17 @@
 "use strict";
 
 // Tests
 
 /**
  * Adds a login with an empty formSubmitURL, then it verifies that no other
  * form logins can be added for the same host.
  */
-add_task(function test_addLogin_wildcard()
-{
+add_task(function test_addLogin_wildcard() {
   let loginInfo = TestData.formLogin({ hostname: "http://any.example.com",
                                        formSubmitURL: "" });
   Services.logins.addLogin(loginInfo);
 
   // Normal form logins cannot be added anymore.
   loginInfo = TestData.formLogin({ hostname: "http://any.example.com" });
   Assert.throws(() => Services.logins.addLogin(loginInfo), /already exists/);
 
@@ -62,18 +61,17 @@ add_task(function test_addLogin_wildcard
   Services.logins.addLogin(loginInfo);
 });
 
 /**
  * Verifies that findLogins, searchLogins, and countLogins include all logins
  * that have an empty formSubmitURL in the store, even when a formSubmitURL is
  * specified.
  */
-add_task(function test_search_all_wildcard()
-{
+add_task(function test_search_all_wildcard() {
   // Search a given formSubmitURL on any host.
   let matchData = newPropertyBag({ formSubmitURL: "http://www.example.com" });
   Assert.equal(Services.logins.searchLogins({}, matchData).length, 2);
 
   Assert.equal(Services.logins.findLogins({}, "", "http://www.example.com",
                                           null).length, 2);
 
   Assert.equal(Services.logins.countLogins("", "http://www.example.com",
@@ -91,17 +89,16 @@ add_task(function test_search_all_wildca
                                            "http://www.example.com",
                                            null), 1);
 });
 
 /**
  * Verifies that specifying an empty string for formSubmitURL in searchLogins
  * includes only logins that have an empty formSubmitURL in the store.
  */
-add_task(function test_searchLogins_wildcard()
-{
+add_task(function test_searchLogins_wildcard() {
   let logins = Services.logins.searchLogins({},
                                             newPropertyBag({ formSubmitURL: "" }));
 
   let loginInfo = TestData.formLogin({ hostname: "http://any.example.com",
                                        formSubmitURL: "" });
   LoginTestUtils.assertLoginListsEqual(logins, [loginInfo]);
 });
--- a/toolkit/components/passwordmgr/test/unit/test_legacy_validation.js
+++ b/toolkit/components/passwordmgr/test/unit/test_legacy_validation.js
@@ -13,18 +13,17 @@
 
 "use strict";
 
 // Tests
 
 /**
  * Tests legacy validation with addLogin.
  */
-add_task(function test_addLogin_invalid_characters_legacy()
-{
+add_task(function test_addLogin_invalid_characters_legacy() {
   // Test newlines and carriage returns in properties that contain URLs.
   for (let testValue of ["http://newline\n.example.com",
                          "http://carriagereturn.example.com\r"]) {
     let loginInfo = TestData.formLogin({ hostname: testValue });
     Assert.throws(() => Services.logins.addLogin(loginInfo),
                   /login values can't contain newlines/);
 
     loginInfo = TestData.formLogin({ formSubmitURL: testValue });
@@ -60,17 +59,16 @@ add_task(function test_addLogin_invalid_
   loginInfo = TestData.formLogin({ hostname: "http://parens (.example.com" });
   Assert.throws(() => Services.logins.addLogin(loginInfo),
                 /bad parens in hostname/);
 });
 
 /**
  * Tests legacy validation with setLoginSavingEnabled.
  */
-add_task(function test_setLoginSavingEnabled_invalid_characters_legacy()
-{
+add_task(function test_setLoginSavingEnabled_invalid_characters_legacy() {
   for (let hostname of ["http://newline\n.example.com",
                         "http://carriagereturn.example.com\r",
                         "."]) {
     Assert.throws(() => Services.logins.setLoginSavingEnabled(hostname, false),
                   /Invalid hostname/);
   }
 });
--- a/toolkit/components/passwordmgr/test/unit/test_logins_change.js
+++ b/toolkit/components/passwordmgr/test/unit/test_logins_change.js
@@ -18,18 +18,17 @@
  * This test requires that the login store is empty.
  *
  * @param aLoginInfo
  *        nsILoginInfo corresponding to an invalid login.
  * @param aExpectedError
  *        This argument is passed to the "Assert.throws" test to determine which
  *        error is expected from the modification functions.
  */
-function checkLoginInvalid(aLoginInfo, aExpectedError)
-{
+function checkLoginInvalid(aLoginInfo, aExpectedError) {
   // Try to add the new login, and verify that no data is stored.
   Assert.throws(() => Services.logins.addLogin(aLoginInfo), aExpectedError);
   LoginTestUtils.checkLogins([]);
 
   // Add a login for the modification tests.
   let testLogin = TestData.formLogin({ hostname: "http://modify.example.com" });
   Services.logins.addLogin(testLogin);
 
@@ -74,18 +73,17 @@ function compareAttributes(objectA, obje
   return attributes.every(attr => objectA[attr] == objectB[attr]);
 }
 
 // Tests
 
 /**
  * Tests that adding logins to the database works.
  */
-add_task(function test_addLogin_removeLogin()
-{
+add_task(function test_addLogin_removeLogin() {
   // Each login from the test data should be valid and added to the list.
   for (let loginInfo of TestData.loginList()) {
     Services.logins.addLogin(loginInfo);
   }
   LoginTestUtils.checkLogins(TestData.loginList());
 
   // Trying to add each login again should result in an error.
   for (let loginInfo of TestData.loginList()) {
@@ -104,18 +102,17 @@ add_task(function test_addLogin_removeLo
  * Tests invalid combinations of httpRealm and formSubmitURL.
  *
  * For an nsILoginInfo to be valid for storage, one of the two properties should
  * be strictly equal to null, and the other must not be null or an empty string.
  *
  * The legacy case of an empty string in formSubmitURL and a null value in
  * httpRealm is also supported for storage at the moment.
  */
-add_task(function test_invalid_httpRealm_formSubmitURL()
-{
+add_task(function test_invalid_httpRealm_formSubmitURL() {
   // httpRealm === null, formSubmitURL === null
   checkLoginInvalid(TestData.formLogin({ formSubmitURL: null }),
                     /without a httpRealm or formSubmitURL/);
 
   // httpRealm === "", formSubmitURL === null
   checkLoginInvalid(TestData.authLogin({ httpRealm: "" }),
                     /without a httpRealm or formSubmitURL/);
 
@@ -139,18 +136,17 @@ add_task(function test_invalid_httpRealm
   // !!httpRealm, formSubmitURL === ""
   checkLoginInvalid(TestData.authLogin({ formSubmitURL: "" }),
                     /both a httpRealm and formSubmitURL/);
 });
 
 /**
  * Tests null or empty values in required login properties.
  */
-add_task(function test_missing_properties()
-{
+add_task(function test_missing_properties() {
   checkLoginInvalid(TestData.formLogin({ hostname: null }),
                     /null or empty hostname/);
 
   checkLoginInvalid(TestData.formLogin({ hostname: "" }),
                     /null or empty hostname/);
 
   checkLoginInvalid(TestData.formLogin({ username: null }),
                     /null username/);
@@ -160,18 +156,17 @@ add_task(function test_missing_propertie
 
   checkLoginInvalid(TestData.formLogin({ password: "" }),
                     /null or empty password/);
 });
 
 /**
  * Tests invalid NUL characters in nsILoginInfo properties.
  */
-add_task(function test_invalid_characters()
-{
+add_task(function test_invalid_characters() {
   let loginList = [
     TestData.authLogin({ hostname: "http://null\0X.example.com" }),
     TestData.authLogin({ httpRealm: "realm\0" }),
     TestData.formLogin({ formSubmitURL: "http://null\0X.example.com" }),
     TestData.formLogin({ usernameField: "field\0_null" }),
     TestData.formLogin({ usernameField: ".\0" }), // Special single dot case
     TestData.formLogin({ passwordField: "field\0_null" }),
     TestData.formLogin({ username: "user\0name" }),
@@ -180,42 +175,39 @@ add_task(function test_invalid_character
   for (let loginInfo of loginList) {
     checkLoginInvalid(loginInfo, /login values can't contain nulls/);
   }
 });
 
 /**
  * Tests removing a login that does not exists.
  */
-add_task(function test_removeLogin_nonexisting()
-{
+add_task(function test_removeLogin_nonexisting() {
   Assert.throws(() => Services.logins.removeLogin(TestData.formLogin()),
                 /No matching logins/);
 });
 
 /**
  * Tests removing all logins at once.
  */
-add_task(function test_removeAllLogins()
-{
+add_task(function test_removeAllLogins() {
   for (let loginInfo of TestData.loginList()) {
     Services.logins.addLogin(loginInfo);
   }
   Services.logins.removeAllLogins();
   LoginTestUtils.checkLogins([]);
 
   // The function should also work when there are no logins to delete.
   Services.logins.removeAllLogins();
 });
 
 /**
  * Tests the modifyLogin function with an nsILoginInfo argument.
  */
-add_task(function test_modifyLogin_nsILoginInfo()
-{
+add_task(function test_modifyLogin_nsILoginInfo() {
   let loginInfo = TestData.formLogin();
   let updatedLoginInfo = TestData.formLogin({
     username: "new username",
     password: "new password",
     usernameField: "new_form_field_username",
     passwordField: "new_form_field_password",
   });
   let differentLoginInfo = TestData.authLogin();
@@ -248,18 +240,17 @@ add_task(function test_modifyLogin_nsILo
   LoginTestUtils.checkLogins([loginInfo, differentLoginInfo]);
 
   LoginTestUtils.clearData();
 });
 
 /**
  * Tests the modifyLogin function with an nsIPropertyBag argument.
  */
-add_task(function test_modifyLogin_nsIProperyBag()
-{
+add_task(function test_modifyLogin_nsIProperyBag() {
   let loginInfo = TestData.formLogin();
   let updatedLoginInfo = TestData.formLogin({
     username: "new username",
     password: "new password",
     usernameField: "",
     passwordField: "new_form_field_password",
   });
   let differentLoginInfo = TestData.authLogin();
--- a/toolkit/components/passwordmgr/test/unit/test_logins_decrypt_failure.js
+++ b/toolkit/components/passwordmgr/test/unit/test_logins_decrypt_failure.js
@@ -10,31 +10,29 @@
 "use strict";
 
 // Globals
 
 /**
  * Resets the token used to decrypt logins.  This is equivalent to resetting the
  * master password when it is not known.
  */
-function resetMasterPassword()
-{
+function resetMasterPassword() {
   let token = Cc["@mozilla.org/security/pk11tokendb;1"]
                 .getService(Ci.nsIPK11TokenDB).getInternalKeyToken();
   token.reset();
   token.initPassword("");
 }
 
 // Tests
 
 /**
  * Resets the master password after some logins were added to the database.
  */
-add_task(function test_logins_decrypt_failure()
-{
+add_task(function test_logins_decrypt_failure() {
   let logins = TestData.loginList();
   for (let loginInfo of logins) {
     Services.logins.addLogin(loginInfo);
   }
 
   // This makes the existing logins non-decryptable.
   resetMasterPassword();
 
@@ -74,18 +72,17 @@ add_task(function test_logins_decrypt_fa
   Services.logins.removeAllLogins();
   Assert.equal(Services.logins.getAllLogins().length, 0);
   Assert.equal(Services.logins.countLogins("", "", ""), 0);
 });
 
 // Bug 621846 - If a login has a GUID but can't be decrypted, a search for
 // that GUID will (correctly) fail. Ensure we can add a new login with that
 // same GUID.
-add_task(function test_add_logins_with_decrypt_failure()
-{
+add_task(function test_add_logins_with_decrypt_failure() {
   // a login with a GUID.
   let login = new LoginInfo("http://www.example2.com", "http://www.example2.com", null,
                             "the username", "the password for www.example.com",
                             "form_field_username", "form_field_password");
 
   login.QueryInterface(Ci.nsILoginMetaInfo);
   login.guid = "{4bc50d2f-dbb6-4aa3-807c-c4c2065a2c35}";
 
--- a/toolkit/components/passwordmgr/test/unit/test_logins_metainfo.js
+++ b/toolkit/components/passwordmgr/test/unit/test_logins_metainfo.js
@@ -18,29 +18,27 @@ XPCOMUtils.defineLazyServiceGetter(this,
 
 var gLooksLikeUUIDRegex = /^\{\w{8}-\w{4}-\w{4}-\w{4}-\w{12}\}$/;
 
 /**
  * Retrieves the only login among the current data that matches the hostname of
  * the given nsILoginInfo.  In case there is more than one login for the
  * hostname, the test fails.
  */
-function retrieveLoginMatching(aLoginInfo)
-{
+function retrieveLoginMatching(aLoginInfo) {
   let logins = Services.logins.findLogins({}, aLoginInfo.hostname, "", "");
   Assert.equal(logins.length, 1);
   return logins[0].QueryInterface(Ci.nsILoginMetaInfo);
 }
 
 /**
  * Checks that the nsILoginInfo and nsILoginMetaInfo properties of two different
  * login instances are equal.
  */
-function assertMetaInfoEqual(aActual, aExpected)
-{
+function assertMetaInfoEqual(aActual, aExpected) {
   Assert.notEqual(aActual, aExpected);
 
   // Check the nsILoginInfo properties.
   Assert.ok(aActual.equals(aExpected));
 
   // Check the nsILoginMetaInfo properties.
   Assert.equal(aActual.guid, aExpected.guid);
   Assert.equal(aActual.timeCreated, aExpected.timeCreated);
@@ -64,18 +62,17 @@ var gLoginMetaInfo1;
 var gLoginMetaInfo2;
 var gLoginMetaInfo3;
 
 // Tests
 
 /**
  * Prepare the test objects that will be used by the following tests.
  */
-add_task(function test_initialize()
-{
+add_task(function test_initialize() {
   // Use a reference time from ten minutes ago to initialize one instance of
   // nsILoginMetaInfo, to test that reference times are updated when needed.
   let baseTimeMs = Date.now() - 600000;
 
   gLoginInfo1 = TestData.formLogin();
   gLoginInfo2 = TestData.formLogin({
     hostname: "http://other.example.com",
     guid: gUUIDGenerator.generateUUID().toString(),
@@ -86,18 +83,17 @@ add_task(function test_initialize()
   });
   gLoginInfo3 = TestData.authLogin();
 });
 
 /**
  * Tests the behavior of addLogin with regard to metadata.  The logins added
  * here are also used by the following tests.
  */
-add_task(function test_addLogin_metainfo()
-{
+add_task(function test_addLogin_metainfo() {
   // Add a login without metadata to the database.
   Services.logins.addLogin(gLoginInfo1);
 
   // The object provided to addLogin should not have been modified.
   Assert.equal(gLoginInfo1.guid, null);
   Assert.equal(gLoginInfo1.timeCreated, 0);
   Assert.equal(gLoginInfo1.timeLastUsed, 0);
   Assert.equal(gLoginInfo1.timePasswordChanged, 0);
@@ -127,52 +123,49 @@ add_task(function test_addLogin_metainfo
   Services.logins.addLogin(gLoginInfo3);
   gLoginMetaInfo3 = retrieveLoginMatching(gLoginInfo3);
   LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
 });
 
 /**
  * Tests that adding a login with a duplicate GUID throws an exception.
  */
-add_task(function test_addLogin_metainfo_duplicate()
-{
+add_task(function test_addLogin_metainfo_duplicate() {
   let loginInfo = TestData.formLogin({
     hostname: "http://duplicate.example.com",
     guid: gLoginMetaInfo2.guid,
   });
   Assert.throws(() => Services.logins.addLogin(loginInfo),
                 /specified GUID already exists/);
 
   // Verify that no data was stored by the previous call.
   LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
 });
 
 /**
  * Tests that the existing metadata is not changed when modifyLogin is called
  * with an nsILoginInfo argument.
  */
-add_task(function test_modifyLogin_nsILoginInfo_metainfo_ignored()
-{
+add_task(function test_modifyLogin_nsILoginInfo_metainfo_ignored() {
   let newLoginInfo = gLoginInfo1.clone().QueryInterface(Ci.nsILoginMetaInfo);
   newLoginInfo.guid = gUUIDGenerator.generateUUID().toString();
   newLoginInfo.timeCreated = Date.now();
   newLoginInfo.timeLastUsed = Date.now();
   newLoginInfo.timePasswordChanged = Date.now();
   newLoginInfo.timesUsed = 12;
   Services.logins.modifyLogin(gLoginInfo1, newLoginInfo);
 
   newLoginInfo = retrieveLoginMatching(gLoginInfo1);
   assertMetaInfoEqual(newLoginInfo, gLoginMetaInfo1);
 });
 
 /**
  * Tests the modifyLogin function with an nsIProperyBag argument.
  */
-add_task(function test_modifyLogin_nsIProperyBag_metainfo()
-{
+add_task(function test_modifyLogin_nsIProperyBag_metainfo() {
   // Use a new reference time that is two minutes from now.
   let newTimeMs = Date.now() + 120000;
   let newUUIDValue = gUUIDGenerator.generateUUID().toString();
 
   // Check that properties are changed as requested.
   Services.logins.modifyLogin(gLoginInfo1, newPropertyBag({
     guid: newUUIDValue,
     timeCreated: newTimeMs,
@@ -225,29 +218,27 @@ add_task(function test_modifyLogin_nsIPr
   Assert.equal(gLoginMetaInfo2.timeLastUsed, originalLogin.timeLastUsed);
   Assert.equal(gLoginMetaInfo2.timePasswordChanged, newTimeMs);
   Assert.equal(gLoginMetaInfo2.timesUsed, 4);
 });
 
 /**
  * Tests that modifying a login to a duplicate GUID throws an exception.
  */
-add_task(function test_modifyLogin_nsIProperyBag_metainfo_duplicate()
-{
+add_task(function test_modifyLogin_nsIProperyBag_metainfo_duplicate() {
   Assert.throws(() => Services.logins.modifyLogin(gLoginInfo1, newPropertyBag({
     guid: gLoginInfo2.guid,
   })), /specified GUID already exists/);
   LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
 });
 
 /**
  * Tests searching logins using nsILoginMetaInfo properties.
  */
-add_task(function test_searchLogins_metainfo()
-{
+add_task(function test_searchLogins_metainfo() {
   // Find by GUID.
   let logins = Services.logins.searchLogins({}, newPropertyBag({
     guid: gLoginMetaInfo1.guid,
   }));
   Assert.equal(logins.length, 1);
   let foundLogin = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
   assertMetaInfoEqual(foundLogin, gLoginMetaInfo1);
 
@@ -268,17 +259,16 @@ add_task(function test_searchLogins_meta
   foundLogin = logins[0].QueryInterface(Ci.nsILoginMetaInfo);
   assertMetaInfoEqual(foundLogin, gLoginMetaInfo3);
 });
 
 /**
  * Tests that the default nsILoginManagerStorage module attached to the Login
  * Manager service is able to save and reload nsILoginMetaInfo properties.
  */
-add_task(async function test_storage_metainfo()
-{
+add_task(async function test_storage_metainfo() {
   await LoginTestUtils.reloadData();
   LoginTestUtils.checkLogins([gLoginInfo1, gLoginInfo2, gLoginInfo3]);
 
   assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo1), gLoginMetaInfo1);
   assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo2), gLoginMetaInfo2);
   assertMetaInfoEqual(retrieveLoginMatching(gLoginInfo3), gLoginMetaInfo3);
 });
--- a/toolkit/components/passwordmgr/test/unit/test_logins_search.js
+++ b/toolkit/components/passwordmgr/test/unit/test_logins_search.js
@@ -13,36 +13,34 @@
 /**
  * Returns a list of new nsILoginInfo objects that are a subset of the test
  * data, built to match the specified query.
  *
  * @param aQuery
  *        Each property and value of this object restricts the search to those
  *        entries from the test data that match the property exactly.
  */
-function buildExpectedLogins(aQuery)
-{
+function buildExpectedLogins(aQuery) {
   return TestData.loginList().filter(
     entry => Object.keys(aQuery).every(name => entry[name] === aQuery[name]));
 }
 
 /**
  * Tests the searchLogins function.
  *
  * @param aQuery
  *        Each property and value of this object is translated to an entry in
  *        the nsIPropertyBag parameter of searchLogins.
  * @param aExpectedCount
  *        Number of logins from the test data that should be found.  The actual
  *        list of logins is obtained using the buildExpectedLogins helper, and
  *        this value is just used to verify that modifications to the test data
  *        don't make the current test meaningless.
  */
-function checkSearchLogins(aQuery, aExpectedCount)
-{
+function checkSearchLogins(aQuery, aExpectedCount) {
   info("Testing searchLogins for " + JSON.stringify(aQuery));
 
   let expectedLogins = buildExpectedLogins(aQuery);
   Assert.equal(expectedLogins.length, aExpectedCount);
 
   let outCount = {};
   let logins = Services.logins.searchLogins(outCount, newPropertyBag(aQuery));
   Assert.equal(outCount.value, expectedLogins.length);
@@ -57,18 +55,17 @@ function checkSearchLogins(aQuery, aExpe
  *        object are passed as parameters to findLogins and countLogins.  The
  *        same object is then passed to the checkSearchLogins function.
  * @param aExpectedCount
  *        Number of logins from the test data that should be found.  The actual
  *        list of logins is obtained using the buildExpectedLogins helper, and
  *        this value is just used to verify that modifications to the test data
  *        don't make the current test meaningless.
  */
-function checkAllSearches(aQuery, aExpectedCount)
-{
+function checkAllSearches(aQuery, aExpectedCount) {
   info("Testing all search functions for " + JSON.stringify(aQuery));
 
   let expectedLogins = buildExpectedLogins(aQuery);
   Assert.equal(expectedLogins.length, aExpectedCount);
 
   // The findLogins and countLogins functions support wildcard matches by
   // specifying empty strings as parameters, while searchLogins requires
   // omitting the property entirely.
@@ -91,28 +88,26 @@ function checkAllSearches(aQuery, aExpec
   checkSearchLogins(aQuery, aExpectedCount);
 }
 
 // Tests
 
 /**
  * Prepare data for the following tests.
  */
-add_task(function test_initialize()
-{
+add_task(function test_initialize() {
   for (let login of TestData.loginList()) {
     Services.logins.addLogin(login);
   }
 });
 
 /**
  * Tests findLogins, searchLogins, and countLogins with basic queries.
  */
-add_task(function test_search_all_basic()
-{
+add_task(function test_search_all_basic() {
   // Find all logins, using no filters in the search functions.
   checkAllSearches({}, 23);
 
   // Find all form logins, then all authentication logins.
   checkAllSearches({ httpRealm: null }, 14);
   checkAllSearches({ formSubmitURL: null }, 9);
 
   // Find all form logins on one host, then all authentication logins.
@@ -152,18 +147,17 @@ add_task(function test_search_all_basic(
                      httpRealm: "The HTTP Realm Other" }, 1);
   checkAllSearches({ hostname: "ftp://example.net",
                      httpRealm: "ftp://example.net" }, 1);
 });
 
 /**
  * Tests searchLogins with advanced queries.
  */
-add_task(function test_searchLogins()
-{
+add_task(function test_searchLogins() {
   checkSearchLogins({ usernameField: "form_field_username" }, 12);
   checkSearchLogins({ passwordField: "form_field_password" }, 13);
 
   // Find all logins with an empty usernameField, including for authentication.
   checkSearchLogins({ usernameField: "" }, 11);
 
   // Find form logins with an empty usernameField.
   checkSearchLogins({ httpRealm: null,
@@ -172,29 +166,27 @@ add_task(function test_searchLogins()
   // Find logins with an empty usernameField on one host.
   checkSearchLogins({ hostname: "http://www6.example.com",
                       usernameField: "" }, 1);
 });
 
 /**
  * Tests searchLogins with invalid arguments.
  */
-add_task(function test_searchLogins_invalid()
-{
+add_task(function test_searchLogins_invalid() {
   Assert.throws(() => Services.logins.searchLogins({},
                                                    newPropertyBag({ username: "value" })),
                 /Unexpected field/);
 });
 
 /**
  * Tests that matches are case-sensitive, compare the full field value, and are
  * strict when interpreting the prePath of URIs.
  */
-add_task(function test_search_all_full_case_sensitive()
-{
+add_task(function test_search_all_full_case_sensitive() {
   checkAllSearches({ hostname: "http://www.example.com" }, 1);
   checkAllSearches({ hostname: "http://www.example.com/" }, 0);
   checkAllSearches({ hostname: "example.com" }, 0);
 
   checkAllSearches({ formSubmitURL: "http://www.example.com" }, 2);
   checkAllSearches({ formSubmitURL: "http://www.example.com/" }, 0);
   checkAllSearches({ formSubmitURL: "http://" }, 0);
   checkAllSearches({ formSubmitURL: "example.com" }, 0);
@@ -204,17 +196,16 @@ add_task(function test_search_all_full_c
   checkAllSearches({ httpRealm: "The HTTP" }, 0);
   checkAllSearches({ httpRealm: "Realm" }, 0);
 });
 
 /**
  * Tests findLogins, searchLogins, and countLogins with queries that should
  * return no values.
  */
-add_task(function test_search_all_empty()
-{
+add_task(function test_search_all_empty() {
   checkAllSearches({ hostname: "http://nonexistent.example.com" }, 0);
   checkAllSearches({ formSubmitURL: "http://www.example.com",
                      httpRealm: "The HTTP Realm" }, 0);
 
   checkSearchLogins({ hostname: "" }, 0);
   checkSearchLogins({ id: "1000" }, 0);
 });
--- a/toolkit/components/passwordmgr/test/unit/test_module_LoginImport.js
+++ b/toolkit/components/passwordmgr/test/unit/test_module_LoginImport.js
@@ -27,18 +27,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
 XPCOMUtils.defineLazyServiceGetter(this, "gUUIDGenerator",
                                    "@mozilla.org/uuid-generator;1",
                                    "nsIUUIDGenerator");
 
 /**
  * Creates empty login data tables in the given SQLite connection, resembling
  * the most recent schema version (excluding indices).
  */
-function promiseCreateDatabaseSchema(aConnection)
-{
+function promiseCreateDatabaseSchema(aConnection) {
   return (async function() {
     await aConnection.setSchemaVersion(5);
     await aConnection.execute("CREATE TABLE moz_logins (" +
                               "id                  INTEGER PRIMARY KEY," +
                               "hostname            TEXT NOT NULL," +
                               "httpRealm           TEXT," +
                               "formSubmitURL       TEXT," +
                               "usernameField       TEXT NOT NULL," +
@@ -59,18 +58,17 @@ function promiseCreateDatabaseSchema(aCo
                               "guid                TEXT," +
                               "timeDeleted         INTEGER)");
   })();
 }
 
 /**
  * Inserts a new entry in the database resembling the given nsILoginInfo object.
  */
-function promiseInsertLoginInfo(aConnection, aLoginInfo)
-{
+function promiseInsertLoginInfo(aConnection, aLoginInfo) {
   aLoginInfo.QueryInterface(Ci.nsILoginMetaInfo);
 
   // We can't use the aLoginInfo object directly in the execute statement
   // because the bind code in Sqlite.jsm doesn't allow objects with extra
   // properties beyond those being binded. So we might as well use an array as
   // it is simpler.
   let values = [
     aLoginInfo.hostname,
@@ -94,29 +92,27 @@ function promiseInsertLoginInfo(aConnect
                              "encryptedPassword, guid, encType, timeCreated, " +
                              "timeLastUsed, timePasswordChanged, timesUsed) " +
                              "VALUES (?" + ",?".repeat(12) + ")", values);
 }
 
 /**
  * Inserts a new disabled host entry in the database.
  */
-function promiseInsertDisabledHost(aConnection, aHostname)
-{
+function promiseInsertDisabledHost(aConnection, aHostname) {
   return aConnection.execute("INSERT INTO moz_disabledHosts (hostname) " +
                              "VALUES (?)", [aHostname]);
 }
 
 // Tests
 
 /**
  * Imports login data from a SQLite file constructed using the test data.
  */
-add_task(async function test_import()
-{
+add_task(async function test_import() {
   let store = new LoginStore(getTempFile("test-import.json").path);
   let loginsSqlite = getTempFile("test-logins.sqlite").path;
 
   // Prepare the logins to be imported, including the nsILoginMetaInfo data.
   let loginList = TestData.loginList();
   for (let loginInfo of loginList) {
     loginInfo.QueryInterface(Ci.nsILoginMetaInfo);
     loginInfo.guid = gUUIDGenerator.generateUUID().toString();
@@ -169,18 +165,17 @@ add_task(async function test_import()
   Assert.equal(store.data.disabledHosts.length, 2);
   Assert.ok(store.data.disabledHosts.includes("http://www.example.com"));
   Assert.ok(store.data.disabledHosts.includes("https://www.example.org"));
 });
 
 /**
  * Tests imports of NULL values due to a downgraded database.
  */
-add_task(async function test_import_downgraded()
-{
+add_task(async function test_import_downgraded() {
   let store = new LoginStore(getTempFile("test-import-downgraded.json").path);
   let loginsSqlite = getTempFile("test-logins-downgraded.sqlite").path;
 
   // Create and populate the SQLite database first.
   let connection = await Sqlite.openConnection({ path: loginsSqlite });
   try {
     await promiseCreateDatabaseSchema(connection);
     await connection.setSchemaVersion(3);
@@ -206,34 +201,32 @@ add_task(async function test_import_down
   Assert.equal(loginItem.timeLastUsed, creationTime);
   Assert.equal(loginItem.timePasswordChanged, creationTime);
   Assert.equal(loginItem.timesUsed, 1);
 });
 
 /**
  * Verifies that importing from a SQLite file with database version 2 fails.
  */
-add_task(async function test_import_v2()
-{
+add_task(async function test_import_v2() {
   let store = new LoginStore(getTempFile("test-import-v2.json").path);
   let loginsSqlite = do_get_file("data/signons-v2.sqlite").path;
 
   // The "load" method must be called before importing data.
   await store.load();
   try {
     await new LoginImport(store, loginsSqlite).import();
     do_throw("The operation should have failed.");
   } catch (ex) { }
 });
 
 /**
  * Imports login data from a SQLite file, with database version 3.
  */
-add_task(async function test_import_v3()
-{
+add_task(async function test_import_v3() {
   let store = new LoginStore(getTempFile("test-import-v3.json").path);
   let loginsSqlite = do_get_file("data/signons-v3.sqlite").path;
 
   // The "load" method must be called before importing data.
   await store.load();
   await new LoginImport(store, loginsSqlite).import();
 
   // We only execute basic integrity checks.
--- a/toolkit/components/passwordmgr/test/unit/test_module_LoginStore.js
+++ b/toolkit/components/passwordmgr/test/unit/test_module_LoginStore.js
@@ -16,18 +16,17 @@ ChromeUtils.defineModuleGetter(this, "Lo
 
 const TEST_STORE_FILE_NAME = "test-logins.json";
 
 // Tests
 
 /**
  * Saves login data to a file, then reloads it.
  */
-add_task(async function test_save_reload()
-{
+add_task(async function test_save_reload() {
   let storeForSave = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   // The "load" method must be called before preparing the data to be saved.
   await storeForSave.load();
 
   let rawLoginData = {
     id:                  storeForSave.data.nextId++,
     hostname:            "http://www.example.com",
@@ -67,53 +66,50 @@ add_task(async function test_save_reload
   Assert.deepEqual(storeForLoad.data.logins[0], rawLoginData);
   Assert.equal(storeForLoad.data.disabledHosts.length, 1);
   Assert.equal(storeForLoad.data.disabledHosts[0], "http://www.example.org");
 });
 
 /**
  * Checks that loading from a missing file results in empty arrays.
  */
-add_task(async function test_load_empty()
-{
+add_task(async function test_load_empty() {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   Assert.equal(false, await OS.File.exists(store.path));
 
   await store.load();
 
   Assert.equal(false, await OS.File.exists(store.path));
 
   Assert.equal(store.data.logins.length, 0);
   Assert.equal(store.data.disabledHosts.length, 0);
 });
 
 /**
  * Checks that saving empty data still overwrites any existing file.
  */
-add_task(async function test_save_empty()
-{
+add_task(async function test_save_empty() {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   await store.load();
 
   let createdFile = await OS.File.open(store.path, { create: true });
   await createdFile.close();
 
   await store._save();
 
   Assert.ok(await OS.File.exists(store.path));
 });
 
 /**
  * Loads data from a string in a predefined format.  The purpose of this test is
  * to verify that the JSON format used in previous versions can be loaded.
  */
-add_task(async function test_load_string_predefined()
-{
+add_task(async function test_load_string_predefined() {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   let string = "{\"logins\":[{" +
                 "\"id\":1," +
                 "\"hostname\":\"http://www.example.com\"," +
                 "\"httpRealm\":null," +
                 "\"formSubmitURL\":\"http://www.example.com/submit-url\"," +
                 "\"usernameField\":\"usernameField\"," +
@@ -154,18 +150,17 @@ add_task(async function test_load_string
 
   Assert.equal(store.data.disabledHosts.length, 1);
   Assert.equal(store.data.disabledHosts[0], "http://www.example.org");
 });
 
 /**
  * Loads login data from a malformed JSON string.
  */
-add_task(async function test_load_string_malformed()
-{
+add_task(async function test_load_string_malformed() {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   let string = "{\"logins\":[{\"hostname\":\"http://www.example.com\"," +
                 "\"id\":1,";
 
   await OS.File.writeAtomic(store.path, new TextEncoder().encode(string),
                             { tmpPath: store.path + ".tmp" });
 
@@ -179,18 +174,17 @@ add_task(async function test_load_string
   Assert.equal(store.data.logins.length, 0);
   Assert.equal(store.data.disabledHosts.length, 0);
 });
 
 /**
  * Loads login data from a malformed JSON string, using the synchronous
  * initialization path.
  */
-add_task(async function test_load_string_malformed_sync()
-{
+add_task(async function test_load_string_malformed_sync() {
   let store = new LoginStore(getTempFile(TEST_STORE_FILE_NAME).path);
 
   let string = "{\"logins\":[{\"hostname\":\"http://www.example.com\"," +
                 "\"id\":1,";
 
   await OS.File.writeAtomic(store.path, new TextEncoder().encode(string),
                             { tmpPath: store.path + ".tmp" });
 
--- a/toolkit/components/passwordmgr/test/unit/test_notifications.js
+++ b/toolkit/components/passwordmgr/test/unit/test_notifications.js
@@ -43,18 +43,17 @@ var TestObserver = {
         do_throw("Unhandled notification: " + data + " / " + topic);
     }
 
     expectedNotification = null; // ensure a duplicate is flagged as unexpected.
     expectedData = null;
   },
 };
 
-add_task(function test_notifications()
-{
+add_task(function test_notifications() {
 
   try {
 
     var testnum = 0;
     var testdesc = "Setup of nsLoginInfo test-users";
 
     var testuser1 = new LoginInfo("http://testhost1", "", null,
                                   "dummydude", "itsasecret", "put_user_here", "put_pw_here");
--- a/toolkit/components/passwordmgr/test/unit/test_storage.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage.js
@@ -8,30 +8,28 @@
  * Manager service is able to save and reload nsILoginInfo properties correctly,
  * even when they include special characters.
  */
 
 "use strict";
 
 // Globals
 
-async function reloadAndCheckLoginsGen(aExpectedLogins)
-{
+async function reloadAndCheckLoginsGen(aExpectedLogins) {
   await LoginTestUtils.reloadData();
   LoginTestUtils.checkLogins(aExpectedLogins);
   LoginTestUtils.clearData();
 }
 
 // Tests
 
 /**
  * Tests addLogin with valid non-ASCII characters.
  */
-add_task(async function test_storage_addLogin_nonascii()
-{
+add_task(async function test_storage_addLogin_nonascii() {
   let hostname = "http://" + String.fromCharCode(355) + ".example.com";
 
   // Store the strings "user" and "pass" using similarly looking glyphs.
   let loginInfo = TestData.formLogin({
     hostname,
     formSubmitURL: hostname,
     username: String.fromCharCode(533, 537, 7570, 345),
     password: String.fromCharCode(421, 259, 349, 537),
@@ -47,49 +45,46 @@ add_task(async function test_storage_add
   });
   Services.logins.addLogin(loginInfo);
   await reloadAndCheckLoginsGen([loginInfo]);
 });
 
 /**
  * Tests addLogin with newline characters in the username and password.
  */
-add_task(async function test_storage_addLogin_newlines()
-{
+add_task(async function test_storage_addLogin_newlines() {
   let loginInfo = TestData.formLogin({
     username: "user\r\nname",
     password: "password\r\n",
   });
   Services.logins.addLogin(loginInfo);
   await reloadAndCheckLoginsGen([loginInfo]);
 });
 
 /**
  * Tests addLogin with a single dot in fields where it is allowed.
  *
  * These tests exist to verify the legacy "signons.txt" storage format.
  */
-add_task(async function test_storage_addLogin_dot()
-{
+add_task(async function test_storage_addLogin_dot() {
   let loginInfo = TestData.formLogin({ hostname: ".", passwordField: "." });
   Services.logins.addLogin(loginInfo);
   await reloadAndCheckLoginsGen([loginInfo]);
 
   loginInfo = TestData.authLogin({ httpRealm: "." });
   Services.logins.addLogin(loginInfo);
   await reloadAndCheckLoginsGen([loginInfo]);
 });
 
 /**
  * Tests addLogin with parentheses in hostnames.
  *
  * These tests exist to verify the legacy "signons.txt" storage format.
  */
-add_task(async function test_storage_addLogin_parentheses()
-{
+add_task(async function test_storage_addLogin_parentheses() {
   let loginList = [
     TestData.authLogin({ httpRealm: "(realm" }),
     TestData.authLogin({ httpRealm: "realm)" }),
     TestData.authLogin({ httpRealm: "(realm)" }),
     TestData.authLogin({ httpRealm: ")realm(" }),
     TestData.authLogin({ hostname: "http://parens(.example.com" }),
     TestData.authLogin({ hostname: "http://parens).example.com" }),
     TestData.authLogin({ hostname: "http://parens(example).example.com" }),
--- a/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
+++ b/toolkit/components/passwordmgr/test/unit/test_storage_mozStorage.js
@@ -7,64 +7,60 @@
 const ENCTYPE_BASE64 = 0;
 const ENCTYPE_SDR = 1;
 const PERMISSION_SAVE_LOGINS = "login-saving";
 
 // Current schema version used by storage-mozStorage.js. This will need to be
 // kept in sync with the version there (or else the tests fail).
 const CURRENT_SCHEMA = 6;
 
-async function copyFile(aLeafName)
-{
+async function copyFile(aLeafName) {
   await OS.File.copy(OS.Path.join(do_get_file("data").path, aLeafName),
                      OS.Path.join(OS.Constants.Path.profileDir, aLeafName));
 }
 
-function openDB(aLeafName)
-{
+function openDB(aLeafName) {
   var dbFile = new FileUtils.File(OS.Constants.Path.profileDir);
   dbFile.append(aLeafName);
 
   return Services.storage.openDatabase(dbFile);
 }
 
-function deleteFile(pathname, filename)
-{
+function deleteFile(pathname, filename) {
   var file = new FileUtils.File(pathname);
   file.append(filename);
 
   // Suppress failures, this happens in the mozstorage tests on Windows
   // because the module may still be holding onto the DB. (We don't
   // have a way to explicitly shutdown/GC the module).
   try {
-    if (file.exists())
+    if (file.exists()) {
       file.remove(false);
+    }
   } catch (e) {}
 }
 
-function reloadStorage(aInputPathName, aInputFileName)
-{
+function reloadStorage(aInputPathName, aInputFileName) {
   var inputFile = null;
   if (aInputFileName) {
     inputFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
     inputFile.initWithPath(aInputPathName);
     inputFile.append(aInputFileName);
   }
 
   let storage = Cc["@mozilla.org/login-manager/storage/mozStorage;1"]
                   .createInstance(Ci.nsILoginManagerStorage);
   storage.QueryInterface(Ci.nsIInterfaceRequestor)
          .getInterface(Ci.nsIVariant)
          .initWithFile(inputFile);
 
   return storage;
 }
 
-function checkStorageData(storage, ref_disabledHosts, ref_logins)
-{
+function checkStorageData(storage, ref_disabledHosts, ref_logins) {
   LoginTestUtils.assertLoginListsEqual(storage.getAllLogins(), ref_logins);
   LoginTestUtils.assertDisabledHostsEqual(getAllDisabledHostsFromPermissionManager(),
                                           ref_disabledHosts);
 }
 
 function getAllDisabledHostsFromPermissionManager() {
   let disabledHosts = [];
   for (let perm of Services.perms.enumerator) {
@@ -81,18 +77,17 @@ function setLoginSavingEnabled(origin, e
 
   if (enabled) {
     Services.perms.remove(uri, PERMISSION_SAVE_LOGINS);
   } else {
     Services.perms.add(uri, PERMISSION_SAVE_LOGINS, Services.perms.DENY_ACTION);
   }
 }
 
-add_task(async function test_execute()
-{
+add_task(async function test_execute() {
 
   const OUTDIR = OS.Constants.Path.profileDir;
 
   try {
 
     var isGUID = /^\{[0-9a-f\d]{8}-[0-9a-f\d]{4}-[0-9a-f\d]{4}-[0-9a-f\d]{4}-[0-9a-f\d]{12}\}$/;
     function getGUIDforID(conn, id) {
       var stmt = conn.createStatement("SELECT guid from moz_logins WHERE id = " + id);
@@ -260,18 +255,19 @@ add_task(async function test_execute()
     dbConnection = openDB("signons-v2.sqlite");
     Assert.equal(2, dbConnection.schemaVersion);
 
     storage = reloadStorage(OUTDIR, "signons-v2.sqlite");
 
     // Check to see that we added the correct encType to the logins.
     Assert.equal(CURRENT_SCHEMA, dbConnection.schemaVersion);
     var encTypes = [ENCTYPE_BASE64, ENCTYPE_SDR, ENCTYPE_BASE64, ENCTYPE_BASE64];
-    for (let i = 0; i < encTypes.length; i++)
+    for (let i = 0; i < encTypes.length; i++) {
       Assert.equal(encTypes[i], getEncTypeForID(dbConnection, i + 1));
+    }
     dbConnection.close();
 
     // There are 4 logins, but 3 will be invalid because we can no longer decrypt
     // base64-encoded items. (testuser1/4/5)
     checkStorageData(storage, ["https://disabled.net"],
                      [testuser2]);
 
     deleteFile(OUTDIR, "signons-v2.sqlite");
@@ -283,34 +279,37 @@ add_task(async function test_execute()
     // are upgrading it again. Any logins added by the v2 code must be properly
     // upgraded.
 
     await copyFile("signons-v2v3.sqlite");
     // Sanity check the test file.
     dbConnection = openDB("signons-v2v3.sqlite");
     Assert.equal(2, dbConnection.schemaVersion);
     encTypes = [ENCTYPE_BASE64, ENCTYPE_SDR, ENCTYPE_BASE64, ENCTYPE_BASE64, null];
-    for (let i = 0; i < encTypes.length; i++)
+    for (let i = 0; i < encTypes.length; i++) {
       Assert.equal(encTypes[i], getEncTypeForID(dbConnection, i + 1));
+    }
 
     // Reload storage, check that the new login now has encType=1, others untouched
     storage = reloadStorage(OUTDIR, "signons-v2v3.sqlite");
     Assert.equal(CURRENT_SCHEMA, dbConnection.schemaVersion);
 
     encTypes = [ENCTYPE_BASE64, ENCTYPE_SDR, ENCTYPE_BASE64, ENCTYPE_BASE64, ENCTYPE_SDR];
-    for (let i = 0; i < encTypes.length; i++)
+    for (let i = 0; i < encTypes.length; i++) {
       Assert.equal(encTypes[i], getEncTypeForID(dbConnection, i + 1));
+    }
 
     // Sanity check that the data gets migrated
     // There are 5 logins, but 3 will be invalid because we can no longer decrypt
     // base64-encoded items. (testuser1/4/5). We no longer reencrypt with SDR.
     checkStorageData(storage, ["https://disabled.net"], [testuser2, testuser3]);
     encTypes = [ENCTYPE_BASE64, ENCTYPE_SDR, ENCTYPE_BASE64, ENCTYPE_BASE64, ENCTYPE_SDR];
-    for (let i = 0; i < encTypes.length; i++)
+    for (let i = 0; i < encTypes.length; i++) {
       Assert.equal(encTypes[i], getEncTypeForID(dbConnection, i + 1));
+    }
     dbConnection.close();
 
     deleteFile(OUTDIR, "signons-v2v3.sqlite");
 
 
     /* ========== 7 ========== */
     testnum++;
     testdesc = "Test upgrade from v3->v4 storage";