Bug 1251916 - Use standard JavaScript features in toolkit/components/passwordmgr to pass eslint checks: general, simple changes. r=MattN
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sun, 28 Feb 2016 14:10:55 -0800
changeset 322125 1249401fb8b0431d56ef9c96d017b13e777f3089
parent 322124 466778edc2204b9cf1db4ad4921aabeee93f24d1
child 322126 eca3aa5d534c693e362d6d5f8940f2b8030ca620
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1251916
milestone47.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 1251916 - Use standard JavaScript features in toolkit/components/passwordmgr to pass eslint checks: general, simple changes. r=MattN MozReview-Commit-ID: IdecwypP6on
toolkit/components/passwordmgr/LoginDoorhangers.jsm
toolkit/components/passwordmgr/LoginManagerContent.jsm
toolkit/components/passwordmgr/content/passwordManager.js
toolkit/components/passwordmgr/content/passwordManagerCommon.js
toolkit/components/passwordmgr/content/passwordManagerExceptions.js
toolkit/components/passwordmgr/crypto-SDR.js
toolkit/components/passwordmgr/jar.mn
toolkit/components/passwordmgr/moz.build
toolkit/components/passwordmgr/nsLoginManager.js
toolkit/components/passwordmgr/nsLoginManagerPrompter.js
toolkit/components/passwordmgr/storage-mozStorage.js
toolkit/components/passwordmgr/test/notification_common.js
toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
toolkit/components/passwordmgr/test/test_bug_627616.html
toolkit/components/passwordmgr/test/test_notifications_popup.html
toolkit/components/passwordmgr/test/test_privbrowsing_perwindowpb.html
toolkit/components/passwordmgr/test/test_prompt_async.html
toolkit/components/passwordmgr/test/unit/test_OSCrypto_win.js
toolkit/components/passwordmgr/test/unit/test_notifications.js
--- a/toolkit/components/passwordmgr/LoginDoorhangers.jsm
+++ b/toolkit/components/passwordmgr/LoginDoorhangers.jsm
@@ -42,17 +42,17 @@ this.LoginDoorhangers.FillDoorhanger = f
   });
   this.eventHandlers = [];
   for (let elementName of Object.keys(this.events)) {
     let handlers = this.events[elementName];
     for (let eventName of Object.keys(handlers)) {
       let handler = handlers[eventName];
       this.eventHandlers.push([elementName, eventName, handler.bind(this)]);
     }
-  };
+  }
   for (let name of Object.getOwnPropertyNames(properties)) {
     this[name] = properties[name];
   }
 };
 
 this.LoginDoorhangers.FillDoorhanger.prototype = {
   /**
    * Whether the elements for this doorhanger are currently in the document.
--- a/toolkit/components/passwordmgr/LoginManagerContent.jsm
+++ b/toolkit/components/passwordmgr/LoginManagerContent.jsm
@@ -1179,17 +1179,17 @@ function UserAutoCompleteResult (aSearch
 
     if (userA < userB)
       return -1;
 
     if (userA > userB)
       return  1;
 
     return 0;
-  };
+  }
 
   this.searchString = aSearchString;
   this.logins = matchingLogins.sort(loginSort);
   this.matchCount = matchingLogins.length;
 
   if (this.matchCount > 0) {
     this.searchResult = Ci.nsIAutoCompleteResult.RESULT_SUCCESS;
     this.defaultIndex = 0;
@@ -1318,51 +1318,63 @@ var FormLikeFactory = {
     }
 
     if (aField.form) {
       return this.createFromForm(aField.form);
     }
 
     let doc = aField.ownerDocument;
     log("Created non-form FormLike for rootElement:", doc.documentElement);
+    let elements = [];
+    for (let el of doc.documentElement.querySelectorAll("input")) {
+      if (!el.form) {
+        elements.push(el);
+      }
+    }
     let formLike = {
       action: LoginUtils._getPasswordOrigin(doc.baseURI),
       autocomplete: "on",
       // Exclude elements inside the rootElement that are already in a <form> as
       // they will be handled by their own FormLike.
-      elements: [for (el of doc.documentElement.querySelectorAll("input")) if (!el.form) el],
+      elements,
       ownerDocument: doc,
       rootElement: doc.documentElement,
     };
 
     this._addToJSONProperty(formLike);
     return formLike;
   },
 
   /**
    * Add a `toJSON` property to a FormLike so logging which ends up going
    * through dump doesn't include usless garbage from DOM objects.
    */
   _addToJSONProperty(aFormLike) {
     function prettyElementOutput(aElement) {
       let idText = aElement.id ? "#" + aElement.id : "";
-      let classText = [for (className of aElement.classList) "." + className].join("");
+      let classText = "";
+      for (let className of aElement.classList) {
+        classText += "." + className;
+      }
       return `<${aElement.nodeName + idText + classText}>`;
     }
 
     Object.defineProperty(aFormLike, "toJSON", {
       value: () => {
         let cleansed = {};
         for (let key of Object.keys(aFormLike)) {
           let value = aFormLike[key];
           let cleansedValue = value;
 
           switch (key) {
             case "elements": {
-              cleansedValue = [for (element of value) prettyElementOutput(element)];
+              cleansedValue = [];
+              for (let element of value) {
+                cleansedValue.push(prettyElementOutput(element));
+              }
               break;
             }
 
             case "ownerDocument": {
               cleansedValue = {
                 location: {
                   href: value.location.href,
                 },
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -1,14 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*** =================== SAVED SIGNONS CODE =================== ***/
 
+Cu.import("resource://gre/modules/AppConstants.jsm");
+
 var kSignonBundle;
 var showingPasswords = false;
 var dateFormatter = new Intl.DateTimeFormat(undefined,
                       { day: "numeric", month: "short", year: "numeric" });
 var dateAndTimeFormatter = new Intl.DateTimeFormat(undefined,
                              { day: "numeric", month: "short", year: "numeric",
                                hour: "numeric", minute: "numeric" });
 
@@ -238,21 +240,20 @@ function FinalizeSignonDeletions(syncNee
   deletedSignons.length = 0;
 }
 
 function HandleSignonKeyPress(e) {
   // If editing is currently performed, don't do anything.
   if (signonsTree.getAttribute("editing")) {
     return;
   }
-  if (e.keyCode == KeyEvent.DOM_VK_DELETE
-#ifdef XP_MACOSX
-      || e.keyCode == KeyEvent.DOM_VK_BACK_SPACE
-#endif
-   ) {
+  if (e.keyCode == KeyEvent.DOM_VK_DELETE ||
+      (AppConstants.platform == "macosx" &&
+       e.keyCode == KeyEvent.DOM_VK_BACK_SPACE))
+  {
     DeleteSignon();
   }
 }
 
 function getColumnByName(column) {
   switch (column) {
     case "hostname":
       return document.getElementById("siteCol");
--- a/toolkit/components/passwordmgr/content/passwordManagerCommon.js
+++ b/toolkit/components/passwordmgr/content/passwordManagerCommon.js
@@ -82,17 +82,17 @@ function DeleteAllFromTree(tree, view, t
 
   // remove all items from table and place in deleted table
   for (var i=0; i<table.length; i++) {
     deletedTable[deletedTable.length] = table[i];
   }
   table.length = 0;
 
   // clear out selections
-  view.selection.select(-1); 
+  view.selection.select(-1);
 
   // update the tree view and notify the tree
   view.rowCount = 0;
 
   var box = tree.treeBoxObject;
   box.rowCountChanged(0, -deletedTable.length);
   box.invalidate();
 
--- a/toolkit/components/passwordmgr/content/passwordManagerExceptions.js
+++ b/toolkit/components/passwordmgr/content/passwordManagerExceptions.js
@@ -1,14 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /*** =================== REJECTED SIGNONS CODE =================== ***/
 
+Components.utils.import("resource://gre/modules/AppConstants.jsm");
+
 function RejectsStartup() {
   LoadRejects();
 
   let treecols = document.getElementsByTagName("treecols")[0];
   treecols.addEventListener("click", HandleTreeColumnClick.bind(null, RejectColumnSort));
 }
 
 var rejectsTreeView = {
@@ -84,21 +86,20 @@ function DeleteAllRejects() {
 function FinalizeRejectDeletions() {
   for (var r=0; r<deletedRejects.length; r++) {
     passwordmanager.setLoginSavingEnabled(deletedRejects[r].host, true);
   }
   deletedRejects.length = 0;
 }
 
 function HandleRejectKeyPress(e) {
-  if (e.keyCode == KeyEvent.DOM_VK_DELETE
-#ifdef XP_MACOSX
-      || e.keyCode == KeyEvent.DOM_VK_BACK_SPACE
-#endif
-     ) {
+  if (e.keyCode == KeyEvent.DOM_VK_DELETE ||
+      (AppConstants.platform == "macosx" &&
+       e.keyCode == KeyEvent.DOM_VK_BACK_SPACE))
+  {
     DeleteReject();
   }
 }
 
 var lastRejectSortColumn = "host";
 var lastRejectSortAscending = false;
 
 function RejectColumnSort(column) {
--- a/toolkit/components/passwordmgr/crypto-SDR.js
+++ b/toolkit/components/passwordmgr/crypto-SDR.js
@@ -7,17 +7,17 @@ const { classes: Cc, interfaces: Ci, uti
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "LoginHelper",
                                   "resource://gre/modules/LoginHelper.jsm");
 
 function LoginManagerCrypto_SDR() {
   this.init();
-};
+}
 
 LoginManagerCrypto_SDR.prototype = {
 
   classID : Components.ID("{dc6c2976-0f73-4f1f-b9ff-3d72b4e28309}"),
   QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerCrypto]),
 
   __sdrSlot : null, // PKCS#11 slot being used by the SDR.
   get _sdrSlot() {
--- a/toolkit/components/passwordmgr/jar.mn
+++ b/toolkit/components/passwordmgr/jar.mn
@@ -1,13 +1,13 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 toolkit.jar:
 %   content passwordmgr %content/passwordmgr/
     content/passwordmgr/login.xml                      (content/login.xml)
 *   content/passwordmgr/passwordManager.xul            (content/passwordManager.xul)
-*   content/passwordmgr/passwordManager.js             (content/passwordManager.js)
-*   content/passwordmgr/passwordManagerExceptions.js   (content/passwordManagerExceptions.js)
+    content/passwordmgr/passwordManager.js             (content/passwordManager.js)
+    content/passwordmgr/passwordManagerExceptions.js   (content/passwordManagerExceptions.js)
     content/passwordmgr/passwordManagerExceptions.xul  (content/passwordManagerExceptions.xul)
     content/passwordmgr/passwordManagerCommon.js       (content/passwordManagerCommon.js)
     content/passwordmgr/recipes.json                   (content/recipes.json)
--- a/toolkit/components/passwordmgr/moz.build
+++ b/toolkit/components/passwordmgr/moz.build
@@ -27,21 +27,21 @@ XPIDL_SOURCES += [
     'nsILoginMetaInfo.idl',
 ]
 
 XPIDL_MODULE = 'loginmgr'
 
 EXTRA_COMPONENTS += [
     'crypto-SDR.js',
     'nsLoginInfo.js',
+    'nsLoginManager.js',
     'nsLoginManagerPrompter.js',
 ]
 
 EXTRA_PP_COMPONENTS += [
-    'nsLoginManager.js',
     'passwordmgr.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'InsecurePasswordUtils.jsm',
     'LoginHelper.jsm',
     'LoginManagerContent.jsm',
     'LoginManagerParent.jsm',
--- a/toolkit/components/passwordmgr/nsLoginManager.js
+++ b/toolkit/components/passwordmgr/nsLoginManager.js
@@ -1,16 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
 
+Cu.import("resource://gre/modules/AppConstants.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.import("resource://gre/modules/LoginManagerContent.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
                                   "resource://gre/modules/Promise.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task",
@@ -102,21 +103,22 @@ LoginManager.prototype = {
       this._initStorage();
     }
 
     Services.obs.addObserver(this._observer, "gather-telemetry", false);
   },
 
 
   _initStorage : function () {
-#ifdef ANDROID
-    var contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
-#else
-    var contractID = "@mozilla.org/login-manager/storage/json;1";
-#endif
+    var contractID;
+    if (AppConstants.platform == "android") {
+      contractID = "@mozilla.org/login-manager/storage/mozStorage;1";
+    } else {
+      contractID = "@mozilla.org/login-manager/storage/json;1";
+    }
     try {
       var catMan = Cc["@mozilla.org/categorymanager;1"].
                    getService(Ci.nsICategoryManager);
       contractID = catMan.getCategoryEntry("login-manager-storage",
                                            "nsILoginManagerStorage");
       log("Found alternate nsILoginManagerStorage with contract ID:", contractID);
     } catch (e) {
       log("No alternate nsILoginManagerStorage registered");
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -608,27 +608,27 @@ 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 + ")");
 
-        var notifyObj = this._getPopupNote() || notifyBox;
+        let notifyObj = this._getPopupNote() || notifyBox;
         if (notifyObj)
           this._showSaveLoginNotification(notifyObj, newLogin);
         else
           this._pwmgr.addLogin(newLogin);
 
       } else if (password != selectedLogin.password) {
 
         this.log("Updating password for " + username +
                  " @ " + hostname + " (" + httpRealm + ")");
-        var notifyObj = this._getPopupNote() || notifyBox;
+        let notifyObj = this._getPopupNote() || notifyBox;
         if (notifyObj)
           this._showChangeLoginNotification(notifyObj,
                                             selectedLogin, newLogin);
         else
           this._updateLogin(selectedLogin, newLogin);
       } else {
         this.log("Login unchanged, no further action needed.");
         this._updateLogin(selectedLogin);
--- a/toolkit/components/passwordmgr/storage-mozStorage.js
+++ b/toolkit/components/passwordmgr/storage-mozStorage.js
@@ -38,17 +38,17 @@ Transaction.prototype = {
 
   rollback : function() {
     if (this._hasTransaction)
       this._db.rollbackTransaction();
   },
 };
 
 
-function LoginManagerStorage_mozStorage() { };
+function LoginManagerStorage_mozStorage() { }
 
 LoginManagerStorage_mozStorage.prototype = {
 
   classID : Components.ID("{8c2023b9-175c-477e-9761-44ae7b549756}"),
   QueryInterface : XPCOMUtils.generateQI([Ci.nsILoginManagerStorage,
                                           Ci.nsIInterfaceRequestor]),
   getInterface : function(aIID) {
     if (aIID.equals(Ci.nsIVariant)) {
--- a/toolkit/components/passwordmgr/test/notification_common.js
+++ b/toolkit/components/passwordmgr/test/notification_common.js
@@ -85,26 +85,26 @@ const kDontChangeButton = 1;
 
 function dumpNotifications() {
   try {
     // PopupNotifications
     var container = getPopupNotifications(window.top);
     ok(true, "is popup panel open? " + container.isPanelOpen);
     var notes = container._currentNotifications;
     ok(true, "Found " + notes.length + " popup notifications.");
-    for (var i = 0; i < notes.length; i++) {
+    for (let i = 0; i < notes.length; i++) {
         ok(true, "#" + i + ": " + notes[i].id);
     }
 
     // Notification bars
     var chromeWin = SpecialPowers.wrap(window.top)
                            .QueryInterface(Ci.nsIInterfaceRequestor)
                            .getInterface(Ci.nsIWebNavigation)
                            .QueryInterface(Ci.nsIDocShell)
                            .chromeEventHandler.ownerDocument.defaultView;
     var nb = chromeWin.getNotificationBox(window.top);
-    var notes = nb.allNotifications;
+    notes = nb.allNotifications;
     ok(true, "Found " + notes.length + " notification bars.");
-    for (var i = 0; i < notes.length; i++) {
+    for (let i = 0; i < notes.length; i++) {
         ok(true, "#" + i + ": " + notes[i].getAttribute("value"));
     }
   } catch(e) { todo(false, "WOAH! " + e); }
 }
--- a/toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
+++ b/toolkit/components/passwordmgr/test/test_basic_form_autocomplete.html
@@ -712,17 +712,17 @@ function* runTest() {
   checkACForm("", "");
 
   // Insert a new username field into the form. We'll then make sure
   // that invoking the autocomplete doesn't try to fill the form.
   var newField = document.createElement("input");
   newField.setAttribute("type", "text");
   newField.setAttribute("name", "uname2");
   pword.parentNode.insertBefore(newField, pword);
-  is($_(7, "uname2").value, "", "Verifying empty uname2");;
+  is($_(7, "uname2").value, "", "Verifying empty uname2");
 
   // Delete login6B. It was created just to prevent filling in a login
   // automatically, removing it makes it more likely that we'll catch a
   // future regression with form filling here.
   pwmgr.removeLogin(login6B);
 
   // Trigger autocomplete popup
   restoreForm();
@@ -734,17 +734,17 @@ function* runTest() {
   doKey("down");
   checkACForm("", ""); // value shouldn't update
   doKey("return"); // not "enter"!
   // The form changes, so we expect the old username field to get the
   // selected autocomplete value, but neither the new username field nor
   // the password field should have any values filled in.
   yield spinEventLoop();
   checkACForm("form7user1", "");
-  is($_(7, "uname2").value, "", "Verifying empty uname2");;
+  is($_(7, "uname2").value, "", "Verifying empty uname2");
   restoreForm(); // clear field, so reloading test doesn't fail
 
   pwmgr.removeLogin(login6A);
   testNum = 599;
   yield runNextTest();
 
   /* test 600 */
   // Turn our attention to form8
--- a/toolkit/components/passwordmgr/test/test_bug_627616.html
+++ b/toolkit/components/passwordmgr/test/test_bug_627616.html
@@ -60,17 +60,17 @@
 
         login2 = Cc["@mozilla.org/login-manager/loginInfo;1"].createInstance(Ci.nsILoginInfo);
         login2.init("http://mochi.test:8888", null, "mochirealm", "user1name", "user1pass", "", "");
         pwmgr.addLogin(login2);
         startCallbackTimer();
     }
     function cleanup() {
         var pwmgr = Cc["@mozilla.org/login-manager;1"].getService(Ci.nsILoginManager);
-        pwmgr.removeLogin(login);        
+        pwmgr.removeLogin(login);
         pwmgr.removeLogin(login2);
         timer.cancel();
     }
 
     function makeXHR(expectedStatus, expectedText, extra) {
       var xhr =  new XMLHttpRequest();
       xhr.open("GET", "authenticate.sjs?" +
                       "proxy_user=proxy_user&" +
--- a/toolkit/components/passwordmgr/test/test_notifications_popup.html
+++ b/toolkit/components/passwordmgr/test/test_notifications_popup.html
@@ -56,17 +56,17 @@ PasswordMgrObserver = {
       if (data == "removeLogin")
           return;
       runNextTest();
   },
 };
 
 // Remember, Never for This Site, Not Now
 function checkTest() {
-    var popup, login, logins;
+    var popup, login, logins, popupWin, popupNotificationsInPopup;
 
     switch(testNum) {
 
       case 1:
         popup = getPopup(popupNotifications, "password-save");
         ok(popup, "got notification popup");
         // Sanity check, no logins should exist yet.
         logins = pwmgr.getAllLogins();
@@ -100,37 +100,37 @@ function checkTest() {
         ok(login.timeCreated < login.timeLastUsed, "timeLastUsed bumped");
         ok(login.timeLastUsed == login.timePasswordChanged, "timeUsed == timeChanged");
 
         login1.password = "pass2";
         pwmgr.removeLogin(login1);
         login1.password = "notifyp1";
 
         // password-save with chrome visible
-        var popupWin = iframe.contentWindow.popupWin;
+        popupWin = iframe.contentWindow.popupWin;
         ok(popupWin, "Check popupWin is accessible");
-        var popupNotificationsInPopup = getPopupNotifications(popupWin);
+        popupNotificationsInPopup = getPopupNotifications(popupWin);
         ok(popupNotificationsInPopup, "Got popupNotificationsInPopup");
         popup = getPopup(popupNotificationsInPopup, "password-save");
         ok(popup, "got notification popup");
         clickPopupButton(popup, kRememberButton);
         popupWin.close();
         break;
 
       case 4:
         // Check result of clicking kRememberButton
         logins = pwmgr.getAllLogins();
         is(logins.length, 1, "Should only have 1 login now");
         login = SpecialPowers.wrap(logins[0]).QueryInterface(Ci.nsILoginMetaInfo);
         ok(login.timesUsed, 1, "Check times used on new entry");
 
         // password-change with chrome visible
-        var popupWin = iframe.contentWindow.popupWin;
+        popupWin = iframe.contentWindow.popupWin;
         ok(popupWin, "Check popupWin is accessible");
-        var popupNotificationsInPopup = getPopupNotifications(popupWin);
+        popupNotificationsInPopup = getPopupNotifications(popupWin);
         ok(popupNotificationsInPopup, "Got popupNotificationsInPopup");
         popup = getPopup(popupNotificationsInPopup, "password-change");
         ok(popup, "got notification popup");
         clickPopupButton(popup, kChangeButton);
         popupWin.close();
         break;
 
       case 5:
--- a/toolkit/components/passwordmgr/test/test_privbrowsing_perwindowpb.html
+++ b/toolkit/components/passwordmgr/test/test_privbrowsing_perwindowpb.html
@@ -105,16 +105,18 @@ function loadNextTest() {
   }
 
   ok(true, "Starting test #" + testNum);
   iframe.src = prefix + subtests[testNum-1];
 }
 
 function checkTest() {
   var popup;
+  var gotUser;
+  var gotPass;
 
   switch (testNum) {
     case 1:
       // run outside of private mode, popup notification should appear
       popup = getPopup(popupNotifications, "password-save");
       ok(popup, "got popup notification");
       popup.remove();
       break;
@@ -150,42 +152,42 @@ function checkTest() {
       popup = getPopup(popupNotifications, "password-change");
       ok(popup, "got popup notification");
       popup.remove();
       pwmgr.removeLogin(login);
       break;
 
     case 7:
       // verify that the user/pass pair was autofilled
-      var gotUser = iframe.contentDocument.getElementById("user").textContent;
-      var gotPass = iframe.contentDocument.getElementById("pass").textContent;
+      gotUser = iframe.contentDocument.getElementById("user").textContent;
+      gotPass = iframe.contentDocument.getElementById("pass").textContent;
       is(gotUser, "notifyu1", "Checking submitted username");
       is(gotPass, "notifyp1", "Checking submitted password");
       break;
 
     case 8:
       // verify that the user/pass pair was not autofilled
-      var gotUser = iframe.contentDocument.getElementById("user").textContent;
-      var gotPass = iframe.contentDocument.getElementById("pass").textContent;
+      gotUser = iframe.contentDocument.getElementById("user").textContent;
+      gotPass = iframe.contentDocument.getElementById("pass").textContent;
       is(gotUser, "", "Checking submitted username");
       is(gotPass, "", "Checking submitted password");
       break;
 
     case 9:
       // verify that the user/pass pair was available for autocomplete
-      var gotUser = iframe.contentDocument.getElementById("user").textContent;
-      var gotPass = iframe.contentDocument.getElementById("pass").textContent;
+      gotUser = iframe.contentDocument.getElementById("user").textContent;
+      gotPass = iframe.contentDocument.getElementById("pass").textContent;
       is(gotUser, "notifyu1", "Checking submitted username");
       is(gotPass, "notifyp1", "Checking submitted password");
       break;
 
     case 10:
       // verify that the user/pass pair was autofilled
-      var gotUser = iframe.contentDocument.getElementById("user").textContent;
-      var gotPass = iframe.contentDocument.getElementById("pass").textContent;
+      gotUser = iframe.contentDocument.getElementById("user").textContent;
+      gotPass = iframe.contentDocument.getElementById("pass").textContent;
       is(gotUser, "notifyu1", "Checking submitted username");
       is(gotPass, "notifyp1", "Checking submitted password");
       pwmgr.removeLogin(login);
       break;
 
     default:
       ok(false, "Unexpected call to checkTest for test #" + testNum);
 
--- a/toolkit/components/passwordmgr/test/test_prompt_async.html
+++ b/toolkit/components/passwordmgr/test/test_prompt_async.html
@@ -417,24 +417,27 @@
                 startCallbackTimer();
         }
 
         function doCheck(testNum)
         {
             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 (testNum)
             {
                 case 1:
                     ok(true, "doCheck testNum 1");
                     is(monitor.windowsRegistered, 3, "Registered 3 open dialogs");
 
-                    var authok1 = iframe1Doc.getElementById("ok").textContent;
-                    var proxyok1 = iframe1Doc.getElementById("proxy").textContent;
+                    authok1 = iframe1Doc.getElementById("ok").textContent;
+                    proxyok1 = iframe1Doc.getElementById("proxy").textContent;
 
                     var authok2a = iframe2aDoc.getElementById("ok").textContent;
                     var proxyok2a = iframe2aDoc.getElementById("proxy").textContent;
 
                     var authok2b = iframe2bDoc.getElementById("ok").textContent;
                     var proxyok2b = iframe2bDoc.getElementById("proxy").textContent;
 
                     is(authok1, "PASS", "WWW Authorization OK, frame1");
@@ -470,63 +473,63 @@
 
                     // ensure that the page content is not displayed on failed proxy auth
                     is(iframe1Doc.getElementById("ok"), null, "frame did not load");
                     break;
 
                 case 4:
                     ok(true, "doCheck testNum 4");
                     is(monitor.windowsRegistered, 2, "Registered 2 open dialogs");
-                    var authok1 = iframe1Doc.getElementById("ok").textContent;
-                    var proxyok1 = iframe1Doc.getElementById("proxy").textContent;
+                    authok1 = iframe1Doc.getElementById("ok").textContent;
+                    proxyok1 = iframe1Doc.getElementById("proxy").textContent;
 
                     is(authok1, "FAIL", "WWW Authorization FAILED, frame1");
                     is(proxyok1, "PASS", "Proxy Authorization OK, frame1");
                     break;
 
                 case 5:
                     ok(true, "doCheck testNum 5");
                     is(monitor.windowsRegistered, 1, "Registered 1 open dialog");
 
                     // ensure that the page content is not displayed on failed proxy auth
                     is(iframe1Doc.getElementById("footnote"), null, "frame did not load");
                     break;
 
                 case 6:
                     ok(true, "doCheck testNum 6");
                     is(monitor.windowsRegistered, 2, "Registered 2 open dialogs");
-                    var authok1 = iframe1Doc.getElementById("ok").textContent;
-                    var proxyok1 = iframe1Doc.getElementById("proxy").textContent;
-                    var footnote = iframe1Doc.getElementById("footnote").textContent;
+                    authok1 = iframe1Doc.getElementById("ok").textContent;
+                    proxyok1 = iframe1Doc.getElementById("proxy").textContent;
+                    footnote = iframe1Doc.getElementById("footnote").textContent;
 
                     is(authok1, "FAIL", "WWW Authorization FAILED, frame1");
                     is(proxyok1, "PASS", "Proxy Authorization OK, frame1");
                     is(footnote, "This is a footnote after the huge content fill",
                         "Footnote present and loaded completely");
                     break;
 
                 case 7:
                     ok(true, "doCheck testNum 7");
                     is(monitor.windowsRegistered, 1, "Registered 1 open dialogs");
-                    var authok1 = iframe1Doc.getElementById("ok").textContent;
-                    var proxyok1 = iframe1Doc.getElementById("proxy").textContent;
-                    var footnote = iframe1Doc.getElementById("footnote").textContent;
+                    authok1 = iframe1Doc.getElementById("ok").textContent;
+                    proxyok1 = iframe1Doc.getElementById("proxy").textContent;
+                    footnote = iframe1Doc.getElementById("footnote").textContent;
 
                     is(authok1, "PASS", "WWW Authorization OK, frame1");
                     is(proxyok1, "PASS", "Proxy Authorization OK, frame1");
                     is(footnote, "This is a footnote after the huge content fill",
                         "Footnote present and loaded completely");
                     break;
 
                 case 8:
                     ok(true, "doCheck testNum 8");
                     is(monitor.windowsRegistered, 5, "Registered 5 open dialogs");
-                    var authok1 = iframe1Doc.getElementById("ok").textContent;
-                    var proxyok1 = iframe1Doc.getElementById("proxy").textContent;
-                    var footnote = iframe1Doc.getElementById("footnote").textContent;
+                    authok1 = iframe1Doc.getElementById("ok").textContent;
+                    proxyok1 = iframe1Doc.getElementById("proxy").textContent;
+                    footnote = iframe1Doc.getElementById("footnote").textContent;
 
                     is(authok1, "PASS", "WWW Authorization OK, frame1");
                     is(proxyok1, "PASS", "Proxy Authorization OK, frame1");
                     is(footnote, "This is a footnote after the huge content fill",
                         "Footnote present and loaded completely");
                     break;
 
                 default:
--- a/toolkit/components/passwordmgr/test/unit/test_OSCrypto_win.js
+++ b/toolkit/components/passwordmgr/test/unit/test_OSCrypto_win.js
@@ -1,77 +1,77 @@
-/**
- * Tests the OSCrypto object.
- */
-
-"use strict";
-
-////////////////////////////////////////////////////////////////////////////////
-//// Globals
-
-XPCOMUtils.defineLazyModuleGetter(this,  "OSCrypto",
-                                  "resource://gre/modules/OSCrypto.jsm");
-
-var crypto = new OSCrypto();
-
-////////////////////////////////////////////////////////////////////////////////
-//// Tests
-
-add_task(function test_getIELoginHash()
-{
-  do_check_eq(crypto.getIELoginHash("https://bugzilla.mozilla.org/page.cgi"),
-                                    "4A66FE96607885790F8E67B56EEE52AB539BAFB47D");
-
-  do_check_eq(crypto.getIELoginHash("https://github.com/login"),
-                                    "0112F7DCE67B8579EA01367678AA44AB9868B5A143");
-
-  do_check_eq(crypto.getIELoginHash("https://login.live.com/login.srf"),
-                                    "FBF92E5D804C82717A57856533B779676D92903688");
-
-  do_check_eq(crypto.getIELoginHash("https://preview.c9.io/riadh/w1/pass.1.html"),
-                                    "6935CF27628830605927F86AB53831016FC8973D1A");
-
-
-  do_check_eq(crypto.getIELoginHash("https://reviewboard.mozilla.org/account/login/"),
-                                    "09141FD287E2E59A8B1D3BB5671537FD3D6B61337A");
-
-  do_check_eq(crypto.getIELoginHash("https://www.facebook.com/"),
-                                    "EF44D3E034009CB0FD1B1D81A1FF3F3335213BD796");
-
-});
-
-add_task(function test_decryptData_encryptData()
-{
-  function decryptEncryptTest(key) {
-    do_check_eq(crypto.decryptData(crypto.encryptData("", key), key),
-                "");
-
-    do_check_eq(crypto.decryptData(crypto.encryptData("secret", key), key),
-                "secret");
-
-    do_check_eq(crypto.decryptData(crypto.encryptData("https://www.mozilla.org", key),
-                                   key),
-                "https://www.mozilla.org");
-
-    do_check_eq(crypto.decryptData(crypto.encryptData("https://reviewboard.mozilla.org", key),
-                                   key),
-                "https://reviewboard.mozilla.org");
-
-    do_check_eq(crypto.decryptData(crypto.encryptData("https://bugzilla.mozilla.org/page.cgi",
-                                                      key),
-                                   key),
-                "https://bugzilla.mozilla.org/page.cgi");
-  }
-
-  let keys = [null, "a", "keys", "abcdedf", "pass", "https://bugzilla.mozilla.org/page.cgi",
-              "https://login.live.com/login.srf"];
-  for (let key of keys) {
-    decryptEncryptTest(key);
-  }
-  let url = "https://twitter.com/";
-  let value = [1, 0, 0, 0, 208, 140, 157, 223, 1, 21, 209, 17, 140, 122, 0, 192, 79, 194, 151, 235, 1, 0, 0, 0, 254, 58, 230, 75, 132, 228, 181, 79, 184, 160, 37, 106, 201, 29, 42, 152, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 16, 102, 0, 0, 0, 1, 0, 0, 32, 0, 0, 0, 90, 136, 17, 124, 122, 57, 178, 24, 34, 86, 209, 198, 184, 107, 58, 58, 32, 98, 61, 239, 129, 101, 56, 239, 114, 159, 139, 165, 183, 40, 183, 85, 0, 0, 0, 0, 14, 128, 0, 0, 0, 2, 0, 0, 32, 0, 0, 0, 147, 170, 34, 21, 53, 227, 191, 6, 201, 84, 106, 31, 57, 227, 46, 127, 219, 199, 80, 142, 37, 104, 112, 223, 26, 165, 223, 55, 176, 89, 55, 37, 112, 0, 0, 0, 98, 70, 221, 109, 5, 152, 46, 11, 190, 213, 226, 58, 244, 20, 180, 217, 63, 155, 227, 132, 7, 151, 235, 6, 37, 232, 176, 182, 141, 191, 251, 50, 20, 123, 53, 11, 247, 233, 112, 121, 130, 27, 168, 68, 92, 144, 192, 7, 12, 239, 53, 217, 253, 155, 54, 109, 236, 216, 225, 245, 79, 234, 165, 225, 104, 36, 77, 13, 195, 237, 143, 165, 100, 107, 230, 70, 54, 19, 179, 35, 8, 101, 93, 202, 121, 210, 222, 28, 93, 122, 36, 84, 185, 249, 238, 3, 102, 149, 248, 94, 137, 16, 192, 22, 251, 220, 22, 223, 16, 58, 104, 187, 64, 0, 0, 0, 70, 72, 15, 119, 144, 66, 117, 203, 190, 82, 131, 46, 111, 130, 238, 191, 170, 63, 186, 117, 46, 88, 171, 3, 94, 146, 75, 86, 243, 159, 63, 195, 149, 25, 105, 141, 42, 217, 108, 18, 63, 62, 98, 182, 241, 195, 12, 216, 152, 230, 176, 253, 202, 129, 41, 185, 135, 111, 226, 92, 27, 78, 27, 198];
-
-  let arr1 = crypto.arrayToString(value)
-  let arr2 = crypto.stringToArray(crypto.decryptData(crypto.encryptData(arr1, url), url));
-  for(let i = 0; i < arr1.length; i++) {
-    do_check_eq(arr2[i], value[i]);
-  }
-});
+/**
+ * Tests the OSCrypto object.
+ */
+
+"use strict";
+
+////////////////////////////////////////////////////////////////////////////////
+//// Globals
+
+XPCOMUtils.defineLazyModuleGetter(this,  "OSCrypto",
+                                  "resource://gre/modules/OSCrypto.jsm");
+
+var crypto = new OSCrypto();
+
+////////////////////////////////////////////////////////////////////////////////
+//// Tests
+
+add_task(function test_getIELoginHash()
+{
+  do_check_eq(crypto.getIELoginHash("https://bugzilla.mozilla.org/page.cgi"),
+                                    "4A66FE96607885790F8E67B56EEE52AB539BAFB47D");
+
+  do_check_eq(crypto.getIELoginHash("https://github.com/login"),
+                                    "0112F7DCE67B8579EA01367678AA44AB9868B5A143");
+
+  do_check_eq(crypto.getIELoginHash("https://login.live.com/login.srf"),
+                                    "FBF92E5D804C82717A57856533B779676D92903688");
+
+  do_check_eq(crypto.getIELoginHash("https://preview.c9.io/riadh/w1/pass.1.html"),
+                                    "6935CF27628830605927F86AB53831016FC8973D1A");
+
+
+  do_check_eq(crypto.getIELoginHash("https://reviewboard.mozilla.org/account/login/"),
+                                    "09141FD287E2E59A8B1D3BB5671537FD3D6B61337A");
+
+  do_check_eq(crypto.getIELoginHash("https://www.facebook.com/"),
+                                    "EF44D3E034009CB0FD1B1D81A1FF3F3335213BD796");
+
+});
+
+add_task(function test_decryptData_encryptData()
+{
+  function decryptEncryptTest(key) {
+    do_check_eq(crypto.decryptData(crypto.encryptData("", key), key),
+                "");
+
+    do_check_eq(crypto.decryptData(crypto.encryptData("secret", key), key),
+                "secret");
+
+    do_check_eq(crypto.decryptData(crypto.encryptData("https://www.mozilla.org", key),
+                                   key),
+                "https://www.mozilla.org");
+
+    do_check_eq(crypto.decryptData(crypto.encryptData("https://reviewboard.mozilla.org", key),
+                                   key),
+                "https://reviewboard.mozilla.org");
+
+    do_check_eq(crypto.decryptData(crypto.encryptData("https://bugzilla.mozilla.org/page.cgi",
+                                                      key),
+                                   key),
+                "https://bugzilla.mozilla.org/page.cgi");
+  }
+
+  let keys = [null, "a", "keys", "abcdedf", "pass", "https://bugzilla.mozilla.org/page.cgi",
+              "https://login.live.com/login.srf"];
+  for (let key of keys) {
+    decryptEncryptTest(key);
+  }
+  let url = "https://twitter.com/";
+  let value = [1, 0, 0, 0, 208, 140, 157, 223, 1, 21, 209, 17, 140, 122, 0, 192, 79, 194, 151, 235, 1, 0, 0, 0, 254, 58, 230, 75, 132, 228, 181, 79, 184, 160, 37, 106, 201, 29, 42, 152, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 16, 102, 0, 0, 0, 1, 0, 0, 32, 0, 0, 0, 90, 136, 17, 124, 122, 57, 178, 24, 34, 86, 209, 198, 184, 107, 58, 58, 32, 98, 61, 239, 129, 101, 56, 239, 114, 159, 139, 165, 183, 40, 183, 85, 0, 0, 0, 0, 14, 128, 0, 0, 0, 2, 0, 0, 32, 0, 0, 0, 147, 170, 34, 21, 53, 227, 191, 6, 201, 84, 106, 31, 57, 227, 46, 127, 219, 199, 80, 142, 37, 104, 112, 223, 26, 165, 223, 55, 176, 89, 55, 37, 112, 0, 0, 0, 98, 70, 221, 109, 5, 152, 46, 11, 190, 213, 226, 58, 244, 20, 180, 217, 63, 155, 227, 132, 7, 151, 235, 6, 37, 232, 176, 182, 141, 191, 251, 50, 20, 123, 53, 11, 247, 233, 112, 121, 130, 27, 168, 68, 92, 144, 192, 7, 12, 239, 53, 217, 253, 155, 54, 109, 236, 216, 225, 245, 79, 234, 165, 225, 104, 36, 77, 13, 195, 237, 143, 165, 100, 107, 230, 70, 54, 19, 179, 35, 8, 101, 93, 202, 121, 210, 222, 28, 93, 122, 36, 84, 185, 249, 238, 3, 102, 149, 248, 94, 137, 16, 192, 22, 251, 220, 22, 223, 16, 58, 104, 187, 64, 0, 0, 0, 70, 72, 15, 119, 144, 66, 117, 203, 190, 82, 131, 46, 111, 130, 238, 191, 170, 63, 186, 117, 46, 88, 171, 3, 94, 146, 75, 86, 243, 159, 63, 195, 149, 25, 105, 141, 42, 217, 108, 18, 63, 62, 98, 182, 241, 195, 12, 216, 152, 230, 176, 253, 202, 129, 41, 185, 135, 111, 226, 92, 27, 78, 27, 198];
+
+  let arr1 = crypto.arrayToString(value)
+  let arr2 = crypto.stringToArray(crypto.decryptData(crypto.encryptData(arr1, url), url));
+  for(let i = 0; i < arr1.length; i++) {
+    do_check_eq(arr2[i], value[i]);
+  }
+});
--- a/toolkit/components/passwordmgr/test/unit/test_notifications.js
+++ b/toolkit/components/passwordmgr/test/unit/test_notifications.js
@@ -61,18 +61,18 @@ var testuser1 = new LoginInfo("http://te
 
 var testuser2 = new LoginInfo("http://testhost2", "", null,
     "dummydude2", "itsasecret2", "put_user2_here", "put_pw2_here");
 
 Services.obs.addObserver(TestObserver, "passwordmgr-storage-changed", false);
 
 
 /* ========== 1 ========== */
-var testnum = 1;
-var testdesc = "Initial connection to storage module"
+testnum = 1;
+testdesc = "Initial connection to storage module"
 
 /* ========== 2 ========== */
 testnum++;
 testdesc = "addLogin";
 
 expectedNotification = "addLogin";
 expectedData = testuser1;
 Services.logins.addLogin(testuser1);