Bug 1316870 - Enable no-shadow eslint rule for browser/. r=mossop
authorJared Wein <jwein@mozilla.com>
Tue, 15 Nov 2016 22:58:30 -0500
changeset 322827 602c0cfe0c921e8b0015ec4ae5fceec4f9d3c7ae
parent 322826 e8665b1b664cadbcd383e805aeaafd08dece138e
child 322828 f1ff6d4dca5fbb996a713f092de47454d8937ad9
push id21
push usermaklebus@msu.edu
push dateThu, 01 Dec 2016 06:22:08 +0000
reviewersmossop
bugs1316870
milestone53.0a1
Bug 1316870 - Enable no-shadow eslint rule for browser/. r=mossop
browser/.eslintrc.js
browser/base/content/aboutNetError.xhtml
browser/base/content/aboutaccounts/aboutaccounts.js
browser/base/content/abouthealthreport/abouthealth.js
browser/base/content/abouthome/aboutHome.js
browser/base/content/browser-addons.js
browser/base/content/browser-fxaccounts.js
browser/base/content/browser-gestureSupport.js
browser/base/content/browser-refreshblocker.js
browser/base/content/browser-syncui.js
browser/base/content/browser.js
browser/base/content/content.js
browser/base/content/pageinfo/pageInfo.js
browser/base/content/sync/setup.js
browser/base/content/tabbrowser.xml
browser/base/content/test/alerts/browser_notification_close.js
browser/base/content/test/alerts/browser_notification_tab_switching.js
browser/base/content/test/alerts/head.js
browser/base/content/test/newtab/head.js
browser/base/content/test/plugins/browser_pageInfo_plugins.js
browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
browser/base/content/test/plugins/browser_pluginnotification.js
browser/base/content/test/plugins/head.js
browser/base/content/test/popupNotifications/browser_popupNotification_4.js
browser/base/content/test/popupNotifications/head.js
browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab.js
browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab3.js
browser/base/content/test/social/browser_aboutHome_activation.js
browser/base/content/test/social/head.js
browser/base/content/test/urlbar/browser_URLBarSetURI.js
browser/base/content/test/urlbar/browser_action_searchengine.js
browser/base/content/test/urlbar/browser_action_searchengine_alias.js
browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
browser/base/content/test/urlbar/browser_locationBarExternalLoad.js
browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
browser/base/content/test/urlbar/browser_urlbarCopying.js
browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
browser/base/content/test/urlbar/browser_urlbarOneOffs.js
browser/base/content/test/urlbar/browser_urlbar_remoteness_switch.js
browser/base/content/test/urlbar/head.js
browser/base/content/test/webrtc/browser_devices_get_user_media.js
browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js
browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
browser/base/content/test/webrtc/get_user_media_content_script.js
browser/base/content/test/webrtc/head.js
browser/base/content/urlbarBindings.xml
browser/components/contextualidentity/test/browser/browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js
browser/components/contextualidentity/test/browser/browser_middleClick.js
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/CustomizableWidgets.jsm
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/test/browser_947987_removable_default.js
browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
browser/components/customizableui/test/browser_987492_window_api.js
browser/components/customizableui/test/head.js
browser/components/feeds/WebContentConverter.js
browser/components/nsBrowserGlue.js
browser/components/originattributes/test/browser/browser_blobURLIsolation.js
browser/components/originattributes/test/browser/browser_cookieIsolation.js
browser/components/originattributes/test/browser/browser_localStorageIsolation.js
browser/components/originattributes/test/browser/worker_blobify.js
browser/components/originattributes/test/browser/worker_deblobify.js
browser/components/places/PlacesUIUtils.jsm
browser/components/places/content/controller.js
browser/components/places/content/editBookmarkOverlay.js
browser/components/places/content/menu.xml
browser/components/places/content/places.js
browser/components/places/content/tree.xml
browser/components/places/content/treeView.js
browser/components/places/tests/browser/browser_410196_paste_into_tags.js
browser/components/places/tests/browser/browser_bookmarkProperties_addLivemark.js
browser/components/places/tests/browser/browser_bookmarksProperties.js
browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
browser/components/places/tests/browser/browser_library_batch_delete.js
browser/components/places/tests/browser/browser_library_infoBox.js
browser/components/places/tests/browser/browser_sort_in_library.js
browser/components/places/tests/browser/browser_views_liveupdate.js
browser/components/places/tests/browser/head.js
browser/components/preferences/in-content/applications.js
browser/components/preferences/in-content/sync.js
browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
browser/components/preferences/in-content/tests/browser_defaultbrowser_alwayscheck.js
browser/components/preferences/in-content/tests/browser_subdialogs.js
browser/components/search/test/browser_aboutSearchReset.js
browser/components/search/test/browser_amazon_behavior.js
browser/components/search/test/browser_bing_behavior.js
browser/components/search/test/browser_google_behavior.js
browser/components/search/test/browser_healthreport.js
browser/components/search/test/browser_searchbar_keyboard_navigation.js
browser/components/search/test/browser_searchbar_openpopup.js
browser/components/search/test/browser_searchbar_smallpanel_keyboard_navigation.js
browser/components/search/test/browser_yahoo_behavior.js
browser/components/tests/browser/browser_bug538331.js
browser/components/translation/Translation.jsm
browser/components/translation/test/browser_translation_exceptions.js
browser/components/uitour/test/browser_UITour.js
browser/components/uitour/test/browser_UITour2.js
browser/components/uitour/test/browser_UITour_detach_tab.js
browser/components/uitour/test/browser_UITour_heartbeat.js
browser/components/uitour/test/head.js
browser/experiments/Experiments.jsm
browser/extensions/pocket/content/main.js
browser/modules/LaterRun.jsm
browser/modules/PluginContent.jsm
browser/modules/test/browser_NetworkPrioritizer.js
browser/modules/test/browser_UnsubmittedCrashHandler.js
browser/modules/test/head.js
browser/modules/webrtcUI.jsm
--- a/browser/.eslintrc.js
+++ b/browser/.eslintrc.js
@@ -5,11 +5,12 @@ module.exports = {
     "../toolkit/.eslintrc.js"
   ],
 
   "rules": {
     "no-unused-vars": ["error", {
       "vars": "local",
       "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
       "args": "none",
-    }]
+    }],
+    "no-shadow": "error"
   }
 };
--- a/browser/base/content/aboutNetError.xhtml
+++ b/browser/base/content/aboutNetError.xhtml
@@ -254,17 +254,17 @@
         var ld = document.getElementById("errorLongDesc");
         if (ld)
         {
           ld.innerHTML = errDesc.innerHTML;
         }
 
         if (err == "sslv3Used") {
           document.getElementById("learnMoreContainer").style.display = "block";
-          var learnMoreLink = document.getElementById("learnMoreLink");
+          let learnMoreLink = document.getElementById("learnMoreLink");
           learnMoreLink.href = "https://support.mozilla.org/kb/how-resolve-sslv3-error-messages-firefox";
           document.body.className = "certerror";
         }
 
         if (err == "weakCryptoUsed") {
           document.body.className = "certerror";
         }
 
@@ -300,17 +300,17 @@
           // almost certainly useless. (Bug 553180)
           document.getElementById("netErrorButtonContainer").style.display = "none";
         }
 
         window.addEventListener("AboutNetErrorOptions", function(evt) {
         // Pinning errors are of type nssFailure2
           if (getErrorCode() == "nssFailure2" || getErrorCode() == "weakCryptoUsed") {
             document.getElementById("learnMoreContainer").style.display = "block";
-            var learnMoreLink = document.getElementById("learnMoreLink");
+            let learnMoreLink = document.getElementById("learnMoreLink");
             // nssFailure2 also gets us other non-overrideable errors. Choose
             // a "learn more" link based on description:
             if (getDescription().includes("mozilla_pkix_error_key_pinning_failure")) {
               learnMoreLink.href = "https://support.mozilla.org/kb/certificate-pinning-reports";
             }
             if (getErrorCode() == "weakCryptoUsed") {
               learnMoreLink.href = "https://support.mozilla.org/kb/how-resolve-weak-crypto-error-messages-firefox";
             }
@@ -319,19 +319,20 @@
             if (options && options.enabled) {
               var checkbox = document.getElementById("automaticallyReportInFuture");
               showCertificateErrorReporting();
               if (options.automatic) {
                 // set the checkbox
                 checkbox.checked = true;
               }
 
-              checkbox.addEventListener("change", function(evt) {
+              checkbox.addEventListener("change", function(changeEvt) {
                   var event = new CustomEvent("AboutNetErrorSetAutomatic",
-                    {bubbles:true, detail:evt.target.checked});
+                    {bubbles: true,
+                     detail: changeEvt.target.checked});
                   document.dispatchEvent(event);
                 }, false);
             }
             const hasPrefStyleError = [
               "interrupted", // This happens with subresources that are above the max tls
               "SSL_ERROR_PROTOCOL_VERSION_ALERT",
               "SSL_ERROR_UNSUPPORTED_VERSION",
               "SSL_ERROR_NO_CYPHER_OVERLAP",
--- a/browser/base/content/aboutaccounts/aboutaccounts.js
+++ b/browser/base/content/aboutaccounts/aboutaccounts.js
@@ -24,20 +24,16 @@ const OBSERVER_TOPICS = [
   fxAccountsCommon.ONVERIFIED_NOTIFICATION,
   fxAccountsCommon.ONLOGOUT_NOTIFICATION,
 ];
 
 function log(msg) {
   // dump("FXA: " + msg + "\n");
 }
 
-function error(msg) {
-  console.log("Firefox Account Error: " + msg + "\n");
-}
-
 function getPreviousAccountNameHash() {
   try {
     return Services.prefs.getComplexValue(PREF_LAST_FXA_USER, Ci.nsISupportsString).data;
   } catch (_) {
     return "";
   }
 }
 
--- a/browser/base/content/abouthealthreport/abouthealth.js
+++ b/browser/base/content/abouthealthreport/abouthealth.js
@@ -33,20 +33,20 @@ var healthReportWrapper = {
 
   setDataSubmission: function(enabled) {
     MozSelfSupport.healthReportDataSubmissionEnabled = enabled;
     this.updatePrefState();
   },
 
   updatePrefState: function() {
     try {
-      let prefs = {
+      let prefsObj = {
         enabled: MozSelfSupport.healthReportDataSubmissionEnabled,
       };
-      healthReportWrapper.injectData("prefs", prefs);
+      healthReportWrapper.injectData("prefs", prefsObj);
     }
     catch (ex) {
       healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PREFS_FAILED);
     }
   },
 
   sendTelemetryPingList: function() {
     console.log("AboutHealthReport: Collecting Telemetry ping list.");
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -144,42 +144,42 @@ function ensureSnippetsMapThen(aCallback
     if (!db.objectStoreNames.contains(SNIPPETS_OBJECTSTORE_NAME)) {
       db.createObjectStore(SNIPPETS_OBJECTSTORE_NAME);
     }
   }
 
   openRequest.onsuccess = function(event) {
     let db = event.target.result;
 
-    db.onerror = function(event) {
+    db.onerror = function() {
       invokeCallbacks();
     }
 
-    db.onversionchange = function(event) {
-      event.target.close();
+    db.onversionchange = function(versionChangeEvent) {
+      versionChangeEvent.target.close();
       invokeCallbacks();
     }
 
     let cache = new Map();
     let cursorRequest;
     try {
       cursorRequest = db.transaction(SNIPPETS_OBJECTSTORE_NAME)
                         .objectStore(SNIPPETS_OBJECTSTORE_NAME).openCursor();
     } catch (ex) {
       console.error(ex);
       invokeCallbacks();
       return;
     }
 
-    cursorRequest.onerror = function(event) {
+    cursorRequest.onerror = function() {
       invokeCallbacks();
     }
 
-    cursorRequest.onsuccess = function(event) {
-      let cursor = event.target.result;
+    cursorRequest.onsuccess = function(cursorRequestEvent) {
+      let cursor = cursorRequestEvent.target.result;
 
       // Populate the cache from the persistent storage.
       if (cursor) {
         cache.set(cursor.key, cursor.value);
         cursor.continue();
         return;
       }
 
@@ -278,17 +278,17 @@ function loadSnippets()
                      Date.now() - lastUpdate > SNIPPETS_UPDATE_INTERVAL_MS;
   if (updateURL && shouldUpdate) {
     // Try to update from network.
     let xhr = new XMLHttpRequest();
     xhr.timeout = 5000;
     // Even if fetching should fail we don't want to spam the server, thus
     // set the last update time regardless its results.  Will retry tomorrow.
     gSnippetsMap.set("snippets-last-update", Date.now());
-    xhr.onloadend = function(event) {
+    xhr.onloadend = function() {
       if (xhr.status == 200) {
         gSnippetsMap.set("snippets", xhr.responseText);
         gSnippetsMap.set("snippets-cached-version", currentVersion);
       }
       showSnippets();
       loadCompleted();
     };
     try {
--- a/browser/base/content/browser-addons.js
+++ b/browser/base/content/browser-addons.js
@@ -127,20 +127,22 @@ const gXPInstallObserver = {
             let container = document.createElement("hbox");
 
             let name = document.createElement("label");
             name.setAttribute("value", install.addon.name);
             name.setAttribute("class", "addon-install-confirmation-name");
             container.appendChild(name);
 
             if (someUnsigned && install.addon.signedState <= AddonManager.SIGNEDSTATE_MISSING) {
-              let unsigned = document.createElement("label");
-              unsigned.setAttribute("value", gNavigatorBundle.getString("addonInstall.unsigned"));
-              unsigned.setAttribute("class", "addon-install-confirmation-unsigned");
-              container.appendChild(unsigned);
+              let unsignedLabel = document.createElement("label");
+              unsignedLabel.setAttribute("value",
+                gNavigatorBundle.getString("addonInstall.unsigned"));
+              unsignedLabel.setAttribute("class",
+                "addon-install-confirmation-unsigned");
+              container.appendChild(unsignedLabel);
             }
 
             addonList.appendChild(container);
           }
 
           this.acceptInstallation = () => {
             for (let install of installInfo.installs)
               install.install();
@@ -189,17 +191,16 @@ const gXPInstallObserver = {
     cancelButton.label = gNavigatorBundle.getString("addonInstall.cancelButton.label");
     cancelButton.accessKey = gNavigatorBundle.getString("addonInstall.cancelButton.accesskey");
 
     let acceptButton = document.getElementById("addon-install-confirmation-accept");
     acceptButton.label = gNavigatorBundle.getString("addonInstall.acceptButton.label");
     acceptButton.accessKey = gNavigatorBundle.getString("addonInstall.acceptButton.accesskey");
 
     if (height) {
-      let notification = document.getElementById("addon-install-confirmation-notification");
       notification.style.minHeight = height + "px";
     }
 
     let tab = gBrowser.getTabForBrowser(browser);
     if (tab) {
       gBrowser.selectedTab = tab;
     }
 
--- a/browser/base/content/browser-fxaccounts.js
+++ b/browser/base/content/browser-fxaccounts.js
@@ -372,20 +372,19 @@ var gFxAccounts = {
     // remove existing menu items
     while (devicesPopup.hasChildNodes()) {
       devicesPopup.removeChild(devicesPopup.firstChild);
     }
 
     const fragment = document.createDocumentFragment();
 
     const onTargetDeviceCommand = (event) => {
-      const clientId = event.target.getAttribute("clientId");
-      const clients = clientId
-                      ? [clientId]
-                      : this.remoteClients.map(client => client.id);
+      let clients = event.target.getAttribute("clientId") ?
+        [event.target.getAttribute("clientId")] :
+        this.remoteClients.map(client => client.id);
 
       clients.forEach(clientId => this.sendTabToDevice(url, clientId, title));
     }
 
     function addTargetDevice(clientId, name) {
       const targetDevice = document.createElement("menuitem");
       targetDevice.addEventListener("command", onTargetDeviceCommand, true);
       targetDevice.setAttribute("class", "sendtab-target");
--- a/browser/base/content/browser-gestureSupport.js
+++ b/browser/base/content/browser-gestureSupport.js
@@ -129,28 +129,28 @@ var gGestureSupport = {
       aPref[pref] = this._getPref(aGesture + "." + pref, def);
 
     // Keep track of the total deltas and latching behavior
     let offset = 0;
     let latchDir = aEvent.delta > 0 ? 1 : -1;
     let isLatched = false;
 
     // Create the update function here to capture closure state
-    this._doUpdate = function GS__doUpdate(aEvent) {
+    this._doUpdate = function GS__doUpdate(updateEvent) {
       // Update the offset with new event data
-      offset += aEvent.delta;
+      offset += updateEvent.delta;
 
       // Check if the cumulative deltas exceed the threshold
       if (Math.abs(offset) > aPref["threshold"]) {
         // Trigger the action if we don't care about latching; otherwise, make
         // sure either we're not latched and going the same direction of the
         // initial motion; or we're latched and going the opposite way
         let sameDir = (latchDir ^ offset) >= 0;
         if (!aPref["latched"] || (isLatched ^ sameDir)) {
-          this._doAction(aEvent, [aGesture, offset > 0 ? aInc : aDec]);
+          this._doAction(updateEvent, [aGesture, offset > 0 ? aInc : aDec]);
 
           // We must be getting latched or leaving it, so just toggle
           isLatched = !isLatched;
         }
 
         // Reset motion counter to prepare for more of the same gesture
         offset = 0;
       }
@@ -237,18 +237,18 @@ var gGestureSupport = {
 
     this._doUpdate = function GS__doUpdate(aEvent) {
       gHistorySwipeAnimation.updateAnimation(aEvent.delta);
     };
 
     this._doEnd = function GS__doEnd(aEvent) {
       gHistorySwipeAnimation.swipeEndEventReceived();
 
-      this._doUpdate = function(aEvent) {};
-      this._doEnd = function(aEvent) {};
+      this._doUpdate = function() {};
+      this._doEnd = function() {};
     }
   },
 
   /**
    * Generator producing the powerset of the input array where the first result
    * is the complete set and the last result (before StopIteration) is empty.
    *
    * @param aArray
--- a/browser/base/content/browser-refreshblocker.js
+++ b/browser/base/content/browser-refreshblocker.js
@@ -63,17 +63,17 @@ var RefreshBlocker = {
       let refreshButtonText =
         gNavigatorBundle.getString("refreshBlocked.goButton");
       let refreshButtonAccesskey =
         gNavigatorBundle.getString("refreshBlocked.goButton.accesskey");
 
       let buttons = [{
         label: refreshButtonText,
         accessKey: refreshButtonAccesskey,
-        callback: function(notification, button) {
+        callback: function() {
           if (browser.messageManager) {
             browser.messageManager.sendAsyncMessage("RefreshBlocker:Refresh", data);
           }
         }
       }];
 
       notificationBox.appendNotification(message, "refresh-blocked",
                                          "chrome://browser/skin/Info.png",
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -421,20 +421,20 @@ var gSyncUI = {
         broadcaster.removeAttribute("tooltiptext");
       }
     }
   }),
 
   formatLastSyncDate: function(date) {
     let dateFormat;
     let sixDaysAgo = (() => {
-      let date = new Date();
-      date.setDate(date.getDate() - 6);
-      date.setHours(0, 0, 0, 0);
-      return date;
+      let tempDate = new Date();
+      tempDate.setDate(tempDate.getDate() - 6);
+      tempDate.setHours(0, 0, 0, 0);
+      return tempDate;
     })();
     // It may be confusing for the user to see "Last Sync: Monday" when the last sync was a indeed a Monday but 3 weeks ago
     if (date < sixDaysAgo) {
       dateFormat = {month: 'long', day: 'numeric'};
     } else {
       dateFormat = {weekday: 'long', hour: 'numeric', minute: 'numeric'};
     }
     let lastSyncDateString = date.toLocaleDateString(undefined, dateFormat);
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -752,29 +752,29 @@ function gKeywordURIFixup({ target: brow
   // 1097347366913 (ff7f000001) gets resolved by using the final bytes,
   // making it the same as 7f000001, which is 127.0.0.1 aka localhost.
   // While 2130706433 would get normalized by network, 1097347366913
   // does not, and we have to deal with both cases here:
   if (isIPv4Address(asciiHost) || /^(?:\d+|0x[a-f0-9]+)$/i.test(asciiHost))
     return;
 
   let onLookupComplete = (request, record, status) => {
-    let browser = weakBrowser.get();
-    if (!Components.isSuccessCode(status) || !browser)
+    let browserRef = weakBrowser.get();
+    if (!Components.isSuccessCode(status) || !browserRef)
       return;
 
-    let currentURI = browser.currentURI;
+    let currentURI = browserRef.currentURI;
     // If we're in case (3) (see above), don't show an info bar.
     if (!currentURI.equals(previousURI) &&
         !currentURI.equals(preferredURI)) {
       return;
     }
 
     // show infobar offering to visit the host
-    let notificationBox = gBrowser.getNotificationBox(browser);
+    let notificationBox = gBrowser.getNotificationBox(browserRef);
     if (notificationBox.getNotificationWithValue("keyword-uri-fixup"))
       return;
 
     let message = gNavigatorBundle.getFormattedString(
       "keywordURIFixup.message", [hostName]);
     let yesMessage = gNavigatorBundle.getFormattedString(
       "keywordURIFixup.goTo", [hostName])
 
@@ -1233,17 +1233,16 @@ var gBrowserInit = {
     UpdateUrlbarSearchSplitterState();
 
     if (!(isBlankPageURL(uriToLoad) || uriToLoad == "about:privatebrowsing") ||
         !focusAndSelectUrlBar()) {
       if (gBrowser.selectedBrowser.isRemoteBrowser) {
         // If the initial browser is remote, in order to optimize for first paint,
         // we'll defer switching focus to that browser until it has painted.
         let focusedElement = document.commandDispatcher.focusedElement;
-        let mm = window.messageManager;
         mm.addMessageListener("Browser:FirstPaint", function onFirstPaint() {
           mm.removeMessageListener("Browser:FirstPaint", onFirstPaint);
           // If focus didn't move while we were waiting for first paint, we're okay
           // to move to the browser.
           if (document.commandDispatcher.focusedElement == focusedElement) {
             gBrowser.selectedBrowser.focus();
           }
         });
@@ -3588,17 +3587,17 @@ const BrowserSearch = {
     if (window.location.href != getBrowserURL()) {
       var win = getTopWin();
       if (win) {
         // If there's an open browser window, it should handle this command
         win.focus();
         win.BrowserSearch.webSearch();
       } else {
         // If there are no open browser windows, open a new one
-        var observer = function observer(subject, topic, data) {
+        var observer = function(subject, topic, data) {
           if (subject == win) {
             BrowserSearch.webSearch();
             Services.obs.removeObserver(observer, "browser-delayed-startup-finished");
           }
         }
         win = window.openDialog(getBrowserURL(), "_blank",
                                 "chrome,all,dialog=no", "about:blank");
         Services.obs.addObserver(observer, "browser-delayed-startup-finished", false);
@@ -4489,34 +4488,34 @@ var XULBrowserWindow = {
 
       SocialUI.updateState();
 
       UITour.onLocationChange(location);
 
       gTabletModePageCounter.inc();
 
       // Utility functions for disabling find
-      var shouldDisableFind = function shouldDisableFind(aDocument) {
+      var shouldDisableFind = function(aDocument) {
         let docElt = aDocument.documentElement;
         return docElt && docElt.getAttribute("disablefastfind") == "true";
       }
 
-      var disableFindCommands = function disableFindCommands(aDisable) {
+      var disableFindCommands = function(aDisable) {
         let findCommands = [document.getElementById("cmd_find"),
                             document.getElementById("cmd_findAgain"),
                             document.getElementById("cmd_findPrevious")];
         for (let elt of findCommands) {
           if (aDisable)
             elt.setAttribute("disabled", "true");
           else
             elt.removeAttribute("disabled");
         }
       }
 
-      var onContentRSChange = function onContentRSChange(e) {
+      var onContentRSChange = function(e) {
         if (e.target.readyState != "interactive" && e.target.readyState != "complete")
           return;
 
         e.target.removeEventListener("readystatechange", onContentRSChange);
         disableFindCommands(shouldDisableFind(e.target));
       }
 
       // Disable find commands in documents that ask for them to be disabled.
@@ -6029,27 +6028,27 @@ var OfflineApps = {
       notification.options.controlledItems.push([
         Cu.getWeakReference(browser), docId, uri
       ]);
     } else {
       let mainAction = {
         label: gNavigatorBundle.getString("offlineApps.allow"),
         accessKey: gNavigatorBundle.getString("offlineApps.allowAccessKey"),
         callback: function() {
-          for (let [browser, docId, uri] of notification.options.controlledItems) {
-            OfflineApps.allowSite(browser, docId, uri);
+          for (let [ciBrowser, ciDocId, ciUri] of notification.options.controlledItems) {
+            OfflineApps.allowSite(ciBrowser, ciDocId, ciUri);
           }
         }
       };
       let secondaryActions = [{
         label: gNavigatorBundle.getString("offlineApps.never"),
         accessKey: gNavigatorBundle.getString("offlineApps.neverAccessKey"),
         callback: function() {
-          for (let [, , uri] of notification.options.controlledItems) {
-            OfflineApps.disallowSite(uri);
+          for (let [, , ciUri] of notification.options.controlledItems) {
+            OfflineApps.disallowSite(ciUri);
           }
         }
       }];
       let message = gNavigatorBundle.getFormattedString("offlineApps.available",
                                                         [host]);
       let anchorID = "indexedDB-notification-icon";
       let options = {
         controlledItems : [[Cu.getWeakReference(browser), docId, uri]]
@@ -6359,17 +6358,17 @@ var MailIntegration = {
 };
 
 function BrowserOpenAddonsMgr(aView) {
   return new Promise(resolve => {
     if (aView) {
       let emWindow;
       let browserWindow;
 
-      var receivePong = function receivePong(aSubject, aTopic, aData) {
+      var receivePong = function(aSubject, aTopic, aData) {
         let browserWin = aSubject.QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIWebNavigation)
                                  .QueryInterface(Ci.nsIDocShellTreeItem)
                                  .rootTreeItem
                                  .QueryInterface(Ci.nsIInterfaceRequestor)
                                  .getInterface(Ci.nsIDOMWindow);
         if (!emWindow || browserWin == window /* favor the current window */) {
           emWindow = aSubject;
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -1142,18 +1142,18 @@ var PageInfoListener = {
   getMediaItems: function(document, strings, elem)
   {
     // Check for images defined in CSS (e.g. background, borders)
     let computedStyle = elem.ownerGlobal.getComputedStyle(elem);
     // A node can have multiple media items associated with it - for example,
     // multiple background images.
     let mediaItems = [];
 
-    let addImage = (url, type, alt, elem, isBg) => {
-      let element = this.serializeElementInfo(document, url, type, alt, elem, isBg);
+    let addImage = (url, type, alt, el, isBg) => {
+      let element = this.serializeElementInfo(document, url, type, alt, el, isBg);
       mediaItems.push([url, type, alt, element, isBg]);
     };
 
     if (computedStyle) {
       let addImgFunc = (label, val) => {
         if (val.primitiveType == content.CSSPrimitiveValue.CSS_URI) {
           addImage(val.getStringValue(), label, strings.notSet, elem, true);
         }
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -720,19 +720,19 @@ function selectSaveFolder(aCallback)
   fp.open(fpCallback);
 }
 
 function saveMedia()
 {
   var tree = document.getElementById("imagetree");
   var rowArray = getSelectedRows(tree);
   if (rowArray.length == 1) {
-    var row = rowArray[0];
-    var item = gImageView.data[row][COL_IMAGE_NODE];
-    var url = gImageView.data[row][COL_IMAGE_ADDRESS];
+    let row = rowArray[0];
+    let item = gImageView.data[row][COL_IMAGE_NODE];
+    let url = gImageView.data[row][COL_IMAGE_ADDRESS];
 
     if (url) {
       var titleKey = "SaveImageTitle";
 
       if (item instanceof HTMLVideoElement)
         titleKey = "SaveVideoTitle";
       else if (item instanceof HTMLAudioElement)
         titleKey = "SaveAudioTitle";
@@ -745,21 +745,21 @@ function saveMedia()
       if (aDirectory) {
         var saveAnImage = function(aURIString, aChosenData, aBaseURI) {
           uniqueFile(aChosenData.file);
           internalSave(aURIString, null, null, null, null, false, "SaveImageTitle",
                        aChosenData, aBaseURI, null, false, null, gDocInfo.isContentWindowPrivate);
         };
 
         for (var i = 0; i < rowArray.length; i++) {
-          var v = rowArray[i];
-          var dir = aDirectory.clone();
-          var item = gImageView.data[v][COL_IMAGE_NODE];
-          var uriString = gImageView.data[v][COL_IMAGE_ADDRESS];
-          var uri = makeURI(uriString);
+          let v = rowArray[i];
+          let dir = aDirectory.clone();
+          let item = gImageView.data[v][COL_IMAGE_NODE];
+          let uriString = gImageView.data[v][COL_IMAGE_ADDRESS];
+          let uri = makeURI(uriString);
 
           try {
             uri.QueryInterface(Components.interfaces.nsIURL);
             dir.append(decodeURIComponent(uri.fileName));
           } catch (ex) {
             // data:/blob: uris
             // Supply a dummy filename, otherwise Download Manager
             // will try to delete the base directory on failure.
--- a/browser/base/content/sync/setup.js
+++ b/browser/base/content/sync/setup.js
@@ -820,18 +820,18 @@ var gSyncSetup = {
       return false;
 
     let uri = Weave.Utils.makeURI(val);
 
     if (!uri)
       uri = Weave.Utils.makeURI("https://" + val);
 
     if (uri && this._settingUpNew) {
-      function isValid(uri) {
-        Weave.Service.serverURL = uri.spec;
+      function isValid(validUri) {
+        Weave.Service.serverURL = validUri.spec;
         let check = Weave.Service.checkAccount("a");
         return (check == "available" || check == "notAvailable");
       }
 
       if (uri.schemeIs("http")) {
         uri.scheme = "https";
         if (isValid(uri))
           valid = true;
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -4740,38 +4740,41 @@
 
       <method name="observe">
         <parameter name="aSubject"/>
         <parameter name="aTopic"/>
         <parameter name="aData"/>
         <body><![CDATA[
           let browser;
           switch (aTopic) {
-            case "live-resize-start":
+            case "live-resize-start": {
               browser = this.mCurrentTab.linkedBrowser;
               let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
               if (fl && fl.tabParent && !this.mActiveResizeDisplayportSuppression) {
                 fl.tabParent.suppressDisplayport(true);
                 this.mActiveResizeDisplayportSuppression = browser;
               }
               break;
-            case "live-resize-end":
+            }
+            case "live-resize-end": {
               browser = this.mActiveResizeDisplayportSuppression;
               if (browser) {
                 let fl = browser.QueryInterface(Ci.nsIFrameLoaderOwner).frameLoader;
                 if (fl && fl.tabParent) {
                   fl.tabParent.suppressDisplayport(false);
                   this.mActiveResizeDisplayportSuppression = null;
                 }
               }
               break;
-            case "nsPref:changed":
+            }
+            case "nsPref:changed": {
               // This is the only pref observed.
               this._findAsYouType = Services.prefs.getBoolPref("accessibility.typeaheadfind");
               break;
+            }
           }
         ]]></body>
       </method>
 
       <constructor>
         <![CDATA[
           this.mCurrentBrowser = document.getAnonymousElementByAttribute(this, "anonid", "initialBrowser");
           this.mCurrentBrowser.permanentKey = {};
@@ -5748,17 +5751,17 @@
           let low = 0;
           let high = tabs.length - 1;
           while (low <= high) {
             let mid = Math.floor((low + high) / 2);
             if (tabs[mid] == draggedTab &&
                 ++mid > high)
               break;
             let boxObject = tabs[mid].boxObject;
-            let screenX = boxObject.screenX + getTabShift(tabs[mid], oldIndex);
+            screenX = boxObject.screenX + getTabShift(tabs[mid], oldIndex);
             if (screenX > tabCenter) {
               high = mid - 1;
             } else if (screenX + boxObject.width < tabCenter) {
               low = mid + 1;
             } else {
               newIndex = tabs[mid]._tPos;
               break;
             }
--- a/browser/base/content/test/alerts/browser_notification_close.js
+++ b/browser/base/content/test/alerts/browser_notification_close.js
@@ -11,20 +11,21 @@ add_task(function* test_notificationClos
   let notificationURI = makeURI(notificationURL);
   pm.add(notificationURI, "desktop-notification", pm.ALLOW_ACTION);
 
   oldShowFavicons = Services.prefs.getBoolPref("alerts.showFavicons");
   Services.prefs.setBoolPref("alerts.showFavicons", true);
 
   yield PlacesTestUtils.addVisits(notificationURI);
   let faviconURI = yield new Promise(resolve => {
-    let faviconURI = makeURI("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC");
-    PlacesUtils.favicons.setAndFetchFaviconForPage(notificationURI, faviconURI,
+    let uri =
+      makeURI("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQI12P4//8/AAX+Av7czFnnAAAAAElFTkSuQmCC");
+    PlacesUtils.favicons.setAndFetchFaviconForPage(notificationURI, uri,
       true, PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
-      (faviconURI, iconSize, iconData, mimeType) => resolve(faviconURI),
+      (uriResult) => resolve(uriResult),
       Services.scriptSecurityManager.getSystemPrincipal());
   });
 
   yield BrowserTestUtils.withNewTab({
     gBrowser,
     url: notificationURL
   }, function* dummyTabTask(aBrowser) {
     yield openNotification(aBrowser, "showNotification2");
--- a/browser/base/content/test/alerts/browser_notification_tab_switching.js
+++ b/browser/base/content/test/alerts/browser_notification_tab_switching.js
@@ -19,21 +19,21 @@ add_task(function* test_notificationPrev
     url: notificationURL
   }, function* dummyTabTask(aBrowser) {
     // Put new tab in background so it is obvious when it is re-focused.
     yield BrowserTestUtils.switchTab(gBrowser, originalTab);
     isnot(gBrowser.selectedBrowser, aBrowser, "Notification page loaded as a background tab");
 
     // First, show a notification that will be have the tab-switching prevented.
     function promiseNotificationEvent(evt) {
-      return ContentTask.spawn(aBrowser, evt, function* (evt) {
+      return ContentTask.spawn(aBrowser, evt, function* (contentEvt) {
         return yield new Promise(resolve => {
-          let notification = content.wrappedJSObject._notification;
-          notification.addEventListener(evt, function l(event) {
-            notification.removeEventListener(evt, l);
+          let contentNotification = content.wrappedJSObject._notification;
+          contentNotification.addEventListener(contentEvt, function l(event) {
+            contentNotification.removeEventListener(contentEvt, l);
             resolve({ defaultPrevented: event.defaultPrevented });
           });
         });
       });
     }
     yield openNotification(aBrowser, "showNotification1");
     info("Notification alert showing");
     let alertWindow = Services.wm.getMostRecentWindow("alert:alert");
--- a/browser/base/content/test/alerts/head.js
+++ b/browser/base/content/test/alerts/head.js
@@ -37,33 +37,33 @@ function promiseWindowClosed(window) {
  * These two functions work with file_dom_notifications.html to open the
  * notification and close it.
  *
  * |fn| can be showNotification1 or showNotification2.
  * if |timeout| is passed, then the promise returned from this function is
  * rejected after the requested number of miliseconds.
  */
 function openNotification(aBrowser, fn, timeout) {
-  return ContentTask.spawn(aBrowser, { fn, timeout }, function* ({ fn, timeout }) {
+  return ContentTask.spawn(aBrowser, [fn, timeout], function* ([contentFn, contentTimeout]) {
     let win = content.wrappedJSObject;
-    let notification = win[fn]();
+    let notification = win[contentFn]();
     win._notification = notification;
     yield new Promise((resolve, reject) => {
       function listener() {
         notification.removeEventListener("show", listener);
         resolve();
       }
 
       notification.addEventListener("show", listener);
 
-      if (timeout) {
+      if (contentTimeout) {
         content.setTimeout(() => {
           notification.removeEventListener("show", listener);
           reject("timed out");
-        }, timeout);
+        }, contentTimeout);
       }
     });
   });
 }
 
 function closeNotification(aBrowser) {
   return ContentTask.spawn(aBrowser, null, function() {
     content.wrappedJSObject._notification.close();
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -504,28 +504,28 @@ function whenSearchInitDone() {
 
 /**
  * Changes the newtab customization option and waits for the panel to open and close
  *
  * @param {string} aTheme
  *        Can be any of("blank"|"classic"|"enhanced")
  */
 function customizeNewTabPage(aTheme) {
-  return ContentTask.spawn(gWindow.gBrowser.selectedBrowser, aTheme, function*(aTheme) {
+  return ContentTask.spawn(gWindow.gBrowser.selectedBrowser, aTheme, function*(contentTheme) {
 
     let document = content.document;
     let panel = document.getElementById("newtab-customize-panel");
     let customizeButton = document.getElementById("newtab-customize-button");
 
     function panelOpened(opened) {
       return new Promise( (resolve) => {
         let options = {attributes: true, oldValue: true};
         let observer = new content.MutationObserver(function(mutations) {
           mutations.forEach(function(mutation) {
-            document.getElementById("newtab-customize-" + aTheme).click();
+            document.getElementById("newtab-customize-" + contentTheme).click();
             observer.disconnect();
             if (opened == panel.hasAttribute("open")) {
               resolve();
             }
           });
         });
         observer.observe(panel, options);
       });
--- a/browser/base/content/test/plugins/browser_pageInfo_plugins.js
+++ b/browser/base/content/test/plugins/browser_pageInfo_plugins.js
@@ -61,18 +61,18 @@ function test() {
   gTestBrowser = gBrowser.selectedBrowser;
   gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gTestPermissionString);
   gPermissionManager.remove(makeURI("http://127.0.0.1:8888/"), gSecondTestPermissionString);
   doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart1a);
 }
 
 // The first test plugin is CtP and the second test plugin is enabled.
 function testPart1a() {
-  let test = gTestBrowser.contentDocument.getElementById("test");
-  let objLoadingContent = test.QueryInterface(Ci.nsIObjectLoadingContent);
+  let testElement = gTestBrowser.contentDocument.getElementById("test");
+  let objLoadingContent = testElement.QueryInterface(Ci.nsIObjectLoadingContent);
   ok(!objLoadingContent.activated, "part 1a: Test plugin should not be activated");
   let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA");
   objLoadingContent = secondtest.QueryInterface(Ci.nsIObjectLoadingContent);
   ok(objLoadingContent.activated, "part 1a: Second Test plugin should be activated");
 
   doOnOpenPageInfo(testPart1b);
 }
 
@@ -92,19 +92,19 @@ function testPart1b() {
   secondtestRadioGroup.selectedItem = secondtestRadioAsk;
   secondtestRadioAsk.doCommand();
 
   doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart2);
 }
 
 // Now, the Test plugin should be allowed, and the Test2 plugin should be CtP
 function testPart2() {
-  let test = gTestBrowser.contentDocument.getElementById("test").
+  let testElement = gTestBrowser.contentDocument.getElementById("test").
     QueryInterface(Ci.nsIObjectLoadingContent);
-  ok(test.activated, "part 2: Test plugin should be activated");
+  ok(testElement.activated, "part 2: Test plugin should be activated");
 
   let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA").
     QueryInterface(Ci.nsIObjectLoadingContent);
   ok(!secondtest.activated, "part 2: Second Test plugin should not be activated");
   is(secondtest.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_CLICK_TO_PLAY,
      "part 2: Second test plugin should be click-to-play.");
 
   let testRadioGroup = gPageInfo.document.getElementById(gTestPermissionString + "RadioGroup");
@@ -121,20 +121,20 @@ function testPart2() {
   secondtestRadioGroup.selectedItem = secondtestRadioBlock;
   secondtestRadioBlock.doCommand();
 
   doOnPageLoad(gHttpTestRoot + "plugin_two_types.html", testPart3);
 }
 
 // Now, all the things should be blocked
 function testPart3() {
-  let test = gTestBrowser.contentDocument.getElementById("test").
+  let testElement = gTestBrowser.contentDocument.getElementById("test").
     QueryInterface(Ci.nsIObjectLoadingContent);
-  ok(!test.activated, "part 3: Test plugin should not be activated");
-  is(test.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
+  ok(!testElement.activated, "part 3: Test plugin should not be activated");
+  is(testElement.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
     "part 3: Test plugin should be marked as PLUGIN_DISABLED");
 
   let secondtest = gTestBrowser.contentDocument.getElementById("secondtestA").
     QueryInterface(Ci.nsIObjectLoadingContent);
 
   ok(!secondtest.activated, "part 3: Second Test plugin should not be activated");
   is(secondtest.pluginFallbackType, Ci.nsIObjectLoadingContent.PLUGIN_DISABLED,
      "part 3: Second test plugin should be marked as PLUGIN_DISABLED");
--- a/browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
+++ b/browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
@@ -44,17 +44,17 @@ const CRASHED_MESSAGE = "BrowserPlugins:
  * @return Promise
  *        The Promise resolves when the plugin has officially been put into
  *        the crash reporter state, and then "rewound" to have the "status"
  *        attribute of the statusDiv removed. The resolved Promise returns
  *        the run ID for the crashed plugin. It rejects if we never get into
  *        the crash reporter state.
  */
 function preparePlugin(browser, pluginFallbackState) {
-  return ContentTask.spawn(browser, pluginFallbackState, function* (pluginFallbackState) {
+  return ContentTask.spawn(browser, pluginFallbackState, function* (contentPluginFallbackState) {
     let plugin = content.document.getElementById("plugin");
     plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     // CRASH_URL will load a plugin that crashes immediately. We
     // wait until the plugin has finished being put into the crash
     // state.
     let statusDiv;
     yield ContentTaskUtils.waitForCondition(() => {
       statusDiv = plugin.ownerDocument
@@ -64,17 +64,17 @@ function preparePlugin(browser, pluginFa
     }, "Timed out waiting for plugin to be in crash report state");
 
     // "Rewind", by wiping out the status attribute...
     statusDiv.removeAttribute("status");
     // Somehow, I'm able to get away with overriding the getter for
     // this XPCOM object. Probably because I've got chrome privledges.
     Object.defineProperty(plugin, "pluginFallbackType", {
       get: function() {
-        return pluginFallbackState;
+        return contentPluginFallbackState;
       }
     });
     return plugin.runID;
   }).then((runID) => {
     browser.messageManager.sendAsyncMessage("BrowserPlugins:Test:ClearCrashData");
     return runID;
   });
 }
--- a/browser/base/content/test/plugins/browser_pluginnotification.js
+++ b/browser/base/content/test/plugins/browser_pluginnotification.js
@@ -475,19 +475,18 @@ add_task(function* () {
     yield ContentTask.spawn(gTestBrowser, { id }, function* (args) {
       let doc = content.document;
       let plugin = doc.getElementById(args.id);
       let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
       Assert.ok(overlayRect.width == 200 && overlayRect.height == 200,
         "Test 21c, plugin " + args.id + " should have click-to-play overlay with zero dims");
     });
 
-
-    let pluginInfo = yield promiseForPluginInfo(id);
-    ok(!pluginInfo.activated, "Test 21c, Plugin with id=" + id + " should not be activated");
+    let pluginInfoTmp = yield promiseForPluginInfo(id);
+    ok(!pluginInfoTmp.activated, "Test 21c, Plugin with id=" + id + " should not be activated");
   }
 
   centerAction = null;
   for (let action of notification.options.pluginData.values()) {
     if (action.pluginName == "Second Test") {
       centerAction = action;
       break;
     }
@@ -521,18 +520,18 @@ add_task(function* () {
     yield ContentTask.spawn(gTestBrowser, { id }, function* (args) {
       let doc = content.document;
       let plugin = doc.getElementById(args.id);
       let overlayRect = doc.getAnonymousElementByAttribute(plugin, "anonid", "main").getBoundingClientRect();
       Assert.ok(overlayRect.width == 0 && overlayRect.height == 0,
         "Test 21d, plugin " + args.id + " should have click-to-play overlay with zero dims");
     });
 
-    let pluginInfo = yield promiseForPluginInfo(id);
-    ok(pluginInfo.activated, "Test 21d, Plugin with id=" + id + " should not be activated");
+    let pluginInfoTmp = yield promiseForPluginInfo(id);
+    ok(pluginInfoTmp.activated, "Test 21d, Plugin with id=" + id + " should not be activated");
   }
 });
 
 // Tests that a click-to-play plugin resets its activated state when changing types
 add_task(function* () {
   clearAllPluginPermissions();
 
   updateAllTestPlugins(Ci.nsIPluginTag.STATE_CLICKTOPLAY);
--- a/browser/base/content/test/plugins/head.js
+++ b/browser/base/content/test/plugins/head.js
@@ -160,62 +160,62 @@ function getTestPluginEnabledState(plugi
   let name = pluginName || "Test Plug-in";
   let plugin = getTestPlugin(name);
   return plugin.enabledState;
 }
 
 // Returns a promise for nsIObjectLoadingContent props data.
 function promiseForPluginInfo(aId, aBrowser) {
   let browser = aBrowser || gTestBrowser;
-  return ContentTask.spawn(browser, aId, function* (aId) {
-    let plugin = content.document.getElementById(aId);
+  return ContentTask.spawn(browser, aId, function* (contentId) {
+    let plugin = content.document.getElementById(contentId);
     if (!(plugin instanceof Ci.nsIObjectLoadingContent))
       throw new Error("no plugin found");
     return {
       pluginFallbackType: plugin.pluginFallbackType,
       activated: plugin.activated,
       hasRunningPlugin: plugin.hasRunningPlugin,
       displayedType: plugin.displayedType,
     };
   });
 }
 
 // Return a promise and call the plugin's nsIObjectLoadingContent
 // playPlugin() method.
 function promisePlayObject(aId, aBrowser) {
   let browser = aBrowser || gTestBrowser;
-  return ContentTask.spawn(browser, aId, function* (aId) {
-    let plugin = content.document.getElementById(aId);
+  return ContentTask.spawn(browser, aId, function* (contentId) {
+    let plugin = content.document.getElementById(contentId);
     let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     objLoadingContent.playPlugin();
   });
 }
 
 function promiseCrashObject(aId, aBrowser) {
   let browser = aBrowser || gTestBrowser;
-  return ContentTask.spawn(browser, aId, function* (aId) {
-    let plugin = content.document.getElementById(aId);
+  return ContentTask.spawn(browser, aId, function* (contentId) {
+    let plugin = content.document.getElementById(contentId);
     Components.utils.waiveXrays(plugin).crash();
   });
 }
 
 // Return a promise and call the plugin's getObjectValue() method.
 function promiseObjectValueResult(aId, aBrowser) {
   let browser = aBrowser || gTestBrowser;
-  return ContentTask.spawn(browser, aId, function* (aId) {
-    let plugin = content.document.getElementById(aId);
+  return ContentTask.spawn(browser, aId, function* (contentId) {
+    let plugin = content.document.getElementById(contentId);
     return Components.utils.waiveXrays(plugin).getObjectValue();
   });
 }
 
 // Return a promise and reload the target plugin in the page
 function promiseReloadPlugin(aId, aBrowser) {
   let browser = aBrowser || gTestBrowser;
-  return ContentTask.spawn(browser, aId, function* (aId) {
-    let plugin = content.document.getElementById(aId);
+  return ContentTask.spawn(browser, aId, function* (contentId) {
+    let plugin = content.document.getElementById(contentId);
     plugin.src = plugin.src;
   });
 }
 
 // after a test is done using the plugin doorhanger, we should just clear
 // any permissions that may have crept in
 function clearAllPluginPermissions() {
   let perms = Services.perms.enumerator;
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_4.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_4.js
@@ -128,19 +128,19 @@ var tests = [
         return eventName == "swapping";
       };
 
       let notification = showNotification(notifyObj);
       let win = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
       yield whenDelayedStartupFinished(win);
 
       yield new Promise(resolve => {
-        let originalCallback = notification.options.eventCallback;
+        let callback = notification.options.eventCallback;
         notification.options.eventCallback = function(eventName) {
-          originalCallback(eventName);
+          callback(eventName);
           if (eventName == "shown") {
             resolve();
           }
         };
         info("Showing the notification again");
         notification.reshow();
       });
 
--- a/browser/base/content/test/popupNotifications/head.js
+++ b/browser/base/content/test/popupNotifications/head.js
@@ -31,19 +31,19 @@ function whenDelayedStartupFinished(aWin
  * @return {Promise}
  * @resolves The array [subject, data] from the observed notification.
  * @rejects Never.
  */
 function promiseTopicObserved(topic)
 {
   let deferred = Promise.defer();
   info("Waiting for observer topic " + topic);
-  Services.obs.addObserver(function PTO_observe(subject, topic, data) {
-    Services.obs.removeObserver(PTO_observe, topic);
-    deferred.resolve([subject, data]);
+  Services.obs.addObserver(function PTO_observe(obsSubject, obsTopic, obsData) {
+    Services.obs.removeObserver(PTO_observe, obsTopic);
+    deferred.resolve([obsSubject, obsData]);
   }, topic, false);
   return deferred.promise;
 }
 
 
 /**
  * Waits for a load (or custom) event to finish in a given tab. If provided
  * load an uri into the tab.
--- a/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab.js
+++ b/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab.js
@@ -1,19 +1,19 @@
 // Tests referrer on context menu navigation - open link in new container tab.
 // Selects "open link in new container tab" from the context menu.
 
 function getReferrerTest(aTestNumber) {
-  let test = _referrerTests[aTestNumber];
-  if (test) {
+  let testCase = _referrerTests[aTestNumber];
+  if (testCase) {
     // We want all the referrer tests to fail!
-    test.result = "";
+    testCase.result = "";
   }
 
-  return test;
+  return testCase;
 }
 
 function startNewTabTestCase(aTestNumber) {
   info("browser_referrer_open_link_in_container_tab: " +
        getReferrerTestDescription(aTestNumber));
   contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
     someTabLoaded(gTestWindow).then(function(aNewTab) {
       gTestWindow.gBrowser.selectedTab = aNewTab;
--- a/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab3.js
+++ b/browser/base/content/test/referrer/browser_referrer_open_link_in_container_tab3.js
@@ -1,22 +1,22 @@
 // Tests referrer on context menu navigation - open link in new container tab.
 // Selects "open link in new container tab" from the context menu.
 
 // The test runs from a container ID 2.
 // Output: we have no referrer.
 
 function getReferrerTest(aTestNumber) {
-  let test = _referrerTests[aTestNumber];
-  if (test) {
+  let testCase = _referrerTests[aTestNumber];
+  if (testCase) {
     // We want all the referrer tests to fail!
-    test.result = "";
+    testCase.result = "";
   }
 
-  return test;
+  return testCase;
 }
 
 function startNewTabTestCase(aTestNumber) {
   info("browser_referrer_open_link_in_container_tab: " +
        getReferrerTestDescription(aTestNumber));
   contextMenuOpened(gTestWindow, "testlink").then(function(aContextMenu) {
     someTabLoaded(gTestWindow).then(function(aNewTab) {
       gTestWindow.gBrowser.selectedTab = aNewTab;
--- a/browser/base/content/test/social/browser_aboutHome_activation.js
+++ b/browser/base/content/test/social/browser_aboutHome_activation.js
@@ -74,38 +74,38 @@ function test()
   requestLongerTimeout(2);
   ignoreAllUncaughtExceptions();
   PopupNotifications.panel.setAttribute("animate", "false");
   registerCleanupFunction(function() {
     PopupNotifications.panel.removeAttribute("animate");
   });
 
   Task.spawn(function* () {
-    for (let test of gTests) {
-      info(test.desc);
+    for (let testCase of gTests) {
+      info(testCase.desc);
 
       // Create a tab to run the test.
       let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
 
       // Add an event handler to modify the snippets map once it's ready.
-      let snippetsPromise = promiseSetupSnippetsMap(tab, test.snippet);
+      let snippetsPromise = promiseSetupSnippetsMap(tab, testCase.snippet);
 
       // Start loading about:home and wait for it to complete, snippets should be loaded
       yield promiseTabLoadEvent(tab, "about:home", "AboutHomeLoadSnippetsCompleted");
 
       yield snippetsPromise;
 
       // ensure our activation snippet is indeed available
       yield ContentTask.spawn(tab.linkedBrowser, {}, function*(arg) {
         ok(!!content.document.getElementById("snippets"), "Found snippets element");
         ok(!!content.document.getElementById("activationSnippet"), "The snippet is present.");
       });
 
       yield new Promise(resolve => {
-        activateProvider(tab, test.panel).then(() => {
+        activateProvider(tab, testCase.panel).then(() => {
           checkSocialUI();
           SocialService.uninstallProvider("https://example.com", function() {
             info("provider uninstalled");
             resolve();
           });
         });
       });
 
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -7,20 +7,20 @@ Components.utils.import("resource://gre/
 XPCOMUtils.defineLazyModuleGetter(this, "Task",
   "resource://gre/modules/Task.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
   "resource://gre/modules/PlacesUtils.jsm");
 
 
 function promiseObserverNotified(aTopic) {
   return new Promise(resolve => {
-    Services.obs.addObserver(function onNotification(aSubject, aTopic, aData) {
-      dump("notification promised " + aTopic);
-      Services.obs.removeObserver(onNotification, aTopic);
-      TestUtils.executeSoon(() => resolve({subject: aSubject, data: aData}));
+    Services.obs.addObserver(function onNotification(subject, topic, data) {
+      dump("notification promised " + topic);
+      Services.obs.removeObserver(onNotification, topic);
+      TestUtils.executeSoon(() => resolve({subject, data}));
     }, aTopic, false);
   });
 }
 
 // Check that a specified (string) URL hasn't been "remembered" (ie, is not
 // in history, will not appear in about:newtab or auto-complete, etc.)
 function promiseSocialUrlNotRemembered(url) {
   return new Promise(resolve => {
@@ -82,32 +82,32 @@ function runSocialTestWithProvider(manif
   function finishIfDone(callFinish) {
     finishCount++;
     if (finishCount == manifests.length)
       Task.spawn(finishCleanUp).then(finishcallback || defaultFinishChecks);
   }
   function removeAddedProviders(cleanup) {
     manifests.forEach(function(m) {
       // If we're "cleaning up", don't call finish when done.
-      let callback = cleanup ? function() {} : finishIfDone;
+      let finishCb = cleanup ? function() {} : finishIfDone;
       // Similarly, if we're cleaning up, catch exceptions from removeProvider
       let removeProvider = SocialService.disableProvider.bind(SocialService);
       if (cleanup) {
         removeProvider = function(origin, cb) {
           try {
             SocialService.disableProvider(origin, cb);
           } catch (ex) {
             // Ignore "provider doesn't exist" errors.
             if (ex.message.indexOf("SocialService.disableProvider: no provider with origin") == 0)
               return;
             info("Failed to clean up provider " + origin + ": " + ex);
           }
         }
       }
-      removeProvider(m.origin, callback);
+      removeProvider(m.origin, finishCb);
     });
   }
   function finishSocialTest(cleanup) {
     removeAddedProviders(cleanup);
   }
 
   let providersAdded = 0;
 
@@ -230,36 +230,36 @@ function ensureFrameLoaded(frame, uri) {
     }
   });
 }
 
 // Support for going on and offline.
 // (via browser/base/content/test/browser_bookmark_titles.js)
 var origProxyType = Services.prefs.getIntPref('network.proxy.type');
 
-function toggleOfflineStatus(goOffline) {
+function toggleOfflineStatus(goOfflineState) {
   // Bug 968887 fix.  when going on/offline, wait for notification before continuing
   return new Promise(resolve => {
-    if (!goOffline) {
+    if (!goOfflineState) {
       Services.prefs.setIntPref('network.proxy.type', origProxyType);
     }
-    if (goOffline != Services.io.offline) {
+    if (goOfflineState != Services.io.offline) {
       info("initial offline state " + Services.io.offline);
       let expect = !Services.io.offline;
       Services.obs.addObserver(function offlineChange(subject, topic, data) {
         Services.obs.removeObserver(offlineChange, "network:offline-status-changed");
         info("offline state changed to " + Services.io.offline);
         is(expect, Services.io.offline, "network:offline-status-changed successful toggle");
         resolve();
       }, "network:offline-status-changed", false);
       BrowserOffline.toggleOfflineStatus();
     } else {
       resolve();
     }
-    if (goOffline) {
+    if (goOfflineState) {
       Services.prefs.setIntPref('network.proxy.type', 0);
       // LOAD_FLAGS_BYPASS_CACHE isn't good enough. So clear the cache.
       Services.cache2.clear();
     }
   });
 }
 
 function goOffline() {
--- a/browser/base/content/test/urlbar/browser_URLBarSetURI.js
+++ b/browser/base/content/test/urlbar/browser_URLBarSetURI.js
@@ -12,19 +12,19 @@ function test() {
   });
 
   nextTest();
 }
 
 const phishyUserPassPref = "network.http.phishy-userpass-length";
 
 function nextTest() {
-  let test = tests.shift();
-  if (test) {
-    test(function() {
+  let testCase = tests.shift();
+  if (testCase) {
+    testCase(function() {
       executeSoon(nextTest);
     });
   } else {
     executeSoon(finish);
   }
 }
 
 var tests = [
--- a/browser/base/content/test/urlbar/browser_action_searchengine.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine.js
@@ -4,17 +4,16 @@ add_task(function* () {
   let engine = Services.search.getEngineByName("MozSearch");
   let originalEngine = Services.search.currentEngine;
   Services.search.currentEngine = engine;
 
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla");
 
   registerCleanupFunction(() => {
     Services.search.currentEngine = originalEngine;
-    let engine = Services.search.getEngineByName("MozSearch");
     Services.search.removeEngine(engine);
 
     try {
       gBrowser.removeTab(tab);
     } catch (ex) { /* tab may have already been closed in case of failure */ }
 
     return PlacesTestUtils.clearHistory();
   });
--- a/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
+++ b/browser/base/content/test/urlbar/browser_action_searchengine_alias.js
@@ -5,17 +5,16 @@ add_task(function* () {
   let engine = Services.search.getEngineByName("MozSearch");
   let originalEngine = Services.search.currentEngine;
   Services.search.currentEngine = engine;
 
   let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla");
 
   registerCleanupFunction(() => {
     Services.search.currentEngine = originalEngine;
-    let engine = Services.search.getEngineByName("MozSearch");
     Services.search.removeEngine(engine);
 
     try {
       gBrowser.removeTab(tab);
     } catch (ex) { /* tab may have already been closed in case of failure */ }
 
     return PlacesTestUtils.clearHistory();
   });
--- a/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js
@@ -70,19 +70,19 @@ add_task(function* test_disabled_ac() {
   Services.search.currentEngine = engine;
 
   function* cleanup() {
     Preferences.set("browser.urlbar.suggest.history", suggestHistory);
     Preferences.set("browser.urlbar.suggest.bookmark", suggestBookmarks);
     Preferences.set("browser.urlbar.suggest.openpage", suggestOpenPages);
 
     Services.search.currentEngine = originalEngine;
-    let engine = Services.search.getEngineByName("MozSearch");
-    if (engine) {
-      Services.search.removeEngine(engine);
+    let mozSearchEngine = Services.search.getEngineByName("MozSearch");
+    if (mozSearchEngine) {
+      Services.search.removeEngine(mozSearchEngine);
     }
   }
   registerCleanupFunction(cleanup);
 
   gURLBar.focus();
   gURLBar.value = "e";
   EventUtils.synthesizeKey("x", {});
   EventUtils.synthesizeKey("VK_RETURN", {});
--- a/browser/base/content/test/urlbar/browser_locationBarExternalLoad.js
+++ b/browser/base/content/test/urlbar/browser_locationBarExternalLoad.js
@@ -1,14 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
-const url = "data:text/html,<body>hi";
-
 add_task(function*() {
+  const url = "data:text/html,<body>hi";
   yield* testURL(url, urlEnter);
   yield* testURL(url, urlClick);
 });
 
 function urlEnter(url) {
   gURLBar.value = url;
   gURLBar.focus();
   EventUtils.synthesizeKey("VK_RETURN", {});
--- a/browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
@@ -83,17 +83,17 @@ add_task(function* dontTemporarilyShowAb
   yield TabStateFlusher.flush(win.gBrowser.selectedBrowser);
   yield BrowserTestUtils.closeWindow(win);
   ok(SessionStore.getClosedWindowCount(), "Should have a closed window");
 
   windowOpenedPromise = BrowserTestUtils.waitForNewWindow();
   win = SessionStore.undoCloseWindow(0);
   yield windowOpenedPromise;
   let wpl = {
-    onLocationChange(wpl, request, location, flags) {
+    onLocationChange() {
       is(win.gURLBar.value, "", "URL bar value should stay empty.");
     },
   };
   win.gBrowser.addProgressListener(wpl);
   let otherTab = win.gBrowser.selectedTab.previousSibling;
   let tabLoaded = BrowserTestUtils.browserLoaded(otherTab.linkedBrowser, false, "about:home");
   yield BrowserTestUtils.switchTab(win.gBrowser, otherTab);
   yield tabLoaded;
--- a/browser/base/content/test/urlbar/browser_urlbarCopying.js
+++ b/browser/base/content/test/urlbar/browser_urlbarCopying.js
@@ -140,38 +140,38 @@ var tests = [
   },
   {
     copyVal: "<data:text/html,(%C3%A9 %25P>)",
     copyExpected: "data:text/html,(%C3%A9 %25P",
   }
 ];
 
 function nextTest() {
-  let test = tests.shift();
+  let testCase = tests.shift();
   if (tests.length == 0)
-    runTest(test, finish);
+    runTest(testCase, finish);
   else
-    runTest(test, nextTest);
+    runTest(testCase, nextTest);
 }
 
-function runTest(test, cb) {
+function runTest(testCase, cb) {
   function doCheck() {
-    if (test.setURL || test.loadURL) {
-      gURLBar.valueIsTyped = !!test.setURL;
-      is(gURLBar.textValue, test.expectedURL, "url bar value set");
+    if (testCase.setURL || testCase.loadURL) {
+      gURLBar.valueIsTyped = !!testCase.setURL;
+      is(gURLBar.textValue, testCase.expectedURL, "url bar value set");
     }
 
-    testCopy(test.copyVal, test.copyExpected, cb);
+    testCopy(testCase.copyVal, testCase.copyExpected, cb);
   }
 
-  if (test.loadURL) {
-    loadURL(test.loadURL, doCheck);
+  if (testCase.loadURL) {
+    loadURL(testCase.loadURL, doCheck);
   } else {
-    if (test.setURL)
-      gURLBar.value = test.setURL;
+    if (testCase.setURL)
+      gURLBar.value = testCase.setURL;
     doCheck();
   }
 }
 
 function testCopy(copyVal, targetValue, cb) {
   info("Expecting copy of: " + targetValue);
   waitForClipboard(targetValue, function() {
     gURLBar.focus();
--- a/browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
+++ b/browser/base/content/test/urlbar/browser_urlbarHashChangeProxyState.js
@@ -17,22 +17,22 @@ add_task(function* () {
       ok(identityBox.classList.contains("verifiedDomain"), "Identity box should know we're doing SSL " + testType);
       is(gURLBar.getAttribute("pageproxystate"), "valid", "URL bar is in valid page proxy state");
     };
 
     verifyURLBarState("at the beginning");
 
     let locationChangePromise;
     let resolveLocationChangePromise;
-    let expectURL = url => {
-      expectedURL = url;
+    let expectURL = urlTemp => {
+      expectedURL = urlTemp;
       locationChangePromise = new Promise(r => resolveLocationChangePromise = r);
     };
     let wpl = {
-      onLocationChange(wpl, request, location, flags) {
+      onLocationChange(unused, unused2, location) {
         is(location.spec, expectedURL, "Got the expected URL");
         resolveLocationChangePromise();
       },
     };
     gBrowser.addProgressListener(wpl);
 
     expectURL(baseURL + "#foo");
     gURLBar.select();
--- a/browser/base/content/test/urlbar/browser_urlbarOneOffs.js
+++ b/browser/base/content/test/urlbar/browser_urlbarOneOffs.js
@@ -84,17 +84,17 @@ add_task(function* history() {
   EventUtils.synthesizeKey("VK_UP", {})
   assertState(-1, -1, "");
 
   yield hidePopup();
 });
 
 // Keys up and down through the non-history panel, i.e., the panel that's shown
 // when you type something in the textbox.
-add_task(function* typedValue() {
+add_task(function*() {
   // Use a typed value that returns the visits added above but that doesn't
   // trigger autofill since that would complicate the test.
   let typedValue = "browser_urlbarOneOffs";
   yield promiseAutocompleteResultPopup(typedValue, window, true);
 
   assertState(0, -1, typedValue);
 
   // Key down through each result.  The first result is already selected, which
--- a/browser/base/content/test/urlbar/browser_urlbar_remoteness_switch.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_remoteness_switch.js
@@ -4,17 +4,17 @@
  * Verify that when loading and going back/forward through history between URLs
  * loaded in the content process, and URLs loaded in the parent process, we
  * don't set the URL for the tab to about:blank inbetween the loads.
  */
 add_task(function*() {
   let url = "http://www.example.com/foo.html";
   yield BrowserTestUtils.withNewTab({gBrowser, url}, function*(browser) {
     let wpl = {
-      onLocationChange(wpl, request, location, flags) {
+      onLocationChange(unused, unused2, location) {
         if (location.schemeIs("about")) {
           is(location.spec, "about:config", "Only about: location change should be for about:preferences");
         } else {
           is(location.spec, url, "Only non-about: location change should be for the http URL we're dealing with.");
         }
       },
     };
     gBrowser.addProgressListener(wpl);
--- a/browser/base/content/test/urlbar/head.js
+++ b/browser/base/content/test/urlbar/head.js
@@ -23,17 +23,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
  *        If you're using this method to avoid hitting the network, you want the default (true).
  *        However, the browser UI will behave differently for loads stopped directly from
  *        the progress listener (effectively in the middle of a call to loadURI) and so there
  *        are cases where you may want to avoid stopping the load directly from within the
  *        progress listener callback.
  * @return promise
  */
 function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrowser, aStopFromProgressListener = true) {
-  function content_script(aStopFromProgressListener) {
+  function content_script(contentStopFromProgressListener) {
     let { interfaces: Ci, utils: Cu } = Components;
     Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
     let wp = docShell.QueryInterface(Ci.nsIWebProgress);
 
     function stopContent(now, uri) {
       if (now) {
         /* Hammer time. */
         content.stop();
@@ -51,17 +51,17 @@ function waitForDocLoadAndStopIt(aExpect
 
         if (webProgress.isTopLevel &&
             flags & Ci.nsIWebProgressListener.STATE_START) {
           wp.removeProgressListener(progressListener);
 
           let chan = req.QueryInterface(Ci.nsIChannel);
           dump(`waitForDocLoadAndStopIt: Document start: ${chan.URI.spec}\n`);
 
-          stopContent(aStopFromProgressListener, chan.originalURI.spec);
+          stopContent(contentStopFromProgressListener, chan.originalURI.spec);
         }
       },
       QueryInterface: XPCOMUtils.generateQI(["nsISupportsWeakReference"])
     };
     wp.addProgressListener(progressListener, wp.NOTIFY_STATE_WINDOW);
 
     /**
      * As |this| is undefined and we can't extend |docShell|, adding an unload
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media.js
@@ -529,19 +529,19 @@ function test() {
     is(PopupNotifications._currentNotifications.length, 0,
        "should start the test without any prior popup notification");
     ok(gIdentityHandler._identityPopup.hidden,
        "should start the test with the control center hidden");
 
     Task.spawn(function* () {
       yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
 
-      for (let test of gTests) {
-        info(test.desc);
-        yield test.run();
+      for (let testCase of gTests) {
+        info(testCase.desc);
+        yield testCase.run();
 
         // Cleanup before the next test
         yield expectNoObserverCalled();
       }
     }).then(finish, ex => {
      Cu.reportError(ex);
      ok(false, "Unexpected Exception: " + ex);
      finish();
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_anim.js
@@ -87,19 +87,19 @@ function test() {
     browser.removeEventListener("load", onload, true);
 
     is(PopupNotifications._currentNotifications.length, 0,
        "should start the test without any prior popup notification");
 
     Task.spawn(function* () {
       yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
 
-      for (let test of gTests) {
-        info(test.desc);
-        yield test.run();
+      for (let testCase of gTests) {
+        info(testCase.desc);
+        yield testCase.run();
       }
     }).then(finish, ex => {
      Cu.reportError(ex);
      ok(false, "Unexpected Exception: " + ex);
      finish();
     });
   }, true);
   let rootDir = getRootDirectory(gTestPath);
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_in_frame.js
@@ -2,18 +2,23 @@
  * 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/. */
 
 registerCleanupFunction(function() {
   gBrowser.removeCurrentTab();
 });
 
 function promiseReloadFrame(aFrameId) {
-  return ContentTask.spawn(gBrowser.selectedBrowser, aFrameId, function*(aFrameId) {
-    content.wrappedJSObject.document.getElementById(aFrameId).contentWindow.location.reload();
+  return ContentTask.spawn(gBrowser.selectedBrowser, aFrameId, function*(contentFrameId) {
+    content.wrappedJSObject
+           .document
+           .getElementById(contentFrameId)
+           .contentWindow
+           .location
+           .reload();
   });
 }
 
 var gTests = [
 
 {
   desc: "getUserMedia audio+video",
   run: function* checkAudioVideo() {
@@ -240,19 +245,19 @@ function test() {
     browser.removeEventListener("load", onload, true);
 
     is(PopupNotifications._currentNotifications.length, 0,
        "should start the test without any prior popup notification");
 
     Task.spawn(function* () {
       yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
 
-      for (let test of gTests) {
-        info(test.desc);
-        yield test.run();
+      for (let testCase of gTests) {
+        info(testCase.desc);
+        yield testCase.run();
 
         // Cleanup before the next test
         yield expectNoObserverCalled();
       }
     }).then(finish, ex => {
      Cu.reportError(ex);
      ok(false, "Unexpected Exception: " + ex);
      finish();
--- a/browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
+++ b/browser/base/content/test/webrtc/browser_devices_get_user_media_tear_off_tab.js
@@ -84,19 +84,19 @@ function runTest() {
     is(PopupNotifications._currentNotifications.length, 0,
        "should start the test without any prior popup notification");
     ok(gIdentityHandler._identityPopup.hidden,
        "should start the test with the control center hidden");
 
     Task.spawn(function* () {
       yield SpecialPowers.pushPrefEnv({"set": [[PREF_PERMISSION_FAKE, true]]});
 
-      for (let test of gTests) {
-        info(test.desc);
-        yield test.run();
+      for (let testCase of gTests) {
+        info(testCase.desc);
+        yield testCase.run();
 
         // Cleanup before the next test
         yield expectNoObserverCalled();
       }
     }).then(finish, ex => {
      Cu.reportError(ex);
      ok(false, "Unexpected Exception: " + ex);
      finish();
--- a/browser/base/content/test/webrtc/get_user_media_content_script.js
+++ b/browser/base/content/test/webrtc/get_user_media_content_script.js
@@ -60,19 +60,19 @@ function _getMediaCaptureState() {
 }
 
 addMessageListener("Test:GetMediaCaptureState", data => {
   sendAsyncMessage("Test:MediaCaptureState", _getMediaCaptureState());
 });
 
 addMessageListener("Test:WaitForObserverCall", ({data}) => {
   let topic = data;
-  Services.obs.addObserver(function observer() {
+  Services.obs.addObserver(function obs() {
     sendAsyncMessage("Test:ObserverCalled", topic);
-    Services.obs.removeObserver(observer, topic);
+    Services.obs.removeObserver(obs, topic);
 
     if (kObservedTopics.indexOf(topic) != -1) {
       if (!(topic in gObservedTopics))
         gObservedTopics[topic] = -1;
       else
         --gObservedTopics[topic];
     }
   }, topic, false);
--- a/browser/base/content/test/webrtc/head.js
+++ b/browser/base/content/test/webrtc/head.js
@@ -366,20 +366,20 @@ function* closeStream(aAlreadyClosed, aF
 
   let promises;
   if (!aAlreadyClosed) {
     promises = [promiseObserverCalled("recording-device-events"),
                 promiseObserverCalled("recording-window-ended")];
   }
 
   info("closing the stream");
-  yield ContentTask.spawn(gBrowser.selectedBrowser, aFrameId, function*(aFrameId) {
+  yield ContentTask.spawn(gBrowser.selectedBrowser, aFrameId, function*(contentFrameId) {
     let global = content.wrappedJSObject;
-    if (aFrameId)
-      global = global.document.getElementById(aFrameId).contentWindow;
+    if (contentFrameId)
+      global = global.document.getElementById(contentFrameId).contentWindow;
     global.closeStream();
   });
 
   if (promises)
     yield Promise.all(promises);
 
   yield* assertWebRTCIndicatorStatus(null);
 }
@@ -408,22 +408,22 @@ function* checkSharingUI(aExpected, aWin
     is(sharing, "camera", "showing camera icon on the control center icon");
   else if (aExpected.audio)
     is(sharing, "microphone", "showing mic icon on the control center icon");
 
   // Then check the sharing indicators inside the control center panel.
   identityBox.click();
   let permissions = doc.getElementById("identity-popup-permission-list");
   for (let id of ["microphone", "camera", "screen"]) {
-    let convertId = id => {
-      if (id == "camera")
+    let convertId = idToConvert => {
+      if (idToConvert == "camera")
         return "video";
-      if (id == "microphone")
+      if (idToConvert == "microphone")
         return "audio";
-      return id;
+      return idToConvert;
     };
     let expected = aExpected[convertId(id)];
     is(!!aWin.gIdentityHandler._sharingState[id], !!expected,
        "sharing state for " + id + " as expected");
     let icon = permissions.querySelectorAll(
       ".identity-popup-permission-icon." + id + "-icon");
     if (expected) {
       is(icon.length, 1, "should show " + id + " icon in control center panel");
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1810,17 +1810,17 @@ file, You can obtain one at http://mozil
                   item.getAttribute("title"),
                   item.getAttribute("displayurl"),
                 ];
                 break;
               }
             }
 
             let types = item.getAttribute("type").split(/\s+/);
-            let type = types.find(type => type != "action" && type != "heuristic");
+            let type = types.find(t => t != "action" && t != "heuristic");
             try {
               // Some types intentionally do not map to strings, which is not
               // an error.
               parts.push(this._bundle.GetStringFromName(type + "ResultLabel"));
             } catch (e) {}
 
             return parts.filter(str => str).join(" ");
           ]]>
@@ -2658,19 +2658,19 @@ file, You can obtain one at http://mozil
       </method>
     </implementation>
 
     <handlers>
       <handler event="mouseover"><![CDATA[
         if (this.getAttribute("active") != "true") {
           this.setAttribute("active", "true");
 
-          let event = document.createEvent("Events");
-          event.initEvent("DOMMenuItemActive", true, false);
-          this.dispatchEvent(event);
+          let menuItemActiveEvent = document.createEvent("Events");
+          menuItemActiveEvent.initEvent("DOMMenuItemActive", true, false);
+          this.dispatchEvent(menuItemActiveEvent);
 
           if (this.getAttribute("disabled") != "true") {
             let self = this;
             setTimeout(function() {
               if (self.getAttribute("active") == "true")
                 self.menu.open = true;
             }, this._menuDelay);
           }
--- a/browser/components/contextualidentity/test/browser/browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js
+++ b/browser/components/contextualidentity/test/browser/browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js
@@ -75,12 +75,12 @@ add_task(function* test_cookie_getCookie
   let enumerator = Services.cookies.getCookiesWithOriginAttributes(JSON.stringify({}), TEST_HOST);
   while (enumerator.hasMoreElements()) {
     let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
     Services.cookies.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
   }
 
   // Check that whether cookies has been cleared.
   for (let userContextId of Object.keys(USER_CONTEXTS)) {
-    let enumerator = getCookiesForOA(TEST_HOST, userContextId);
-    ok(!enumerator.hasMoreElements(), "No Cookie should be here");
+    let e = getCookiesForOA(TEST_HOST, userContextId);
+    ok(!e.hasMoreElements(), "No Cookie should be here");
   }
 });
--- a/browser/components/contextualidentity/test/browser/browser_middleClick.js
+++ b/browser/components/contextualidentity/test/browser/browser_middleClick.js
@@ -10,20 +10,20 @@ add_task(function* () {
   let tab = gBrowser.addTab(URI, { userContextId: 1 });
   gBrowser.selectedTab = tab;
 
   let browser = gBrowser.getBrowserForTab(tab);
   yield BrowserTestUtils.browserLoaded(browser);
 
   info("Create a HTMLAnchorElement...");
   yield ContentTask.spawn(browser, URI,
-    function(URI) {
+    function(uri) {
       let anchor = content.document.createElement("a");
       anchor.setAttribute('id', 'clickMe');
-      anchor.setAttribute("href", URI);
+      anchor.setAttribute("href", uri);
       anchor.appendChild(content.document.createTextNode("click me!"));
       content.document.body.appendChild(anchor);
     }
   );
 
   info("Synthesize a mouse click and wait for a new tab...");
   let newTab = yield new Promise((resolve, reject) => {
     gBrowser.tabContainer.addEventListener("TabOpen", function onTabOpen(openEvent) {
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -1300,27 +1300,27 @@ var CustomizableUIInternal = {
           return node;
         }
       }
     }
 
     let toolboxes = gBuildWindows.get(aWindow);
     for (let toolbox of toolboxes) {
       if (toolbox.palette) {
-        // Attempt to locate a node with a matching ID within
+        // Attempt to locate an element with a matching ID within
         // the palette.
-        let node = toolbox.palette.getElementsByAttribute("id", aId)[0];
-        if (node) {
+        let element = toolbox.palette.getElementsByAttribute("id", aId)[0];
+        if (element) {
           // Normalize the removable attribute. For backwards compat, this
           // is optional if the widget is located in the toolbox palette,
           // and defaults to *true*, unlike if it was located elsewhere.
-          if (!node.hasAttribute("removable")) {
-            node.setAttribute("removable", true);
+          if (!element.hasAttribute("removable")) {
+            element.setAttribute("removable", true);
           }
-          return node;
+          return element;
         }
       }
     }
     return null;
   },
 
   buildWidget: function(aDocument, aWidget) {
     if (aDocument.documentURI != kExpectedWindowURL) {
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -200,24 +200,25 @@ const CustomizableWidgets = [
       // Get all statically placed buttons to supply them with keyboard shortcuts.
       let staticButtons = items.parentNode.getElementsByTagNameNS(kNSXUL, "toolbarbutton");
       for (let i = 0, l = staticButtons.length; i < l; ++i)
         CustomizableUI.addShortcut(staticButtons[i]);
 
       PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
                          .asyncExecuteLegacyQueries([query], 1, options, {
         handleResult: function(aResultSet) {
-          let onItemCommand = function(aEvent) {
+          let onItemCommand = function(aItemCommandEvent) {
             // Only handle the click event for middle clicks, we're using the command
             // event otherwise.
-            if (aEvent.type == "click" && aEvent.button != 1) {
+            if (aItemCommandEvent.type == "click" &&
+                aItemCommandEvent.button != 1) {
               return;
             }
-            let item = aEvent.target;
-            win.openUILink(item.getAttribute("targetURI"), aEvent);
+            let item = aItemCommandEvent.target;
+            win.openUILink(item.getAttribute("targetURI"), aItemCommandEvent);
             CustomizableUI.hidePanelForNode(item);
           };
           let fragment = doc.createDocumentFragment();
           let row;
           while ((row = aResultSet.getNextRow())) {
             let uri = row.getResultByIndex(1);
             let title = row.getResultByIndex(2);
             let icon = row.getResultByIndex(6);
@@ -694,35 +695,35 @@ const CustomizableWidgets = [
       let listener = {
         onWidgetAdded: function(aWidgetId, aArea, aPosition) {
           if (aWidgetId != this.id)
             return;
 
           updateCombinedWidgetStyle(node, aArea, true);
           updateZoomResetButton();
 
-          let areaType = CustomizableUI.getAreaType(aArea);
-          if (areaType == CustomizableUI.TYPE_MENU_PANEL) {
+          let newAreaType = CustomizableUI.getAreaType(aArea);
+          if (newAreaType == CustomizableUI.TYPE_MENU_PANEL) {
             let panel = aDocument.getElementById(kPanelId);
             panel.addEventListener("popupshowing", updateZoomResetButton);
-          } else if (areaType == CustomizableUI.TYPE_TOOLBAR) {
+          } else if (newAreaType == CustomizableUI.TYPE_TOOLBAR) {
             let container = window.gBrowser.tabContainer;
             container.addEventListener("TabSelect", updateZoomResetButton);
           }
         }.bind(this),
 
         onWidgetRemoved: function(aWidgetId, aPrevArea) {
           if (aWidgetId != this.id)
             return;
 
-          let areaType = CustomizableUI.getAreaType(aPrevArea);
-          if (areaType == CustomizableUI.TYPE_MENU_PANEL) {
+          let formerAreaType = CustomizableUI.getAreaType(aPrevArea);
+          if (formerAreaType == CustomizableUI.TYPE_MENU_PANEL) {
             let panel = aDocument.getElementById(kPanelId);
             panel.removeEventListener("popupshowing", updateZoomResetButton);
-          } else if (areaType == CustomizableUI.TYPE_TOOLBAR) {
+          } else if (formerAreaType == CustomizableUI.TYPE_TOOLBAR) {
             let container = window.gBrowser.tabContainer;
             container.removeEventListener("TabSelect", updateZoomResetButton);
           }
 
           // When a widget is demoted to the palette ('removed'), it's visual
           // style should change.
           updateCombinedWidgetStyle(node, null, true);
           updateZoomResetButton();
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1339,19 +1339,20 @@ CustomizeMode.prototype = {
   },
 
   onLWThemesMenuShowing: function(aEvent) {
     const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
     const RECENT_LWT_COUNT = 5;
 
     this._clearLWThemesMenu(aEvent.target);
 
-    function previewTheme(aEvent) {
-      LightweightThemeManager.previewTheme(aEvent.target.theme.id != DEFAULT_THEME_ID ?
-                                           aEvent.target.theme : null);
+    function previewTheme(aPreviewThemeEvent) {
+      LightweightThemeManager.previewTheme(
+        aPreviewThemeEvent.target.theme.id != DEFAULT_THEME_ID ?
+        aPreviewThemeEvent.target.theme : null);
     }
 
     function resetPreview() {
       LightweightThemeManager.resetPreview();
     }
 
     let onThemeSelected = panel => {
       this._updateLWThemeButtonIcon();
--- a/browser/components/customizableui/test/browser_947987_removable_default.js
+++ b/browser/components/customizableui/test/browser_947987_removable_default.js
@@ -49,18 +49,18 @@ add_task(function*() {
   ok(placement, "Widget should be placed.");
   is(placement && placement.area, kNavBar, "Widget should be in navbar");
 
   singleWrapper = widgetWrapper.forWindow(otherWin);
   ok(singleWrapper, "Widget should exist in other window.");
   if (singleWrapper) {
     ok(singleWrapper.node, "Widget node should exist in other window.");
     if (singleWrapper.node) {
-      let expectedParent = CustomizableUI.getCustomizeTargetForArea(kNavBar, otherWin);
-      is(singleWrapper.node.parentNode, expectedParent,
+      let expectedParentInOtherWin = CustomizableUI.getCustomizeTargetForArea(kNavBar, otherWin);
+      is(singleWrapper.node.parentNode, expectedParentInOtherWin,
          "Widget should be in navbar in other window.");
     }
   }
   CustomizableUI.destroyWidget(spec.id);
   yield promiseWindowClosed(otherWin);
 });
 
 add_task(function* asyncCleanup() {
--- a/browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
+++ b/browser/components/customizableui/test/browser_984455_bookmarks_items_reparenting.js
@@ -78,17 +78,17 @@ function checkSpecialContextMenus() {
     EventUtils.synthesizeMouseAtCenter(dropmarker, {});
     info("Waiting for bookmarks menu popup to show after clicking dropmarker.")
     yield shownPromise;
 
     for (let menuID in kSpecialItemIDs) {
       let menuItem = document.getElementById(menuID);
       let menuPopup = document.getElementById(kSpecialItemIDs[menuID]);
       info("Waiting to open menu for " + menuID);
-      let shownPromise = popupShown(menuPopup);
+      shownPromise = popupShown(menuPopup);
       menuPopup.openPopup(menuItem, null, 0, 0, false, false, null);
       yield shownPromise;
 
       yield checkPlacesContextMenu(menuPopup);
       info("Closing menu for " + menuID);
       yield closePopup(menuPopup);
     }
 
--- a/browser/components/customizableui/test/browser_987492_window_api.js
+++ b/browser/components/customizableui/test/browser_987492_window_api.js
@@ -16,19 +16,23 @@ add_task(function* testOneWindow() {
 add_task(function* testOpenCloseWindow() {
   let newWindow = null;
   let openListener = {
     onWindowOpened: function(window) {
       newWindow = window;
     }
   }
   CustomizableUI.addListener(openListener);
-  let win = yield openAndLoadWindow(null, true);
-  isnot(newWindow, null, "Should have gotten onWindowOpen event");
-  is(newWindow, win, "onWindowOpen event should have received expected window");
+
+  {
+    let win = yield openAndLoadWindow(null, true);
+    is(newWindow, win, "onWindowOpen event should have received expected window");
+    isnot(newWindow, null, "Should have gotten onWindowOpen event");
+  }
+
   CustomizableUI.removeListener(openListener);
 
   let windows = [];
   for (let win of CustomizableUI.windows)
     windows.push(win);
   is(windows.length, 2, "Should have two customizable windows");
   isnot(windows.indexOf(window), -1, "Current window should be in window collection.");
   isnot(windows.indexOf(newWindow), -1, "New window should be in window collection.");
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -204,19 +204,19 @@ function startCustomizing(aWindow = wind
   }
   aWindow.gNavToolbox.addEventListener("customizationready", onCustomizing);
   aWindow.gCustomizeMode.enter();
   return deferred.promise;
 }
 
 function promiseObserverNotified(aTopic) {
   let deferred = Promise.defer();
-  Services.obs.addObserver(function onNotification(aSubject, aTopic, aData) {
-    Services.obs.removeObserver(onNotification, aTopic);
-      deferred.resolve({subject: aSubject, data: aData});
+  Services.obs.addObserver(function onNotification(subject, topic, data) {
+    Services.obs.removeObserver(onNotification, topic);
+      deferred.resolve({subject, data});
     }, aTopic, false);
   return deferred.promise;
 }
 
 function openAndLoadWindow(aOptions, aWaitForDelayedStartup = false) {
   let deferred = Promise.defer();
   let win = OpenBrowserWindow(aOptions);
   if (aWaitForDelayedStartup) {
--- a/browser/components/feeds/WebContentConverter.js
+++ b/browser/components/feeds/WebContentConverter.js
@@ -430,23 +430,22 @@ WebContentConverterRegistrar.prototype =
     let notificationValue = "Protocol Registration: " + aProtocol;
     let addButton = {
       label: this._getString("addProtocolHandlerAddButton"),
       accessKey: this._getString("addProtocolHandlerAddButtonAccesskey"),
       protocolInfo: { protocol: aProtocol, uri: uri.spec, name: aTitle },
 
       callback(aNotification, aButtonInfo) {
           let protocol = aButtonInfo.protocolInfo.protocol;
-          let uri      = aButtonInfo.protocolInfo.uri;
           let name     = aButtonInfo.protocolInfo.name;
 
           let handler = Cc["@mozilla.org/uriloader/web-handler-app;1"].
                         createInstance(Ci.nsIWebHandlerApp);
           handler.name = name;
-          handler.uriTemplate = uri;
+          handler.uriTemplate = aButtonInfo.protocolInfo.uri;
 
           let eps = Cc["@mozilla.org/uriloader/external-protocol-service;1"].
                     getService(Ci.nsIExternalProtocolService);
           let handlerInfo = eps.getProtocolHandlerInfo(protocol);
           handlerInfo.possibleApplicationHandlers.appendElement(handler, false);
 
           // Since the user has agreed to add a new handler, chances are good
           // that the next time they see a handler of this type, they're going
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -957,22 +957,22 @@ BrowserGlue.prototype = {
 
     ProcessHangMonitor.init();
 
     // A channel for "remote troubleshooting" code...
     let channel = new WebChannel("remote-troubleshooting", "remote-troubleshooting");
     channel.listen((id, data, target) => {
       if (data.command == "request") {
         let {Troubleshoot} = Cu.import("resource://gre/modules/Troubleshoot.jsm", {});
-        Troubleshoot.snapshot(data => {
+        Troubleshoot.snapshot(snapshotData => {
           // for privacy we remove crash IDs and all preferences (but bug 1091944
           // exists to expose prefs once we are confident of privacy implications)
-          delete data.crashes;
-          delete data.modifiedPreferences;
-          channel.send(data, target);
+          delete snapshotData.crashes;
+          delete snapshotData.modifiedPreferences;
+          channel.send(snapshotData, target);
         });
       }
     });
 
     this._trackSlowStartup();
 
     // Offer to reset a user's profile if it hasn't been used for 60 days.
     const OFFER_PROFILE_RESET_INTERVAL_MS = 60 * 24 * 60 * 60 * 1000;
@@ -2364,18 +2364,18 @@ BrowserGlue.prototype = {
         }
 
         body = bundle.GetStringFromName(tabArrivingBody);
         body = PluralForm.get(URIs.length, body);
         body = body.replace("#1", URIs.length);
         body = body.replace("#2", deviceName);
       }
 
-      const clickCallback = (subject, topic, data) => {
-        if (topic == "alertclickcallback") {
+      const clickCallback = (obsSubject, obsTopic, obsData) => {
+        if (obsTopic == "alertclickcallback") {
           win.gBrowser.selectedTab = firstTab;
         }
       }
 
       // Specify an icon because on Windows no icon is shown at the moment
       let imageURL;
       if (AppConstants.platform == "win") {
         imageURL = "chrome://branding/content/icon64.png";
--- a/browser/components/originattributes/test/browser/browser_blobURLIsolation.js
+++ b/browser/components/originattributes/test/browser/browser_blobURLIsolation.js
@@ -3,32 +3,32 @@
  */
 
 const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/" +
                   "originattributes/test/browser/file_firstPartyBasic.html";
 const SCRIPT_WORKER_BLOBIFY = "worker_blobify.js";
 const SCRIPT_WORKER_DEBLOBIFY = "worker_deblobify.js";
 
 function page_blobify(browser, input) {
-  return ContentTask.spawn(browser, input, function(input) {
-    return { blobURL: content.URL.createObjectURL(new content.Blob([input])) };
+  return ContentTask.spawn(browser, input, function(contentInput) {
+    return { blobURL: content.URL.createObjectURL(new content.Blob([contentInput])) };
   });
 }
 
 function page_deblobify(browser, blobURL) {
-  return ContentTask.spawn(browser, blobURL, function* (blobURL) {
-    if ("error" in blobURL) {
-      return blobURL;
+  return ContentTask.spawn(browser, blobURL, function* (contentBlobURL) {
+    if ("error" in contentBlobURL) {
+      return contentBlobURL;
     }
-    blobURL = blobURL.blobURL;
+    contentBlobURL = contentBlobURL.blobURL;
 
-    function blobURLtoBlob(blobURL) {
+    function blobURLtoBlob(aBlobURL) {
       return new content.Promise(function(resolve) {
         let xhr = new content.XMLHttpRequest();
-        xhr.open("GET", blobURL, true);
+        xhr.open("GET", aBlobURL, true);
         xhr.onload = function() {
           resolve(xhr.response);
         };
         xhr.onerror = function() {
           resolve("xhr error");
         };
         xhr.responseType = "blob";
         xhr.send();
@@ -40,17 +40,17 @@ function page_deblobify(browser, blobURL
         let fileReader = new content.FileReader();
         fileReader.onload = function() {
           resolve(fileReader.result);
         };
         fileReader.readAsText(blob);
       });
     }
 
-    let blob = yield blobURLtoBlob(blobURL);
+    let blob = yield blobURLtoBlob(contentBlobURL);
     if (blob == "xhr error") {
       return "xhr error";
     }
 
     return yield blobToString(blob);
   });
 }
 
--- a/browser/components/originattributes/test/browser/browser_cookieIsolation.js
+++ b/browser/components/originattributes/test/browser/browser_cookieIsolation.js
@@ -6,25 +6,25 @@ const TEST_PAGE = "http://mochi.test:888
                   "originattributes/test/browser/file_firstPartyBasic.html";
 
 // Use a random key so we don't access it in later tests.
 const key = "key" + Math.random().toString();
 const re = new RegExp(key + "=([0-9\.]+)");
 
 // Define the testing function
 function* doTest(aBrowser) {
-  return yield ContentTask.spawn(aBrowser, {key, re},
-                                 function({key, re}) {
-    let result = re.exec(content.document.cookie);
+  return yield ContentTask.spawn(aBrowser, [key, re],
+                                 function([contentKey, contentRe]) {
+    let result = contentRe.exec(content.document.cookie);
     if (result) {
       return result[1];
     }
     // No value is found, so we create one.
     let value = Math.random().toString();
-    content.document.cookie = key + "=" + value;
+    content.document.cookie = contentKey + "=" + value;
     return value;
   });
 }
 
 registerCleanupFunction(() => {
     Services.cookies.removeAll();
 });
 
--- a/browser/components/originattributes/test/browser/browser_localStorageIsolation.js
+++ b/browser/components/originattributes/test/browser/browser_localStorageIsolation.js
@@ -5,20 +5,20 @@
 const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/" +
                   "originattributes/test/browser/file_firstPartyBasic.html";
 
 // Use a random key so we don't access it in later tests.
 const key = Math.random().toString();
 
 // Define the testing function
 function* doTest(aBrowser) {
-  return yield ContentTask.spawn(aBrowser, key, function(key) {
-    let value = content.localStorage.getItem(key);
+  return yield ContentTask.spawn(aBrowser, key, function(contentKey) {
+    let value = content.localStorage.getItem(contentKey);
     if (value === null) {
       // No value is found, so we create one.
       value = Math.random().toString();
-      content.localStorage.setItem(key, value);
+      content.localStorage.setItem(contentKey, value);
     }
     return value;
   });
 }
 
 IsolationTestTools.runTests(TEST_PAGE, doTest);
--- a/browser/components/originattributes/test/browser/worker_blobify.js
+++ b/browser/components/originattributes/test/browser/worker_blobify.js
@@ -1,11 +1,11 @@
 // Wait for a string to be posted to this worker.
 // Create a blob containing this string, and then
 // post back a blob URL pointing to the blob.
-self.addEventListener("message", function(e) {
+self.addEventListener("message", function(message) {
   try {
-    var blobURL = URL.createObjectURL(new Blob([e.data]));
+    var blobURL = URL.createObjectURL(new Blob([message.data]));
     postMessage({ blobURL });
   } catch (e) {
     postMessage({ error: e.message });
   }
 }, false);
--- a/browser/components/originattributes/test/browser/worker_deblobify.js
+++ b/browser/components/originattributes/test/browser/worker_deblobify.js
@@ -3,22 +3,22 @@
 // Post back the string.
 
 var postStringInBlob = function(blobObject) {
   var fileReader = new FileReaderSync();
   var result = fileReader.readAsText(blobObject);
   postMessage(result);
 };
 
-self.addEventListener("message", function(e) {
-  if ("error" in e.data) {
-    postMessage(e.data);
+self.addEventListener("message", function(message) {
+  if ("error" in message.data) {
+    postMessage(message.data);
     return;
   }
-  var blobURL = e.data.blobURL,
+  var blobURL = message.data.blobURL,
       xhr = new XMLHttpRequest();
   try {
     xhr.open("GET", blobURL, true);
     xhr.onload = function() {
       postStringInBlob(xhr.response);
     };
     xhr.onerror = function() {
       postMessage({ error: "xhr error" });
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -1205,40 +1205,40 @@ this.PlacesUIUtils = {
 
     if (leftPaneRoot != -1) {
       // A valid left pane folder has been found.
       // Build the leftPaneQueries Map.  This is used to quickly access them,
       // associating a mnemonic name to the real item ids.
       delete this.leftPaneQueries;
       this.leftPaneQueries = {};
 
-      let items = as.getItemsWithAnnotation(this.ORGANIZER_QUERY_ANNO);
+      let queryItems = as.getItemsWithAnnotation(this.ORGANIZER_QUERY_ANNO);
       // While looping through queries we will also check for their validity.
       let queriesCount = 0;
       let corrupt = false;
-      for (let i = 0; i < items.length; i++) {
-        let queryName = as.getItemAnnotation(items[i], this.ORGANIZER_QUERY_ANNO);
+      for (let i = 0; i < queryItems.length; i++) {
+        let queryName = as.getItemAnnotation(queryItems[i], this.ORGANIZER_QUERY_ANNO);
 
         // Some extension did use our annotation to decorate their items
         // with icons, so we should check only our elements, to avoid dataloss.
         if (!(queryName in queries))
           continue;
 
         let query = queries[queryName];
-        query.itemId = items[i];
+        query.itemId = queryItems[i];
 
         if (!itemExists(query.itemId)) {
           // Orphan annotation, bail out and create a new left pane root.
           corrupt = true;
           break;
         }
 
         // Check that all queries have valid parents.
         let parentId = bs.getFolderIdForItem(query.itemId);
-        if (!items.includes(parentId) && parentId != leftPaneRoot) {
+        if (!queryItems.includes(parentId) && parentId != leftPaneRoot) {
           // The parent is not part of the left pane, bail out and create a new
           // left pane root.
           corrupt = true;
           break;
         }
 
         // Titles could have been corrupted or the user could have changed his
         // locale.  Check title and eventually fix it.
@@ -1257,17 +1257,17 @@ this.PlacesUIUtils = {
       // Note: it's not enough to just check for queriesCount, since we may
       // find an invalid query just after accounting for a sufficient number of
       // valid ones.  As well as we can't just rely on corrupt since we may find
       // less valid queries than expected.
       if (corrupt || queriesCount != EXPECTED_QUERY_COUNT) {
         // Queries number is wrong, so the left pane must be corrupt.
         // Note: we can't just remove the leftPaneRoot, because some query could
         // have a bad parent, so we have to remove all items one by one.
-        items.forEach(safeRemoveItem);
+        queryItems.forEach(safeRemoveItem);
         safeRemoveItem(leftPaneRoot);
       }
       else {
         // Everything is fine, return the current left pane folder.
         delete this.leftPaneFolderId;
         return this.leftPaneFolderId = leftPaneRoot;
       }
     }
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -171,19 +171,20 @@ PlacesController.prototype = {
         let rootNode = this._view.result.root;
         if (rootNode.containerOpen && rootNode.childCount > 0)
           return true;
       }
       return false;
     case "placesCmd_open":
     case "placesCmd_open:window":
     case "placesCmd_open:privatewindow":
-    case "placesCmd_open:tab":
-      var selectedNode = this._view.selectedNode;
+    case "placesCmd_open:tab": {
+      let selectedNode = this._view.selectedNode;
       return selectedNode && PlacesUtils.nodeIsURI(selectedNode);
+    }
     case "placesCmd_new:folder":
       return this._canInsert();
     case "placesCmd_new:bookmark":
       return this._canInsert();
     case "placesCmd_new:separator":
       return this._canInsert() &&
              !PlacesUtils.asQuery(this._view.result.root).queryOptions.excludeItems &&
              this._view.result.sortingMode ==
@@ -805,31 +806,31 @@ PlacesController.prototype = {
     /**
      * Determines if a node is contained by another node within a resultset.
      * @param   node
      *          The node to check for containment for
      * @param   parent
      *          The parent container to check for containment in
      * @return true if node is a member of parent's children, false otherwise.
      */
-    function isContainedBy(node, parent) {
+    function isNodeContainedBy(parent) {
       var cursor = node.parent;
       while (cursor) {
         if (cursor == parent)
           return true;
         cursor = cursor.parent;
       }
       return false;
     }
 
-      for (var j = 0; j < pastFolders.length; ++j) {
-        if (isContainedBy(node, pastFolders[j]))
-          return true;
-      }
-      return false;
+    for (var j = 0; j < pastFolders.length; ++j) {
+      if (isNodeContainedBy(pastFolders[j]))
+        return true;
+    }
+    return false;
   },
 
   /**
    * Creates a set of transactions for the removal of a range of items.
    * A range is an array of adjacent nodes in a view.
    * @param   [in] range
    *          An array of nodes to remove. Should all be adjacent.
    * @param   [out] transactions
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -721,17 +721,17 @@ var gEditItemOverlay = {
    * folder. If the items-count limit (see MAX_FOLDERS_IN_MENU_LIST) is reached,
    * the new item replaces the last menu-item.
    * @param aFolderId
    *        The identifier of the bookmarks folder.
    */
   _getFolderMenuItem(aFolderId) {
     let menupopup = this._folderMenuList.menupopup;
     let menuItem = Array.prototype.find.call(
-      menupopup.childNodes, menuItem => menuItem.folderId === aFolderId);
+      menupopup.childNodes, item => item.folderId === aFolderId);
     if (menuItem !== undefined)
       return menuItem;
 
     // 3 special folders + separator + folder-items-count limit
     if (menupopup.childNodes.length == 4 + MAX_FOLDER_ITEM_IN_MENU_LIST)
       menupopup.removeChild(menupopup.lastChild);
 
     return this._appendFolderItemToMenupopup(menupopup, aFolderId);
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -317,17 +317,16 @@
                 parentElt.id == "goPopup")
               return;
 
             parentElt = parentElt.parentNode;
           }
         }
 
         if (window.XULBrowserWindow) {
-          let elt = event.target;
           let placesNode = elt._placesNode;
 
           var linkURI;
           if (placesNode && PlacesUtils.nodeIsURI(placesNode))
             linkURI = placesNode.uri;
           else if (elt.hasAttribute("targetURI"))
             linkURI = elt.getAttribute("targetURI");
 
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -793,50 +793,52 @@ var PlacesSearchBox = {
     let currentOptions = PO.getCurrentOptions();
 
     // Search according to the current scope, which was set by
     // PQB_setScope()
     switch (PlacesSearchBox.filterCollection) {
       case "bookmarks":
         currentView.applyFilter(filterString, this.folders);
         break;
-      case "history":
+      case "history": {
         if (currentOptions.queryType != Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY) {
-          var query = PlacesUtils.history.getNewQuery();
+          let query = PlacesUtils.history.getNewQuery();
           query.searchTerms = filterString;
-          var options = currentOptions.clone();
+          let options = currentOptions.clone();
           // Make sure we're getting uri results.
           options.resultType = currentOptions.RESULTS_AS_URI;
           options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
           options.includeHidden = true;
           currentView.load([query], options);
         }
         else {
           TelemetryStopwatch.start(HISTORY_LIBRARY_SEARCH_TELEMETRY);
           currentView.applyFilter(filterString, null, true);
           TelemetryStopwatch.finish(HISTORY_LIBRARY_SEARCH_TELEMETRY);
         }
         break;
-      case "downloads":
+      }
+      case "downloads": {
         if (currentView == ContentTree.view) {
           let query = PlacesUtils.history.getNewQuery();
           query.searchTerms = filterString;
           query.setTransitions([Ci.nsINavHistoryService.TRANSITION_DOWNLOAD], 1);
           let options = currentOptions.clone();
           // Make sure we're getting uri results.
           options.resultType = currentOptions.RESULTS_AS_URI;
           options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
           options.includeHidden = true;
           currentView.load([query], options);
         }
         else {
           // The new downloads view doesn't use places for searching downloads.
           currentView.searchTerm = filterString;
         }
         break;
+      }
       default:
         throw "Invalid filterCollection on search";
     }
 
     // Update the details panel
     PlacesOrganizer.updateDetailsPane();
   },
 
--- a/browser/components/places/content/tree.xml
+++ b/browser/components/places/content/tree.xml
@@ -163,17 +163,17 @@
         -->
       <method name="selectPlaceURI">
         <parameter name="placeURI"/>
         <body><![CDATA[
           // Do nothing if a node matching the given uri is already selected
           if (this.hasSelection && this.selectedNode.uri == placeURI)
             return;
 
-          function findNode(container, placeURI, nodesURIChecked) {
+          function findNode(container, nodesURIChecked) {
             var containerURI = container.uri;
             if (containerURI == placeURI)
               return container;
             if (nodesURIChecked.includes(containerURI))
               return null;
 
             // never check the contents of the same query
             nodesURIChecked.push(containerURI);
@@ -182,34 +182,34 @@
             if (!wasOpen)
               container.containerOpen = true;
             for (var i = 0; i < container.childCount; ++i) {
               var child = container.getChild(i);
               var childURI = child.uri;
               if (childURI == placeURI)
                 return child;
               else if (PlacesUtils.nodeIsContainer(child)) {
-                var nested = findNode(PlacesUtils.asContainer(child), placeURI, nodesURIChecked);
+                var nested = findNode(PlacesUtils.asContainer(child), nodesURIChecked);
                 if (nested)
                   return nested;
               }
             }
 
             if (!wasOpen)
               container.containerOpen = false;
 
             return null;
           }
 
           var container = this.result.root;
           NS_ASSERT(container, "No result, cannot select place URI!");
           if (!container)
             return;
 
-          var child = findNode(container, placeURI, []);
+          var child = findNode(container, []);
           if (child)
             this.selectNode(child);
           else {
             // If the specified child could not be located, clear the selection
             var selection = this.view.selection;
             selection.clearSelection();
           }
         ]]></body>
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -708,17 +708,17 @@ PlacesTreeView.prototype = {
 
     // Remove the node and its children, if any.
     let count = this._countVisibleRowsForNodeAtRow(oldRow);
     this._rows.splice(oldRow, count);
     this._tree.rowCountChanged(oldRow, -count);
 
     // Redraw the parent if its twisty state has changed.
     if (aParentNode != this._rootNode && !aParentNode.hasChildren) {
-      let parentRow = oldRow - 1;
+      parentRow = oldRow - 1;
       this._tree.invalidateRow(parentRow);
     }
 
     // Restore selection if the node was exclusively selected.
     if (!selectNext)
       return;
 
     // Restore selection.
@@ -1179,18 +1179,18 @@ PlacesTreeView.prototype = {
                  nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT) {
           if (this._controller.hasCachedLivemarkInfo(node)) {
             properties += " livemark";
           }
           else {
             PlacesUtils.livemarks.getLivemark({ id: node.itemId })
               .then(aLivemark => {
                 this._controller.cacheLivemarkInfo(node, aLivemark);
-                let props = this._cellProperties.get(node);
-                this._cellProperties.set(node, props += " livemark");
+                let livemarkProps = this._cellProperties.get(node);
+                this._cellProperties.set(node, livemarkProps += " livemark");
                 // The livemark attribute is set as a cell property on the title cell.
                 this._invalidateCellValue(node, this.COLUMN_TYPE_TITLE);
               }, () => undefined);
           }
         }
 
         if (itemId != -1) {
           let queryName = PlacesUIUtils.getLeftPaneQueryNameFromId(itemId);
--- a/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
+++ b/browser/components/places/tests/browser/browser_410196_paste_into_tags.js
@@ -18,25 +18,25 @@ add_task(function* () {
 
   let ContentTree = organizer.ContentTree;
   ok(ContentTree, "ContentTree is in scope");
 
   let visits = {uri: MOZURISPEC, transition: PlacesUtils.history.TRANSITION_TYPED};
   yield PlacesTestUtils.addVisits(visits);
 
   // create an initial tag to work with
-  let bm = yield PlacesUtils.bookmarks.insert({
+  let newBookmark = yield PlacesUtils.bookmarks.insert({
     parentGuid: PlacesUtils.bookmarks.unfiledGuid,
     index: PlacesUtils.bookmarks.DEFAULT_INDEX,
     type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
     title: "bookmark/" + TEST_URL.spec,
     url: TEST_URL
   });
 
-  ok(bm, "A bookmark was added");
+  ok(newBookmark, "A bookmark was added");
   PlacesUtils.tagging.tagURI(TEST_URL, ["foo"]);
   let tags = PlacesUtils.tagging.getTagsForURI(TEST_URL);
   is(tags[0], "foo", "tag is foo");
 
   // focus the new tag
   focusTag(PlacesOrganizer);
 
   let populate = () => copyHistNode(PlacesOrganizer, ContentTree);
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_addLivemark.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_addLivemark.js
@@ -10,17 +10,17 @@ add_task(function* () {
     yield withBookmarksDialog(
       true,
       function openDialog() {
         PlacesCommandHook.addLiveBookmark("http://livemark.com/",
                                           "livemark", "description");
       },
       function* test(dialogWin) {
         let promiseTitleChangeNotification = promiseBookmarksNotification(
-          "onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "modified");
+          "onItemChanged", (unused, prop, isAnno, val) => prop == "title" && val == "modified");
 
         fillBookmarkTextField("editBMPanel_namePicker", "modified", dialogWin);
 
         yield promiseTitleChangeNotification;
 
         let bookmark = yield PlacesUtils.bookmarks.fetch({
           parentGuid: PlacesUtils.bookmarks.toolbarGuid,
           index: PlacesUtils.bookmarks.DEFAULT_INDEX
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -399,30 +399,30 @@ function open_properties_dialog() {
     ok(tree.selectedNode,
        "We have a places node selected: " + tree.selectedNode.title);
 
     // Wait for the Properties dialog.
     function windowObserver(aSubject, aTopic, aData) {
       if (aTopic != "domwindowopened")
         return;
       ww.unregisterNotification(windowObserver);
-      let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
+      let observerWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
       waitForFocus(() => {
         // Windows has been loaded, execute our test now.
         executeSoon(function() {
           // Ensure overlay is loaded
-          ok(win.gEditItemOverlay.initialized, "EditItemOverlay is initialized");
-          gCurrentTest.window = win;
+          ok(observerWindow.gEditItemOverlay.initialized, "EditItemOverlay is initialized");
+          gCurrentTest.window = observerWindow;
           try {
             gCurrentTest.run();
           } catch (ex) {
             ok(false, "An error occured during test run: " + ex.message);
           }
         });
-      }, win);
+      }, observerWindow);
     }
     ww.registerNotification(windowObserver);
 
     var command = null;
     switch (gCurrentTest.action) {
       case ACTION_EDIT:
         command = "placesCmd_show:info";
         break;
--- a/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
+++ b/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
@@ -221,20 +221,20 @@ var gTests = [
             });
         });
     }
   },
 ];
 
 function nextTest() {
   if (gTests.length) {
-    var test = gTests.shift();
+    var testCase = gTests.shift();
     waitForFocus(function() {
-      info("Start of test: " + test.desc);
-      test.run();
+      info("Start of test: " + testCase.desc);
+      testCase.run();
     });
   }
   else if (wasCollapsed) {
     // Collapse the personal toolbar if needed.
     promiseSetToolbarVisibility(toolbar, false).then(finish);
   } else {
     finish();
   }
--- a/browser/components/places/tests/browser/browser_library_batch_delete.js
+++ b/browser/components/places/tests/browser/browser_library_batch_delete.js
@@ -97,18 +97,18 @@ function test() {
                .removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
   });
 
   gLibrary = openLibrary(nextTest);
 }
 
 function nextTest() {
   if (gTests.length) {
-    var test = gTests.shift();
-    info("Start of test: " + test.desc);
-    test.run();
+    var testCase = gTests.shift();
+    info("Start of test: " + testCase.desc);
+    testCase.run();
   }
   else {
     // Close Library window.
     gLibrary.close();
     finish();
   }
 }
--- a/browser/components/places/tests/browser/browser_library_infoBox.js
+++ b/browser/components/places/tests/browser/browser_library_infoBox.js
@@ -164,20 +164,20 @@ function getAndCheckElmtById(id) {
   isnot(elmt, null, "Correctly got element: #" + id);
   return elmt;
 }
 
 // ------------------------------------------------------------------------------
 
 function nextTest() {
   if (gTests.length) {
-    var test = gTests.shift();
-    ok(true, "TEST: " + test.desc);
-    dump("TEST: " + test.desc + "\n");
-    test.run();
+    var testCase = gTests.shift();
+    ok(true, "TEST: " + testCase.desc);
+    dump("TEST: " + testCase.desc + "\n");
+    testCase.run();
   }
   else {
     // Close Library window.
     gLibrary.close();
     // No need to cleanup anything, we have a correct left pane now.
     finish();
   }
 }
--- a/browser/components/places/tests/browser/browser_sort_in_library.js
+++ b/browser/components/places/tests/browser/browser_sort_in_library.js
@@ -182,31 +182,31 @@ function testSortByColAndDir(aOrganizerW
     let col = cols.item(i);
     ok(col.hasAttribute("anonid"),
        "sanity check: column " + col.id + " should have anonid");
 
     let colId = col.getAttribute("anonid");
     ok(colId in SORT_LOOKUP_TABLE,
        "sanity check: unexpected placeContent column anonid");
 
-    let sortConst =
+    let sortStr =
       "SORT_BY_" + SORT_LOOKUP_TABLE[colId].key + "_" +
       (aUnsortFirst ? SORT_LOOKUP_TABLE[colId].dir : prevSortDir);
-    let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortConst];
+    let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortStr];
     let expectedAnno = SORT_LOOKUP_TABLE[colId].anno || "";
 
     // Test sorting by only a column.
     setSort(aOrganizerWin, aPlaceContentTree, aUnsortFirst, false, col);
     checkSort(aPlaceContentTree, expectedSortMode, expectedAnno);
 
     // Test sorting by both a column and a direction.
     ["ascending", "descending"].forEach(function(dir) {
-      let sortConst =
+      sortStr =
         "SORT_BY_" + SORT_LOOKUP_TABLE[colId].key + "_" + dir.toUpperCase();
-      let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortConst];
+      expectedSortMode = Ci.nsINavHistoryQueryOptions[sortStr];
       setSort(aOrganizerWin, aPlaceContentTree, aUnsortFirst, false, col, dir);
       checkSort(aPlaceContentTree, expectedSortMode, expectedAnno);
     });
   }
 }
 
 /**
  * Tests sorting aPlaceContentTree by direction only.
@@ -216,18 +216,18 @@ function testSortByColAndDir(aOrganizerW
  * @param aPlaceContentTree
  *        the placeContent tree in aOrganizerWin
  * @param aUnsortFirst
  *        true if, before each sort we try, we should sort to SORT_BY_NONE
  */
 function testSortByDir(aOrganizerWin, aPlaceContentTree, aUnsortFirst) {
   ["ascending", "descending"].forEach(function(dir) {
     let key = (aUnsortFirst ? DEFAULT_SORT_KEY : prevSortKey);
-    let sortConst = "SORT_BY_" + key + "_" + dir.toUpperCase();
-    let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortConst];
+    let sortStr = "SORT_BY_" + key + "_" + dir.toUpperCase();
+    let expectedSortMode = Ci.nsINavHistoryQueryOptions[sortStr];
     setSort(aOrganizerWin, aPlaceContentTree, aUnsortFirst, false, null, dir);
     checkSort(aPlaceContentTree, expectedSortMode, "");
   });
 }
 
 function test() {
   waitForExplicitFinish();
 
--- a/browser/components/places/tests/browser/browser_views_liveupdate.js
+++ b/browser/components/places/tests/browser/browser_views_liveupdate.js
@@ -307,17 +307,17 @@ function searchItemInView(aItemId, aView
 /**
  * Get places node and index for an itemId in bookmarks toolbar view.
  *
  * @param aItemId
  *        item id of the item to search.
  * @returns [node, index] or [null, null] if not found.
  */
 function getNodeForToolbarItem(aItemId, aValidator) {
-  var toolbar = document.getElementById("PlacesToolbarItems");
+  var placesToolbarItems = document.getElementById("PlacesToolbarItems");
 
   function findNode(aContainer) {
     var children = aContainer.childNodes;
     for (var i = 0, staticNodes = 0; i < children.length; i++) {
       var child = children[i];
 
       // Is this a Places node?
       if (!child._placesNode || child.hasAttribute("simulated-places-node")) {
@@ -339,17 +339,17 @@ function getNodeForToolbarItem(aItemId, 
         popup.hidePopup();
         if (foundNode[0] != null)
           return foundNode;
       }
     }
     return [null, null];
   }
 
-  return findNode(toolbar);
+  return findNode(placesToolbarItems);
 }
 
 /**
  * Get places node and index for an itemId in bookmarks menu view.
  *
  * @param aItemId
  *        item id of the item to search.
  * @returns [node, index] or [null, null] if not found.
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -9,18 +9,18 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 var cachedLeftPaneFolderIdGetter;
 var getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
 if (!cachedLeftPaneFolderIdGetter && typeof(getter) == "function") {
   cachedLeftPaneFolderIdGetter = getter;
 }
 
 // ...And restore it when test ends.
 registerCleanupFunction(function() {
-  let getter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
-  if (cachedLeftPaneFolderIdGetter && typeof(getter) != "function") {
+  let updatedGetter = PlacesUIUtils.__lookupGetter__("leftPaneFolderId");
+  if (cachedLeftPaneFolderIdGetter && typeof(updatedGetter) != "function") {
     PlacesUIUtils.__defineGetter__("leftPaneFolderId", cachedLeftPaneFolderIdGetter);
   }
 });
 
 function openLibrary(callback, aLeftPaneRoot) {
   let library = window.openDialog("chrome://browser/content/places/places.xul",
                                   "", "chrome,toolbar=yes,dialog=no,resizable",
                                   aLeftPaneRoot);
@@ -145,17 +145,17 @@ function synthesizeClickOnSelectedTreeCe
  * @param aURI The URI.
  * @return {Promise}
  * @resolves When the check has been added successfully.
  * @rejects JavaScript exception.
  */
 function promiseIsURIVisited(aURI) {
   let deferred = Promise.defer();
 
-  PlacesUtils.asyncHistory.isURIVisited(aURI, function(aURI, aIsVisited) {
+  PlacesUtils.asyncHistory.isURIVisited(aURI, function(unused, aIsVisited) {
     deferred.resolve(aIsVisited);
   });
 
   return deferred.promise;
 }
 
 function promiseBookmarksNotification(notification, conditionFn) {
   info(`promiseBookmarksNotification: waiting for ${notification}`);
--- a/browser/components/preferences/in-content/applications.js
+++ b/browser/components/preferences/in-content/applications.js
@@ -1406,18 +1406,18 @@ var gApplicationsPane = {
       internalMenuItem.setAttribute("label", label);
       internalMenuItem.setAttribute("tooltiptext", label);
       internalMenuItem.setAttribute(APP_ICON_ATTR_NAME, "feed");
       menuPopup.appendChild(internalMenuItem);
     }
 
     // Add a separator to distinguish these items from the helper app items
     // that follow them.
-    let menuItem = document.createElement("menuseparator");
-    menuPopup.appendChild(menuItem);
+    let menuseparator = document.createElement("menuseparator");
+    menuPopup.appendChild(menuseparator);
 
     // Create a menu item for the OS default application, if any.
     if (handlerInfo.hasDefaultHandler) {
       var defaultMenuItem = document.createElement("menuitem");
       defaultMenuItem.setAttribute("action", Ci.nsIHandlerInfo.useSystemDefault);
       let label = this._prefsBundle.getFormattedString("useDefault",
                                                        [handlerInfo.defaultDescription]);
       defaultMenuItem.setAttribute("label", label);
@@ -1755,18 +1755,18 @@ var gApplicationsPane = {
         if (aResult == Ci.nsIFilePicker.returnOK && fp.file &&
             this._isValidHandlerExecutable(fp.file)) {
           handlerApp = Cc["@mozilla.org/uriloader/local-handler-app;1"].
                        createInstance(Ci.nsILocalHandlerApp);
           handlerApp.name = getFileDisplayName(fp.file);
           handlerApp.executable = fp.file;
 
           // Add the app to the type's list of possible handlers.
-          let handlerInfo = this._handledTypes[this._list.selectedItem.type];
-          handlerInfo.addPossibleApplicationHandler(handlerApp);
+          let handler = this._handledTypes[this._list.selectedItem.type];
+          handler.addPossibleApplicationHandler(handlerApp);
 
           chooseAppCallback(handlerApp);
         }
       }.bind(this);
 
       // Prompt the user to pick an app.  If they pick one, and it's a valid
       // selection, then add it to the list of possible handlers.
       fp.init(window, winTitle, Ci.nsIFilePicker.modeOpen);
--- a/browser/components/preferences/in-content/sync.js
+++ b/browser/components/preferences/in-content/sync.js
@@ -147,18 +147,18 @@ var gSyncPane = {
     document.getElementById("fxaMobilePromo-ios").setAttribute("href", url);
     document.getElementById("fxaMobilePromo-ios-hasFxaAccount").setAttribute("href", url);
 
     document.getElementById("tosPP-small-ToS").setAttribute("href", gSyncUtils.tosURL);
     document.getElementById("tosPP-normal-ToS").setAttribute("href", gSyncUtils.tosURL);
     document.getElementById("tosPP-small-PP").setAttribute("href", gSyncUtils.privacyPolicyURL);
     document.getElementById("tosPP-normal-PP").setAttribute("href", gSyncUtils.privacyPolicyURL);
 
-    fxAccounts.promiseAccountsManageURI(this._getEntryPoint()).then(url => {
-      document.getElementById("verifiedManage").setAttribute("href", url);
+    fxAccounts.promiseAccountsManageURI(this._getEntryPoint()).then(accountsManageURI => {
+      document.getElementById("verifiedManage").setAttribute("href", accountsManageURI);
     });
 
     this.updateWeavePrefs();
 
     this._initProfileImageUI();
   },
 
   _toggleComputerNameControls: function(editMode) {
--- a/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
+++ b/browser/components/preferences/in-content/tests/browser_cookies_exceptions.js
@@ -287,20 +287,20 @@ var testRunner = {
 
               if (expected.origin) {
                 is(permission.principal.origin, expected.origin,
                    "property: \"origin\" should be equal");
               }
 
               os.removeObserver(permObserver, "perm-changed");
 
-              let test = testRunner.tests[testRunner._currentTest];
-              if (!test.expectPermObservancesDuringTestFunction) {
-                if (test.cleanUp) {
-                  test.cleanUp(params);
+              let testCase = testRunner.tests[testRunner._currentTest];
+              if (!testCase.expectPermObservancesDuringTestFunction) {
+                if (testCase.cleanUp) {
+                  testCase.cleanUp(params);
                 }
 
                 gBrowser.removeCurrentTab();
                 resolve();
               }
             },
           };
 
@@ -309,21 +309,21 @@ var testRunner = {
 
           os.addObserver(permObserver, "perm-changed", false);
 
           if (testRunner._currentTest == 0) {
             is(params.tree.view.rowCount, 0, "no cookie exceptions");
           }
 
           try {
-            let test = testRunner.tests[testRunner._currentTest];
-            test.test(params);
-            if (test.expectPermObservancesDuringTestFunction) {
-              if (test.cleanUp) {
-                test.cleanUp(params);
+            let testCase = testRunner.tests[testRunner._currentTest];
+            testCase.test(params);
+            if (testCase.expectPermObservancesDuringTestFunction) {
+              if (testCase.cleanUp) {
+                testCase.cleanUp(params);
               }
 
               gBrowser.removeCurrentTab();
               resolve();
             }
           } catch (ex) {
             ok(false, "exception while running test #" +
                       testNumber + ": " + ex);
--- a/browser/components/preferences/in-content/tests/browser_defaultbrowser_alwayscheck.js
+++ b/browser/components/preferences/in-content/tests/browser_defaultbrowser_alwayscheck.js
@@ -72,32 +72,32 @@ add_task(function* clicking_make_default
 });
 
 registerCleanupFunction(function() {
   Services.prefs.unlockPref("browser.shell.checkDefaultBrowser");
   Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", CHECK_DEFAULT_INITIAL);
 });
 
 function* test_with_mock_shellservice(options, testFn) {
-  yield ContentTask.spawn(gBrowser.selectedBrowser, options, function*(options) {
+  yield ContentTask.spawn(gBrowser.selectedBrowser, options, function*(contentOptions) {
     let doc = content.document;
     let win = doc.defaultView;
     win.oldShellService = win.getShellService();
     let mockShellService = {
       _isDefault: false,
       isDefaultBrowser() {
         return this._isDefault;
       },
       setDefaultBrowser() {
         this._isDefault = true;
       },
     };
     win.getShellService = function() {
       return mockShellService;
     }
-    mockShellService._isDefault = options.isDefault;
+    mockShellService._isDefault = contentOptions.isDefault;
     win.gMainPane.updateSetDefaultBrowser();
   });
 
   yield ContentTask.spawn(gBrowser.selectedBrowser, null, testFn);
 
   Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", CHECK_DEFAULT_INITIAL);
 }
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js
+++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js
@@ -10,27 +10,26 @@
 const gDialogURL = getRootDirectory(gTestPath) + "subdialog.xul";
 const gDialogURL2 = getRootDirectory(gTestPath) + "subdialog2.xul";
 
 function* open_subdialog_and_test_generic_start_state(browser, domcontentloadedFn, url = gDialogURL) {
   let domcontentloadedFnStr = domcontentloadedFn ?
     "(" + domcontentloadedFn.toString() + ")()" :
     "";
   return ContentTask.spawn(browser, {url, domcontentloadedFnStr}, function*(args) {
-    let {url, domcontentloadedFnStr} = args;
     let rv = { acceptCount: 0 };
     let win = content.window;
     let subdialog = win.gSubDialog;
-    subdialog.open(url, null, rv);
+    subdialog.open(args.url, null, rv);
 
     info("waiting for subdialog DOMFrameContentLoaded");
     yield ContentTaskUtils.waitForEvent(win, "DOMFrameContentLoaded", true);
     let result;
-    if (domcontentloadedFnStr) {
-      result = eval(domcontentloadedFnStr);
+    if (args.domcontentloadedFnStr) {
+      result = eval(args.domcontentloadedFnStr);
     }
 
     info("waiting for subdialog load");
     yield ContentTaskUtils.waitForEvent(subdialog._frame, "load");
     info("subdialog window is loaded");
 
     let expectedStyleSheetURLs = subdialog._injectedStyleSheets.slice(0);
     for (let styleSheet of subdialog._frame.contentDocument.styleSheets) {
@@ -54,29 +53,29 @@ function* open_subdialog_and_test_generi
 function* close_subdialog_and_test_generic_end_state(browser, closingFn, closingButton, acceptCount, options) {
   let dialogclosingPromise = ContentTask.spawn(browser, {closingButton, acceptCount}, function*(expectations) {
     let win = content.window;
     let subdialog = win.gSubDialog;
     let frame = subdialog._frame;
     info("waiting for dialogclosing");
     let closingEvent =
       yield ContentTaskUtils.waitForEvent(frame.contentWindow, "dialogclosing");
-    let closingButton = closingEvent.detail.button;
+    let contentClosingButton = closingEvent.detail.button;
     let actualAcceptCount = frame.contentWindow.arguments &&
                             frame.contentWindow.arguments[0].acceptCount;
 
     info("waiting for about:blank load");
     yield ContentTaskUtils.waitForEvent(frame, "load");
 
     Assert.notEqual(win.getComputedStyle(subdialog._overlay, "").visibility, "visible",
       "overlay is not visible");
     Assert.equal(frame.getAttribute("style"), "", "inline styles should be cleared");
     Assert.equal(frame.contentWindow.location.href.toString(), "about:blank",
       "sub-dialog should be unloaded");
-    Assert.equal(closingButton, expectations.closingButton,
+    Assert.equal(contentClosingButton, expectations.closingButton,
       "closing event should indicate button was '" + expectations.closingButton + "'");
     Assert.equal(actualAcceptCount, expectations.acceptCount,
       "should be 1 if accepted, 0 if canceled, undefined if closed w/out button");
   });
 
   if (options && options.runClosingFnOutsideOfContentTask) {
     yield closingFn();
   } else {
@@ -212,40 +211,40 @@ add_task(function* correct_width_and_hei
     function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
     null, 0);
 });
 
 add_task(function* wrapped_text_in_dialog_should_have_expected_scrollHeight() {
   let oldHeight = yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, function domcontentloadedFn() {
     let frame = content.window.gSubDialog._frame;
     let doc = frame.contentDocument;
-    let oldHeight = doc.documentElement.scrollHeight;
+    let scrollHeight = doc.documentElement.scrollHeight;
     doc.documentElement.style.removeProperty("height");
     doc.getElementById("desc").textContent = `
       Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque
       laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
       architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
       sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
       laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
       architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
       sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
       laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi
       architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas
       sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione
       voluptatem sequi nesciunt.`
-    return oldHeight;
+    return scrollHeight;
   });
 
-  yield ContentTask.spawn(tab.linkedBrowser, oldHeight, function*(oldHeight) {
+  yield ContentTask.spawn(tab.linkedBrowser, oldHeight, function*(contentOldHeight) {
     let frame = content.window.gSubDialog._frame;
     let docEl = frame.contentDocument.documentElement;
     Assert.equal(frame.style.width, "32em",
       "Width should be set on the frame from the dialog");
-    Assert.ok(docEl.scrollHeight > oldHeight,
-      "Content height increased (from " + oldHeight + " to " + docEl.scrollHeight + ").");
+    Assert.ok(docEl.scrollHeight > contentOldHeight,
+      "Content height increased (from " + contentOldHeight + " to " + docEl.scrollHeight + ").");
     Assert.equal(frame.style.height, docEl.scrollHeight + "px",
       "Height on the frame should be higher now");
   });
 
   yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
     function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
     null, 0);
 });
--- a/browser/components/search/test/browser_aboutSearchReset.js
+++ b/browser/components/search/test/browser_aboutSearchReset.js
@@ -128,29 +128,29 @@ var gTests = [
 function test()
 {
   waitForExplicitFinish();
   Task.spawn(function* () {
     let oldCanRecord = Services.telemetry.canRecordExtended;
     Services.telemetry.canRecordExtended = true;
     checkTelemetryRecords();
 
-    for (let test of gTests) {
-      info(test.desc);
+    for (let testCase of gTests) {
+      info(testCase.desc);
 
       // Create a tab to run the test.
       let tab = gBrowser.selectedTab = gBrowser.addTab("about:blank");
 
       // Start loading about:searchreset and wait for it to complete.
       let url = "about:searchreset?data=" + encodeURIComponent(kSearchStr) +
                 "&purpose=" + kSearchPurpose;
       yield promiseTabLoadEvent(tab, url);
 
       info("Running test");
-      yield test.run();
+      yield testCase.run();
 
       info("Cleanup");
       gBrowser.removeCurrentTab();
     }
 
     Services.telemetry.canRecordExtended = oldCanRecord;
   }).then(finish, ex => {
     ok(false, "Unexpected Exception: " + ex);
--- a/browser/components/search/test/browser_amazon_behavior.js
+++ b/browser/components/search/test/browser_amazon_behavior.js
@@ -80,35 +80,35 @@ function test() {
           doc.getElementById("newtab-search-submit").click();
         }
 
         // load about:newtab, but remove the listener first so it doesn't
         // get in the way
         gBrowser.removeProgressListener(listener);
         gBrowser.loadURI("about:newtab");
         info("Waiting for about:newtab load");
-        tab.linkedBrowser.addEventListener("load", function load(event) {
-          if (event.originalTarget != tab.linkedBrowser.contentDocument ||
-              event.target.location.href == "about:blank") {
+        tab.linkedBrowser.addEventListener("load", function load(loadEvent) {
+          if (loadEvent.originalTarget != tab.linkedBrowser.contentDocument ||
+              loadEvent.target.location.href == "about:blank") {
             info("skipping spurious load event");
             return;
           }
           tab.linkedBrowser.removeEventListener("load", load, true);
 
           // Observe page setup
           let win = gBrowser.contentWindow;
           if (win.gSearch.currentEngineName ==
               Services.search.currentEngine.name) {
             doSearch(win.document);
           }
           else {
             info("Waiting for newtab search init");
-            win.addEventListener("ContentSearchService", function done(event) {
-              info("Got newtab search event " + event.detail.type);
-              if (event.detail.type == "State") {
+            win.addEventListener("ContentSearchService", function done(contentSearchServiceEvent) {
+              info("Got newtab search event " + contentSearchServiceEvent.detail.type);
+              if (contentSearchServiceEvent.detail.type == "State") {
                 win.removeEventListener("ContentSearchService", done);
                 // Let gSearch respond to the event before continuing.
                 executeSoon(() => doSearch(win.document));
               }
             });
           }
         }, true);
       }
--- a/browser/components/search/test/browser_bing_behavior.js
+++ b/browser/components/search/test/browser_bing_behavior.js
@@ -80,35 +80,35 @@ function test() {
           doc.getElementById("newtab-search-submit").click();
         }
 
         // load about:newtab, but remove the listener first so it doesn't
         // get in the way
         gBrowser.removeProgressListener(listener);
         gBrowser.loadURI("about:newtab");
         info("Waiting for about:newtab load");
-        tab.linkedBrowser.addEventListener("load", function load(event) {
-          if (event.originalTarget != tab.linkedBrowser.contentDocument ||
-              event.target.location.href == "about:blank") {
+        tab.linkedBrowser.addEventListener("load", function load(loadEvent) {
+          if (loadEvent.originalTarget != tab.linkedBrowser.contentDocument ||
+              loadEvent.target.location.href == "about:blank") {
             info("skipping spurious load event");
             return;
           }
           tab.linkedBrowser.removeEventListener("load", load, true);
 
           // Observe page setup
           let win = gBrowser.contentWindow;
           if (win.gSearch.currentEngineName ==
               Services.search.currentEngine.name) {
             doSearch(win.document);
           }
           else {
             info("Waiting for newtab search init");
-            win.addEventListener("ContentSearchService", function done(event) {
-              info("Got newtab search event " + event.detail.type);
-              if (event.detail.type == "State") {
+            win.addEventListener("ContentSearchService", function done(contentSearchServiceEvent) {
+              info("Got newtab search event " + contentSearchServiceEvent.detail.type);
+              if (contentSearchServiceEvent.detail.type == "State") {
                 win.removeEventListener("ContentSearchService", done);
                 // Let gSearch respond to the event before continuing.
                 executeSoon(() => doSearch(win.document));
               }
             });
           }
         }, true);
       }
--- a/browser/components/search/test/browser_google_behavior.js
+++ b/browser/components/search/test/browser_google_behavior.js
@@ -78,35 +78,35 @@ function test() {
           doc.getElementById("newtab-search-submit").click();
         }
 
         // load about:newtab, but remove the listener first so it doesn't
         // get in the way
         gBrowser.removeProgressListener(listener);
         gBrowser.loadURI("about:newtab");
         info("Waiting for about:newtab load");
-        tab.linkedBrowser.addEventListener("load", function load(event) {
-          if (event.originalTarget != tab.linkedBrowser.contentDocument ||
-              event.target.location.href == "about:blank") {
+        tab.linkedBrowser.addEventListener("load", function load(loadEvent) {
+          if (loadEvent.originalTarget != tab.linkedBrowser.contentDocument ||
+              loadEvent.target.location.href == "about:blank") {
             info("skipping spurious load event");
             return;
           }
           tab.linkedBrowser.removeEventListener("load", load, true);
 
           // Observe page setup
           let win = gBrowser.contentWindow;
           if (win.gSearch.currentEngineName ==
               Services.search.currentEngine.name) {
             doSearch(win.document);
           }
           else {
             info("Waiting for newtab search init");
-            win.addEventListener("ContentSearchService", function done(event) {
-              info("Got newtab search event " + event.detail.type);
-              if (event.detail.type == "State") {
+            win.addEventListener("ContentSearchService", function done(searchServiceEvent) {
+              info("Got newtab search event " + searchServiceEvent.detail.type);
+              if (searchServiceEvent.detail.type == "State") {
                 win.removeEventListener("ContentSearchService", done);
                 // Let gSearch respond to the event before continuing.
                 executeSoon(() => doSearch(win.document));
               }
             });
           }
         }, true);
       }
--- a/browser/components/search/test/browser_healthreport.js
+++ b/browser/components/search/test/browser_healthreport.js
@@ -36,18 +36,18 @@ function test() {
         gBrowser.removeTab(tab);
 
         // Make sure that the context searches are correctly recorded.
         let hs = Services.telemetry.getKeyedHistogramById("SEARCH_COUNTS").snapshot();
         Assert.ok(histogramKey in hs, "The histogram must contain the correct key");
         Assert.equal(hs[histogramKey].sum, numSearchesBefore + 1,
                      "Performing a search increments the related SEARCH_COUNTS key by 1.");
 
-        let engine = Services.search.getEngineByName("Foo");
-        Services.search.removeEngine(engine);
+        let fooEngine = Services.search.getEngineByName("Foo");
+        Services.search.removeEngine(fooEngine);
       }
 
       EventUtils.synthesizeKey("VK_RETURN", {});
       executeSoon(() => executeSoon(afterSearch));
   }
 
   function observer(subject, topic, data) {
     switch (data) {
--- a/browser/components/search/test/browser_searchbar_keyboard_navigation.js
+++ b/browser/components/search/test/browser_searchbar_keyboard_navigation.js
@@ -30,30 +30,30 @@ add_task(function* init() {
     info("cleanup the search history");
     searchbar.FormHistory.update({op: "remove", fieldname: "searchbar-history"},
                                  {handleCompletion: resolve,
                                   handleError: reject});
   });
 
   yield new Promise((resolve, reject) => {
     info("adding search history values: " + kValues);
-    let ops = kValues.map(value => { return {op: "add",
+    let addOps = kValues.map(value => { return {op: "add",
                                              fieldname: "searchbar-history",
                                              value: value}
                                    });
-    searchbar.FormHistory.update(ops, {
+    searchbar.FormHistory.update(addOps, {
       handleCompletion: function() {
         registerCleanupFunction(() => {
           info("removing search history values: " + kValues);
-          let ops =
+          let removeOps =
             kValues.map(value => { return {op: "remove",
                                            fieldname: "searchbar-history",
                                            value: value}
                                  });
-          searchbar.FormHistory.update(ops);
+          searchbar.FormHistory.update(removeOps);
         });
         resolve();
       },
       handleError: reject
     });
   });
 
   textbox.value = kUserValue;
--- a/browser/components/search/test/browser_searchbar_openpopup.js
+++ b/browser/components/search/test/browser_searchbar_openpopup.js
@@ -51,30 +51,30 @@ add_task(function* init() {
     info("cleanup the search history");
     searchbar.FormHistory.update({op: "remove", fieldname: "searchbar-history"},
                                  {handleCompletion: resolve,
                                   handleError: reject});
   });
 
   yield new Promise((resolve, reject) => {
     info("adding search history values: " + kValues);
-    let ops = kValues.map(value => { return {op: "add",
+    let addOps = kValues.map(value => { return {op: "add",
                                              fieldname: "searchbar-history",
                                              value: value}
                                    });
-    searchbar.FormHistory.update(ops, {
+    searchbar.FormHistory.update(addOps, {
       handleCompletion: function() {
         registerCleanupFunction(() => {
           info("removing search history values: " + kValues);
-          let ops =
+          let removeOps =
             kValues.map(value => { return {op: "remove",
                                            fieldname: "searchbar-history",
                                            value: value}
                                  });
-          searchbar.FormHistory.update(ops);
+          searchbar.FormHistory.update(removeOps);
         });
         resolve();
       },
       handleError: reject
     });
   });
 });
 
--- a/browser/components/search/test/browser_searchbar_smallpanel_keyboard_navigation.js
+++ b/browser/components/search/test/browser_searchbar_smallpanel_keyboard_navigation.js
@@ -31,30 +31,30 @@ add_task(function* init() {
     info("cleanup the search history");
     searchbar.FormHistory.update({op: "remove", fieldname: "searchbar-history"},
                                  {handleCompletion: resolve,
                                   handleError: reject});
   });
 
   yield new Promise((resolve, reject) => {
     info("adding search history values: " + kValues);
-    let ops = kValues.map(value => { return {op: "add",
+    let addOps = kValues.map(value => { return {op: "add",
                                              fieldname: "searchbar-history",
                                              value: value}
                                    });
-    searchbar.FormHistory.update(ops, {
+    searchbar.FormHistory.update(addOps, {
       handleCompletion: function() {
         registerCleanupFunction(() => {
           info("removing search history values: " + kValues);
-          let ops =
+          let removeOps =
             kValues.map(value => { return {op: "remove",
                                            fieldname: "searchbar-history",
                                            value: value}
                                  });
-          searchbar.FormHistory.update(ops);
+          searchbar.FormHistory.update(removeOps);
         });
         resolve();
       },
       handleError: reject
     });
   });
 });
 
--- a/browser/components/search/test/browser_yahoo_behavior.js
+++ b/browser/components/search/test/browser_yahoo_behavior.js
@@ -80,35 +80,35 @@ function test() {
           doc.getElementById("newtab-search-submit").click();
         }
 
         // load about:newtab, but remove the listener first so it doesn't
         // get in the way
         gBrowser.removeProgressListener(listener);
         gBrowser.loadURI("about:newtab");
         info("Waiting for about:newtab load");
-        tab.linkedBrowser.addEventListener("load", function load(event) {
-          if (event.originalTarget != tab.linkedBrowser.contentDocument ||
-              event.target.location.href == "about:blank") {
+        tab.linkedBrowser.addEventListener("load", function load(loadEvent) {
+          if (loadEvent.originalTarget != tab.linkedBrowser.contentDocument ||
+              loadEvent.target.location.href == "about:blank") {
             info("skipping spurious load event");
             return;
           }
           tab.linkedBrowser.removeEventListener("load", load, true);
 
           // Observe page setup
           let win = gBrowser.contentWindow;
           if (win.gSearch.currentEngineName ==
               Services.search.currentEngine.name) {
             doSearch(win.document);
           }
           else {
             info("Waiting for newtab search init");
-            win.addEventListener("ContentSearchService", function done(event) {
-              info("Got newtab search event " + event.detail.type);
-              if (event.detail.type == "State") {
+            win.addEventListener("ContentSearchService", function done(searchServiceEvent) {
+              info("Got newtab search event " + searchServiceEvent.detail.type);
+              if (searchServiceEvent.detail.type == "State") {
                 win.removeEventListener("ContentSearchService", done);
                 // Let gSearch respond to the event before continuing.
                 executeSoon(() => doSearch(win.document));
               }
             });
           }
         }, true);
       }
--- a/browser/components/tests/browser/browser_bug538331.js
+++ b/browser/components/tests/browser/browser_bug538331.js
@@ -210,60 +210,60 @@ function testDefaultArgs()
   let originalMstone = gPrefService.getCharPref(PREF_MSTONE);
 
   gPrefService.setCharPref(PREF_OVERRIDE_URL, DEFAULT_PREF_URL);
 
   writeUpdatesToXMLFile(XML_EMPTY);
   reloadUpdateManagerData();
 
   for (let i = 0; i < BCH_TESTS.length; i++) {
-    let test = BCH_TESTS[i];
-    ok(true, "Test nsBrowserContentHandler " + (i + 1) + ": " + test.description);
+    let testCase = BCH_TESTS[i];
+    ok(true, "Test nsBrowserContentHandler " + (i + 1) + ": " + testCase.description);
 
-    if (test.actions) {
-      let actionsXML = " actions=\"" + test.actions + "\"";
-      if (test.openURL) {
-        actionsXML += " openURL=\"" + test.openURL + "\"";
+    if (testCase.actions) {
+      let actionsXML = " actions=\"" + testCase.actions + "\"";
+      if (testCase.openURL) {
+        actionsXML += " openURL=\"" + testCase.openURL + "\"";
       }
       writeUpdatesToXMLFile(XML_PREFIX + actionsXML + XML_SUFFIX);
     } else {
       writeUpdatesToXMLFile(XML_EMPTY);
     }
 
     reloadUpdateManagerData();
 
     let noOverrideArgs = Cc["@mozilla.org/browser/clh;1"].
                          getService(Ci.nsIBrowserHandler).defaultArgs;
 
     let overrideArgs = "";
-    if (test.prefURL) {
-      overrideArgs = test.prefURL;
-    } else if (test.openURL) {
-      overrideArgs = test.openURL;
+    if (testCase.prefURL) {
+      overrideArgs = testCase.prefURL;
+    } else if (testCase.openURL) {
+      overrideArgs = testCase.openURL;
     }
 
     if (overrideArgs == "" && noOverrideArgs) {
       overrideArgs = noOverrideArgs;
     } else if (noOverrideArgs) {
       overrideArgs += "|" + noOverrideArgs;
     }
 
-    if (test.noMstoneChange === undefined) {
+    if (testCase.noMstoneChange === undefined) {
       gPrefService.setCharPref(PREF_MSTONE, "PreviousMilestone");
     }
 
-    if (test.noPostUpdatePref == undefined) {
+    if (testCase.noPostUpdatePref == undefined) {
       gPrefService.setBoolPref(PREF_POSTUPDATE, true);
     }
 
     let defaultArgs = Cc["@mozilla.org/browser/clh;1"].
                       getService(Ci.nsIBrowserHandler).defaultArgs;
     is(defaultArgs, overrideArgs, "correct value returned by defaultArgs");
 
-    if (test.noMstoneChange === undefined || test.noMstoneChange != true) {
+    if (testCase.noMstoneChange === undefined || testCase.noMstoneChange != true) {
       let newMstone = gPrefService.getCharPref(PREF_MSTONE);
       is(originalMstone, newMstone, "preference " + PREF_MSTONE +
          " should have been updated");
     }
 
     if (gPrefService.prefHasUserValue(PREF_POSTUPDATE)) {
       gPrefService.clearUserPref(PREF_POSTUPDATE);
     }
@@ -304,59 +304,59 @@ function testShowNotification()
 {
   let notifyBox = document.getElementById("high-priority-global-notificationbox");
 
   // Catches any windows opened by these tests (e.g. alert windows) and closes
   // them
   gWindowCatcher.start();
 
   for (let i = 0; i < BG_NOTIFY_TESTS.length; i++) {
-    let test = BG_NOTIFY_TESTS[i];
-    ok(true, "Test showNotification " + (i + 1) + ": " + test.description);
+    let testCase = BG_NOTIFY_TESTS[i];
+    ok(true, "Test showNotification " + (i + 1) + ": " + testCase.description);
 
-    if (test.actions) {
-      let actionsXML = " actions=\"" + test.actions + "\"";
-      if (test.notificationText) {
-        actionsXML += " notificationText=\"" + test.notificationText + "\"";
+    if (testCase.actions) {
+      let actionsXML = " actions=\"" + testCase.actions + "\"";
+      if (testCase.notificationText) {
+        actionsXML += " notificationText=\"" + testCase.notificationText + "\"";
       }
-      if (test.notificationURL) {
-        actionsXML += " notificationURL=\"" + test.notificationURL + "\"";
+      if (testCase.notificationURL) {
+        actionsXML += " notificationURL=\"" + testCase.notificationURL + "\"";
       }
-      if (test.notificationButtonLabel) {
-        actionsXML += " notificationButtonLabel=\"" + test.notificationButtonLabel + "\"";
+      if (testCase.notificationButtonLabel) {
+        actionsXML += " notificationButtonLabel=\"" + testCase.notificationButtonLabel + "\"";
       }
-      if (test.notificationButtonAccessKey) {
-        actionsXML += " notificationButtonAccessKey=\"" + test.notificationButtonAccessKey + "\"";
+      if (testCase.notificationButtonAccessKey) {
+        actionsXML += " notificationButtonAccessKey=\"" + testCase.notificationButtonAccessKey + "\"";
       }
       writeUpdatesToXMLFile(XML_PREFIX + actionsXML + XML_SUFFIX);
     } else {
       writeUpdatesToXMLFile(XML_EMPTY);
     }
 
     reloadUpdateManagerData();
     gPrefService.setBoolPref(PREF_POSTUPDATE, true);
 
     gBG.observe(null, "browser-glue-test", "post-update-notification");
 
     let updateBox = notifyBox.getNotificationWithValue("post-update-notification");
-    if (test.actions && test.actions.indexOf("showNotification") != -1 &&
-        test.actions.indexOf("silent") == -1) {
+    if (testCase.actions && testCase.actions.indexOf("showNotification") != -1 &&
+        testCase.actions.indexOf("silent") == -1) {
       ok(updateBox, "Update notification box should have been displayed");
       if (updateBox) {
-        if (test.notificationText) {
-          is(updateBox.label, test.notificationText, "Update notification box " +
+        if (testCase.notificationText) {
+          is(updateBox.label, testCase.notificationText, "Update notification box " +
              "should have the label provided by the update");
         }
-        if (test.notificationButtonLabel) {
+        if (testCase.notificationButtonLabel) {
           var button = updateBox.getElementsByTagName("button").item(0);
-          is(button.label, test.notificationButtonLabel, "Update notification " +
+          is(button.label, testCase.notificationButtonLabel, "Update notification " +
              "box button should have the label provided by the update");
-          if (test.notificationButtonAccessKey) {
+          if (testCase.notificationButtonAccessKey) {
             let accessKey = button.getAttribute("accesskey");
-            is(accessKey, test.notificationButtonAccessKey, "Update " +
+            is(accessKey, testCase.notificationButtonAccessKey, "Update " +
                "notification box button should have the accesskey " +
                "provided by the update");
           }
         }
         // The last test opens an url and verifies the url from the updates.xml
         // is correct.
         if (i == (BG_NOTIFY_TESTS.length - 1)) {
           // Wait for any windows caught by the windowcatcher to close
--- a/browser/components/translation/Translation.jsm
+++ b/browser/components/translation/Translation.jsm
@@ -183,19 +183,19 @@ TranslationUI.prototype = {
         this.browser = aNewBrowser;
         if (infoBarVisible)
           this.showTranslationInfoBar();
         return true;
       }
 
       if (aTopic != "showing")
         return false;
-      let notification = this.notificationBox.getNotificationWithValue("translation");
-      if (notification)
-        notification.close();
+      let translationNotification = this.notificationBox.getNotificationWithValue("translation");
+      if (translationNotification)
+        translationNotification.close();
       else
         this.showTranslationInfoBar();
       return true;
     };
 
     let addId = this.originalShown ? "translate" : "translated";
     PopupNotifications.show(this.browser, addId, null,
                             addId + "-notification-icon", null, null,
--- a/browser/components/translation/test/browser_translation_exceptions.js
+++ b/browser/components/translation/test/browser_translation_exceptions.js
@@ -20,19 +20,19 @@ function test() {
   gBrowser.selectedTab = tab;
   registerCleanupFunction(function() {
     gBrowser.removeTab(tab);
     Services.prefs.clearUserPref(kShowUIPref);
   });
   tab.linkedBrowser.addEventListener("load", function onload() {
     tab.linkedBrowser.removeEventListener("load", onload, true);
     Task.spawn(function* () {
-      for (let test of gTests) {
-        info(test.desc);
-        yield test.run();
+      for (let testCase of gTests) {
+        info(testCase.desc);
+        yield testCase.run();
       }
     }).then(finish, ex => {
      ok(false, "Unexpected Exception: " + ex);
      finish();
     });
    }, true);
 
   content.location = "http://example.com/";
--- a/browser/components/uitour/test/browser_UITour.js
+++ b/browser/components/uitour/test/browser_UITour.js
@@ -238,27 +238,24 @@ var tests = [
     popup.addEventListener("popupshown", function onPopupShown() {
       popup.removeEventListener("popupshown", onPopupShown);
       is(popup.popupBoxObject.anchorNode, document.getElementById("urlbar"), "Popup should be anchored to the urlbar");
       is(title.textContent, "test title", "Popup should have correct title");
       is(desc.textContent, "test text", "Popup should have correct description text");
       is(icon.src, "", "Popup should have no icon");
       is(buttons.hasChildNodes(), false, "Popup should have no buttons");
 
-      popup.addEventListener("popuphidden", function onPopupHidden() {
-        popup.removeEventListener("popuphidden", onPopupHidden);
-
-        popup.addEventListener("popupshown", function onPopupShown() {
-          popup.removeEventListener("popupshown", onPopupShown);
+      popup.addEventListener("popuphidden", function() {
+        popup.addEventListener("popupshown", function() {
           done();
-        });
+        }, {once: true});
 
         gContentAPI.showInfo("urlbar", "test title", "test text");
 
-      });
+      }, {once: true});
       gContentAPI.hideInfo();
     });
 
     gContentAPI.showInfo("urlbar", "test title", "test text");
   },
   taskify(function* test_info_2() {
     let popup = document.getElementById("UITourTooltip");
     let title = document.getElementById("UITourTooltipTitle");
@@ -295,41 +292,41 @@ var tests = [
   function test_getConfigurationDistribution(done) {
     gContentAPI.getConfiguration("appinfo", (result) => {
       ok(typeof(result.distribution) !== "undefined", "Check distribution isn't undefined.");
       is(result.distribution, "default", "Should be \"default\" without preference set.");
 
       let defaults = Services.prefs.getDefaultBranch("distribution.");
       let testDistributionID = "TestDistribution";
       defaults.setCharPref("id", testDistributionID);
-      gContentAPI.getConfiguration("appinfo", (result) => {
-        ok(typeof(result.distribution) !== "undefined", "Check distribution isn't undefined.");
-        is(result.distribution, testDistributionID, "Should have the distribution as set in preference.");
+      gContentAPI.getConfiguration("appinfo", (result2) => {
+        ok(typeof(result2.distribution) !== "undefined", "Check distribution isn't undefined.");
+        is(result2.distribution, testDistributionID, "Should have the distribution as set in preference.");
 
         done();
       });
     });
   },
   function test_addToolbarButton(done) {
     let placement = CustomizableUI.getPlacementOfWidget("panic-button");
     is(placement, null, "default UI has panic button in the palette");
 
     gContentAPI.getConfiguration("availableTargets", (data) => {
       let available = (data.targets.indexOf("forget") != -1);
       ok(!available, "Forget button should not be available by default");
 
       gContentAPI.addNavBarWidget("forget", () => {
         info("addNavBarWidget callback successfully called");
 
-        let placement = CustomizableUI.getPlacementOfWidget("panic-button");
-        is(placement.area, CustomizableUI.AREA_NAVBAR);
+        let updatedPlacement = CustomizableUI.getPlacementOfWidget("panic-button");
+        is(updatedPlacement.area, CustomizableUI.AREA_NAVBAR);
 
-        gContentAPI.getConfiguration("availableTargets", (data) => {
-          let available = (data.targets.indexOf("forget") != -1);
-          ok(available, "Forget button should now be available");
+        gContentAPI.getConfiguration("availableTargets", (data2) => {
+          let updatedAvailable = data2.targets.indexOf("forget") != -1;
+          ok(updatedAvailable, "Forget button should now be available");
 
           // Cleanup
           CustomizableUI.removeWidgetFromArea("panic-button");
           done();
         });
       });
     });
   },
--- a/browser/components/uitour/test/browser_UITour2.js
+++ b/browser/components/uitour/test/browser_UITour2.js
@@ -39,24 +39,24 @@ var tests = [
     let shownPromise = promisePanelShown(window);
     gContentAPI.showMenu("appMenu");
     shownPromise.then(() => {
       isnot(PanelUI.panel.state, "closed", "Panel should have opened");
       ok(PanelUI.panel.hasAttribute("noautohide"), "@noautohide on the menu panel should have been set");
       gContentAPI.showInfo("customize", "Customization", "Customize me please!");
 
       UITour.getTarget(window, "customize").then((customizeTarget) => {
-        waitForPopupAtAnchor(popup, customizeTarget.node, function checkMenuIsStillOpen() {
+        waitForPopupAtAnchor(popup, customizeTarget.node, function() {
           isnot(PanelUI.panel.state, "closed", "Panel should still be open");
           ok(PanelUI.panel.hasAttribute("noautohide"), "@noautohide on the menu panel should still be set");
 
           // Move the info outside which shouldn't close the app menu since it was manually opened.
           gContentAPI.showInfo("appMenu", "Open Me", "You know you want to");
           UITour.getTarget(window, "appMenu").then((target) => {
-            waitForPopupAtAnchor(popup, target.node, function checkMenuIsStillOpen() {
+            waitForPopupAtAnchor(popup, target.node, function() {
               isnot(PanelUI.panel.state, "closed",
                     "Menu should remain open since UITour didn't open it in the first place");
               waitForElementToBeHidden(window.PanelUI.panel, () => {
                 ok(!PanelUI.panel.hasAttribute("noautohide"), "@noautohide on the menu panel should have been cleaned up on close");
                 done();
               });
               gContentAPI.hideMenu("appMenu");
             }, "Info should move to the appMenu button");
--- a/browser/components/uitour/test/browser_UITour_detach_tab.js
+++ b/browser/components/uitour/test/browser_UITour_detach_tab.js
@@ -38,40 +38,40 @@ var tests = [
     };
 
     let browserStartupDeferred = Promise.defer();
     Services.obs.addObserver(function onBrowserDelayedStartup(aWindow) {
       Services.obs.removeObserver(onBrowserDelayedStartup, "browser-delayed-startup-finished");
       browserStartupDeferred.resolve(aWindow);
     }, "browser-delayed-startup-finished", false);
 
-    yield ContentTask.spawn(gBrowser.selectedBrowser, myDocIdentifier, myDocIdentifier => {
+    yield ContentTask.spawn(gBrowser.selectedBrowser, myDocIdentifier, contentMyDocIdentifier => {
       let onVisibilityChange = () => {
         if (!content.document.hidden) {
           let win = Cu.waiveXrays(content);
           win.Mozilla.UITour.showHighlight("appMenu");
         }
       };
       content.document.addEventListener("visibilitychange", onVisibilityChange);
-      content.document.myExpando = myDocIdentifier;
+      content.document.myExpando = contentMyDocIdentifier;
     });
     gContentAPI.showHighlight("appMenu");
 
     yield elementVisiblePromise(highlight);
 
     gContentWindow = gBrowser.replaceTabWithWindow(gBrowser.selectedTab);
     yield browserStartupDeferred.promise;
 
     // This highlight should be shown thanks to the visibilitychange listener.
     let newWindowHighlight = gContentWindow.document.getElementById("UITourHighlight");
     yield elementVisiblePromise(newWindowHighlight);
 
     let selectedTab = gContentWindow.gBrowser.selectedTab;
-    yield ContentTask.spawn(selectedTab.linkedBrowser, myDocIdentifier, myDocIdentifier => {
-      is(content.document.myExpando, myDocIdentifier, "Document should be selected in new window");
+    yield ContentTask.spawn(selectedTab.linkedBrowser, myDocIdentifier, contentMyDocIdentifier => {
+      is(content.document.myExpando, contentMyDocIdentifier, "Document should be selected in new window");
     });
     ok(UITour.tourBrowsersByWindow && UITour.tourBrowsersByWindow.has(gContentWindow), "Window should be known");
     ok(UITour.tourBrowsersByWindow.get(gContentWindow).has(selectedTab.linkedBrowser), "Selected browser should be known");
 
     // Need this because gContentAPI in e10s land will try to use gTestTab to
     // spawn a content task, which doesn't work if the tab is dead, for obvious
     // reasons.
     gTestTab = gContentWindow.gBrowser.selectedTab;
--- a/browser/components/uitour/test/browser_UITour_heartbeat.js
+++ b/browser/components/uitour/test/browser_UITour_heartbeat.js
@@ -100,21 +100,20 @@ function checkTelemetry(aPayload, aFlowI
  * allow for multiple calls to the same callback, allowing to catch just the first
  * notification.
  *
  * @param aEventName
  *        The notification name to wait for.
  * @return {Promise} Resolved with the data that comes with the event.
  */
 function promiseWaitHeartbeatNotification(aEventName) {
-  return ContentTask.spawn(gTestTab.linkedBrowser, { aEventName },
-      function({ aEventName }) {
+  return ContentTask.spawn(gTestTab.linkedBrowser, aEventName, (aContentEventName) => {
         return new Promise(resolve => {
           addEventListener("mozUITourNotification", function listener(event) {
-            if (event.detail.event !== aEventName) {
+            if (event.detail.event !== aContentEventName) {
               return;
             }
             removeEventListener("mozUITourNotification", listener, false);
             resolve(event.detail.params);
           }, false);
         });
       });
 }
@@ -125,19 +124,18 @@ function promiseWaitHeartbeatNotificatio
  * be received before resolving. If it receives an unaccounted notification, it rejects.
  *
  * @param events
  *        An array of expected notification names to wait for.
  * @return {Promise} Resolved with the data that comes with the event. Rejects with the
  *         name of an undesired notification if received.
  */
 function promiseWaitExpectedNotifications(events) {
-  return ContentTask.spawn(gTestTab.linkedBrowser, { events },
-      function({ events }) {
-        let stillToReceive = events;
+  return ContentTask.spawn(gTestTab.linkedBrowser, events, contentEvents => {
+        let stillToReceive = contentEvents;
         return new Promise((res, rej) => {
           addEventListener("mozUITourNotification", function listener(event) {
             if (stillToReceive.includes(event.detail.event)) {
               // Filter out the received event.
               stillToReceive = stillToReceive.filter(x => x !== event.detail.event);
             } else {
               removeEventListener("mozUITourNotification", listener, false);
               rej(event.detail.event);
--- a/browser/components/uitour/test/head.js
+++ b/browser/components/uitour/test/head.js
@@ -28,32 +28,32 @@ function waitForConditionPromise(conditi
     tries++;
     setTimeout(checkCondition, SINGLE_TRY_TIMEOUT);
     return undefined;
   }
   setTimeout(checkCondition, SINGLE_TRY_TIMEOUT);
   return defer.promise;
 }
 
-function waitForCondition(condition, nextTest, errorMsg) {
-  waitForConditionPromise(condition, errorMsg).then(nextTest, (reason) => {
+function waitForCondition(condition, nextTestFn, errorMsg) {
+  waitForConditionPromise(condition, errorMsg).then(nextTestFn, (reason) => {
     ok(false, reason + (reason.stack ? "\n" + reason.stack : ""));
   });
 }
 
 /**
  * Wrapper to partially transition tests to Task. Use `add_UITour_task` instead for new tests.
  */
 function taskify(fun) {
-  return (done) => {
+  return (doneFn) => {
     // Output the inner function name otherwise no name will be output.
     info("\t" + fun.name);
-    return Task.spawn(fun).then(done, (reason) => {
+    return Task.spawn(fun).then(doneFn, (reason) => {
       ok(false, reason);
-      done();
+      doneFn();
     });
   };
 }
 
 function is_hidden(element) {
   var style = element.ownerGlobal.getComputedStyle(element);
   if (style.display == "none")
     return true;
@@ -85,57 +85,57 @@ function is_visible(element) {
   return true;
 }
 
 function is_element_visible(element, msg) {
   isnot(element, null, "Element should not be null, when checking visibility");
   ok(is_visible(element), msg);
 }
 
-function waitForElementToBeVisible(element, nextTest, msg) {
+function waitForElementToBeVisible(element, nextTestFn, msg) {
   waitForCondition(() => is_visible(element),
                    () => {
                      ok(true, msg);
-                     nextTest();
+                     nextTestFn();
                    },
                    "Timeout waiting for visibility: " + msg);
 }
 
-function waitForElementToBeHidden(element, nextTest, msg) {
+function waitForElementToBeHidden(element, nextTestFn, msg) {
   waitForCondition(() => is_hidden(element),
                    () => {
                      ok(true, msg);
-                     nextTest();
+                     nextTestFn();
                    },
                    "Timeout waiting for invisibility: " + msg);
 }
 
 function elementVisiblePromise(element, msg) {
   return waitForConditionPromise(() => is_visible(element), "Timeout waiting for visibility: " + msg);
 }
 
 function elementHiddenPromise(element, msg) {
   return waitForConditionPromise(() => is_hidden(element), "Timeout waiting for invisibility: " + msg);
 }
 
-function waitForPopupAtAnchor(popup, anchorNode, nextTest, msg) {
+function waitForPopupAtAnchor(popup, anchorNode, nextTestFn, msg) {
   waitForCondition(() => is_visible(popup) && popup.popupBoxObject.anchorNode == anchorNode,
                    () => {
                      ok(true, msg);
                      is_element_visible(popup, "Popup should be visible");
-                     nextTest();
+                     nextTestFn();
                    },
                    "Timeout waiting for popup at anchor: " + msg);
 }
 
 function getConfigurationPromise(configName) {
-  return ContentTask.spawn(gTestTab.linkedBrowser, configName, configName => {
+  return ContentTask.spawn(gTestTab.linkedBrowser, configName, contentConfigName => {
     return new Promise((resolve) => {
       let contentWin = Components.utils.waiveXrays(content);
-      contentWin.Mozilla.UITour.getConfiguration(configName, resolve);
+      contentWin.Mozilla.UITour.getConfiguration(contentConfigName, resolve);
     });
   });
 }
 
 function hideInfoPromise(...args) {
   let popup = document.getElementById("UITourTooltip");
   gContentAPI.hideInfo.apply(gContentAPI, args);
   return promisePanelElementHidden(window, popup);
@@ -146,34 +146,39 @@ function hideInfoPromise(...args) {
  * function name to call to generate the buttons/options instead of the
  * buttons/options themselves. This makes the signature differ from the content one.
  */
 function showInfoPromise(target, title, text, icon, buttonsFunctionName, optionsFunctionName) {
   let popup = document.getElementById("UITourTooltip");
   let shownPromise = promisePanelElementShown(window, popup);
   return ContentTask.spawn(gTestTab.linkedBrowser, [...arguments], args => {
     let contentWin = Components.utils.waiveXrays(content);
-    let [target, title, text, icon, buttonsFunctionName, optionsFunctionName] = args;
-    let buttons = buttonsFunctionName ? contentWin[buttonsFunctionName]() : null;
-    let options = optionsFunctionName ? contentWin[optionsFunctionName]() : null;
-    contentWin.Mozilla.UITour.showInfo(target, title, text, icon, buttons, options);
+    let [contentTarget,
+         contentTitle,
+         contentText,
+         contentIcon,
+         contentButtonsFunctionName,
+         contentOptionsFunctionName] = args;
+    let buttons = contentButtonsFunctionName ? contentWin[contentButtonsFunctionName]() : null;
+    let options = contentOptionsFunctionName ? contentWin[contentOptionsFunctionName]() : null;
+    contentWin.Mozilla.UITour.showInfo(contentTarget, contentTitle, contentText, contentIcon, buttons, options);
   }).then(() => shownPromise);
 }
 
 function showHighlightPromise(...args) {
   let popup = document.getElementById("UITourHighlightContainer");
   gContentAPI.showHighlight.apply(gContentAPI, args);
   return promisePanelElementShown(window, popup);
 }
 
 function showMenuPromise(name) {
-  return ContentTask.spawn(gTestTab.linkedBrowser, name, name => {
+  return ContentTask.spawn(gTestTab.linkedBrowser, name, contentName => {
     return new Promise((resolve) => {
       let contentWin = Components.utils.waiveXrays(content);
-      contentWin.Mozilla.UITour.showMenu(name, resolve);
+      contentWin.Mozilla.UITour.showMenu(contentName, resolve);
     });
   });
 }
 
 function waitForCallbackResultPromise() {
   return ContentTask.spawn(gTestTab.linkedBrowser, null, function*() {
     let contentWin = Components.utils.waiveXrays(content);
     yield ContentTaskUtils.waitForCondition(() => {
@@ -256,19 +261,19 @@ function loadUITourTestPage(callback, ho
       // contentWin.Mozilla.UITour/contentWin in a ContentTask.
       let contentWinHandler = {
         get(target, prop, receiver) {
           return (...args) => {
             let taskArgs = {
               methodName: prop,
               args,
             };
-            return ContentTask.spawn(gTestTab.linkedBrowser, taskArgs, args => {
+            return ContentTask.spawn(gTestTab.linkedBrowser, taskArgs, contentArgs => {
               let contentWin = Components.utils.waiveXrays(content);
-              return contentWin[args.methodName].apply(contentWin, args.args);
+              return contentWin[contentArgs.methodName].apply(contentWin, contentArgs.args);
             });
           };
         },
       };
       gContentWindow = new Proxy({}, contentWinHandler);
 
       let UITourHandler = {
         get(target, prop, receiver) {
@@ -299,36 +304,36 @@ function loadUITourTestPage(callback, ho
               }
               return arg;
             });
             let taskArgs = {
               methodName: prop,
               args,
               fnIndices,
             };
-            return ContentTask.spawn(browser, taskArgs, function*(args) {
+            return ContentTask.spawn(browser, taskArgs, function*(contentArgs) {
               let contentWin = Components.utils.waiveXrays(content);
               let callbacksCalled = 0;
               let resolveCallbackPromise;
               let allCallbacksCalledPromise = new Promise(resolve => resolveCallbackPromise = resolve);
-              let argumentsWithFunctions = args.args.map((arg, index) => {
-                if (arg === "" && args.fnIndices.includes(index)) {
+              let argumentsWithFunctions = contentArgs.args.map((arg, index) => {
+                if (arg === "" && contentArgs.fnIndices.includes(index)) {
                   return function() {
                     callbacksCalled++;
                     sendAsyncMessage("UITourHandler:proxiedfunction-" + index, Array.from(arguments));
-                    if (callbacksCalled >= args.fnIndices.length) {
+                    if (callbacksCalled >= contentArgs.fnIndices.length) {
                       resolveCallbackPromise();
                     }
                   };
                 }
                 return arg;
               });
-              let rv = contentWin.Mozilla.UITour[args.methodName].apply(contentWin.Mozilla.UITour,
+              let rv = contentWin.Mozilla.UITour[contentArgs.methodName].apply(contentWin.Mozilla.UITour,
                                                                         argumentsWithFunctions);
-              if (args.fnIndices.length) {
+              if (contentArgs.fnIndices.length) {
                 yield allCallbacksCalledPromise;
               }
               return rv;
             });
           };
         },
       };
       gContentAPI = new Proxy({}, UITourHandler);
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -1773,71 +1773,71 @@ Experiments.ExperimentEntry.prototype = 
   _installAddon: Task.async(function* () {
     let deferred = Promise.defer();
 
     let hash = this._policy.ignoreHashes ? null : this._manifestData.xpiHash;
 
     let install = yield addonInstallForURL(this._manifestData.xpiURL, hash);
     gActiveInstallURLs.add(install.sourceURI.spec);
 
-    let failureHandler = (install, handler) => {
+    let failureHandler = (failureInstall, handler) => {
       let message = "AddonInstall " + handler + " for " + this.id + ", state=" +
-                   (install.state || "?") + ", error=" + install.error;
+                   (failureInstall.state || "?") + ", error=" + failureInstall.error;
       this._log.error("_installAddon() - " + message);
       this._failedStart = true;
-      gActiveInstallURLs.delete(install.sourceURI.spec);
+      gActiveInstallURLs.delete(failureInstall.sourceURI.spec);
 
       TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
                       [TELEMETRY_LOG.ACTIVATION.INSTALL_FAILURE, this.id]);
 
       deferred.reject(new Error(message));
     };
 
     let listener = {
       _expectedID: null,
 
-      onDownloadEnded: install => {
+      onDownloadEnded: downloadEndedInstall => {
         this._log.trace("_installAddon() - onDownloadEnded for " + this.id);
 
-        if (install.existingAddon) {
+        if (downloadEndedInstall.existingAddon) {
           this._log.warn("_installAddon() - onDownloadEnded, addon already installed");
         }
 
-        if (install.addon.type !== "experiment") {
+        if (downloadEndedInstall.addon.type !== "experiment") {
           this._log.error("_installAddon() - onDownloadEnded, wrong addon type");
-          install.cancel();
+          downloadEndedInstall.cancel();
         }
       },
 
-      onInstallStarted: install => {
+      onInstallStarted: installStartedInstall => {
         this._log.trace("_installAddon() - onInstallStarted for " + this.id);
 
-        if (install.existingAddon) {
+        if (installStartedInstall.existingAddon) {
           this._log.warn("_installAddon() - onInstallStarted, addon already installed");
         }
 
-        if (install.addon.type !== "experiment") {
+        if (installStartedInstall.addon.type !== "experiment") {
           this._log.error("_installAddon() - onInstallStarted, wrong addon type");
           return false;
         }
         return undefined;
       },
 
-      onInstallEnded: install => {
+      onInstallEnded: installEndedInstall => {
         this._log.trace("_installAddon() - install ended for " + this.id);
-        gActiveInstallURLs.delete(install.sourceURI.spec);
+        gActiveInstallURLs.delete(installEndedInstall.sourceURI.spec);
 
         this._lastChangedDate = this._policy.now();
         this._startDate = this._policy.now();
         this._enabled = true;
 
         TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
                        [TELEMETRY_LOG.ACTIVATION.ACTIVATED, this.id]);
 
-        let addon = install.addon;
+        let addon = installEndedInstall.addon;
         this._name = addon.name;
         this._addonId = addon.id;
         this._description = addon.description || "";
         this._homepageURL = addon.homepageURL || "";
 
         // Experiment add-ons default to userDisabled=true. Enable if needed.
         if (addon.userDisabled) {
           this._log.trace("Add-on is disabled. Enabling.");
@@ -1859,17 +1859,17 @@ Experiments.ExperimentEntry.prototype = 
 
         AddonManager.removeAddonListener(listener);
         deferred.resolve();
       },
     };
 
     ["onDownloadCancelled", "onDownloadFailed", "onInstallCancelled", "onInstallFailed"]
       .forEach(what => {
-        listener[what] = install => failureHandler(install, what)
+        listener[what] = eventInstall => failureHandler(eventInstall, what)
       });
 
     install.addListener(listener);
     install.install();
 
     return yield deferred.promise;
   }),
 
--- a/browser/extensions/pocket/content/main.js
+++ b/browser/extensions/pocket/content/main.js
@@ -36,16 +36,18 @@
  */
 
 // TODO : Get the toolbar icons from Firefox's build (Nikki needs to give us a red saved icon)
 // TODO : [needs clarificaiton from Fx] Firefox's plan was to hide Pocket from context menus until the user logs in. Now that it's an extension I'm wondering if we still need to do this.
 // TODO : [needs clarificaiton from Fx] Reader mode (might be a something they need to do since it's in html, need to investigate their code)
 // TODO : [needs clarificaiton from Fx] Move prefs within pktApi.s to sqlite or a local file so it's not editable (and is safer)
 // TODO : [nice to have] - Immediately save, buffer the actions in a local queue and send (so it works offline, works like our native extensions)
 
+/* eslint-disable no-shadow */
+
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
   "resource://gre/modules/ReaderMode.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "pktApi",
   "chrome://pocket/content/pktApi.jsm");
 
--- a/browser/modules/LaterRun.jsm
+++ b/browser/modules/LaterRun.jsm
@@ -155,17 +155,17 @@ let LaterRun = {
   // NB: will only return one page at a time; if multiple pages match, it's up
   // to the preference service which one gets shown first, and the next one
   // will be shown next startup instead.
   getURL() {
     if (!this.enabled) {
       return null;
     }
     let pages = this.readPages();
-    let page = pages.find(page => page.applies(this));
+    let page = pages.find(p => p.applies(this));
     if (page) {
       Services.prefs.setBoolPref(page.pref + "hasRun", true);
       return page.url;
     }
     return null;
   },
 };
 
--- a/browser/modules/PluginContent.jsm
+++ b/browser/modules/PluginContent.jsm
@@ -547,30 +547,30 @@ PluginContent.prototype = {
     }
 
     // Show the in-content UI if it's not too big. The crashed plugin handler already did this.
     let overlay = this.getPluginUI(plugin, "main");
     if (eventType != "PluginCrashed") {
       if (overlay != null) {
         this.setVisibility(plugin, overlay,
                            this.shouldShowOverlay(plugin, overlay));
-        let resizeListener = (event) => {
+        let resizeListener = () => {
           this.setVisibility(plugin, overlay,
             this.shouldShowOverlay(plugin, overlay));
           this.updateNotificationUI();
         };
         plugin.addEventListener("overflow", resizeListener);
         plugin.addEventListener("underflow", resizeListener);
       }
     }
 
     let closeIcon = this.getPluginUI(plugin, "closeIcon");
     if (closeIcon) {
-      closeIcon.addEventListener("click", event => {
-        if (event.button == 0 && event.isTrusted) {
+      closeIcon.addEventListener("click", clickEvent => {
+        if (clickEvent.button == 0 && clickEvent.isTrusted) {
           this.hideClickToPlayOverlay(plugin);
           overlay.setAttribute("dismissed", "true");
         }
       }, true);
     }
 
     if (shouldShowNotification) {
       this._showClickToPlayNotification(plugin, false);
@@ -811,18 +811,18 @@ PluginContent.prototype = {
 
     // If plugin is null, that means the user has navigated back to a page with
     // plugins, and we need to collect all the plugins.
     if (plugin === null) {
       let contentWindow = this.content;
       let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
                              .getInterface(Ci.nsIDOMWindowUtils);
       // cwu.plugins may contain non-plugin <object>s, filter them out
-      plugins = cwu.plugins.filter((plugin) =>
-        plugin.getContentTypeForMIMEType(plugin.actualType) == Ci.nsIObjectLoadingContent.TYPE_PLUGIN);
+      plugins = cwu.plugins.filter((p) =>
+        p.getContentTypeForMIMEType(p.actualType) == Ci.nsIObjectLoadingContent.TYPE_PLUGIN);
 
       if (plugins.length == 0) {
         this.removeNotification("click-to-play-plugins");
         return;
       }
     } else {
       plugins = [plugin];
     }
--- a/browser/modules/test/browser_NetworkPrioritizer.js
+++ b/browser/modules/test/browser_NetworkPrioritizer.js
@@ -26,22 +26,22 @@ function* getPriority(aBrowser) {
                    .priority;
   });
 }
 
 function* setPriority(aBrowser, aPriority) {
   if (aBrowser.localName == "tab")
     aBrowser = aBrowser.linkedBrowser;
 
-  yield ContentTask.spawn(aBrowser, aPriority, function* (aPriority) {
+  yield ContentTask.spawn(aBrowser, aPriority, function* (contentPriority) {
     docShell.QueryInterface(Components.interfaces.nsIWebNavigation)
                                     .QueryInterface(Components.interfaces.nsIDocumentLoader)
                                     .loadGroup
                                     .QueryInterface(Ci.nsISupportsPriority)
-                                    .priority = aPriority;
+                                    .priority = contentPriority;
   });
 }
 
 function* isWindowState(aWindow, aTabPriorities) {
   let browsers = aWindow.gBrowser.browsers;
   // Make sure we have the right number of tabs & priorities
   is(browsers.length, aTabPriorities.length,
      "Window has expected number of tabs");
--- a/browser/modules/test/browser_UnsubmittedCrashHandler.js
+++ b/browser/modules/test/browser_UnsubmittedCrashHandler.js
@@ -80,21 +80,21 @@ function* createPendingCrashReports(howM
    * @param extension (string)
    *        The file extension for the created file.
    * @param accessDate (Date)
    *        The date to set lastAccessed to.
    * @param contents (string, optional)
    *        Set this to whatever the file needs to contain, if anything.
    * @returns Promise
    */
-  let createFile = (fileName, extension, accessDate, contents) => {
+  let createFile = (fileName, extension, lastAccessedDate, contents) => {
     let file = dir.clone();
     file.append(fileName + "." + extension);
     file.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);
-    let promises = [OS.File.setDates(file.path, accessDate)];
+    let promises = [OS.File.setDates(file.path, lastAccessedDate)];
 
     if (contents) {
       let encoder = new TextEncoder();
       let array = encoder.encode(contents);
       promises.push(OS.File.writeAtomic(file.path, array, {
         tmpPath: file.path + ".tmp",
       }));
     }
--- a/browser/modules/test/head.js
+++ b/browser/modules/test/head.js
@@ -61,19 +61,19 @@ function checkKeyedScalar(scalars, scala
  * @param {Object} browser
  *        The browser that contains the content.
  * @param {String} text
  *        The string to write in the search field.
  * @param {String} fieldName
  *        The name of the field to write to.
  */
 let typeInSearchField = Task.async(function* (browser, text, fieldName) {
-  yield ContentTask.spawn(browser, { fieldName, text }, function* ({fieldName, text}) {
+  yield ContentTask.spawn(browser, [fieldName, text], function* ([contentFieldName, contentText]) {
     // Avoid intermittent failures.
-    if (fieldName === "searchText") {
+    if (contentFieldName === "searchText") {
       content.wrappedJSObject.gContentSearchController.remoteTimeout = 5000;
     }
     // Put the focus on the search box.
-    let searchInput = content.document.getElementById(fieldName);
+    let searchInput = content.document.getElementById(contentFieldName);
     searchInput.focus();
-    searchInput.value = text;
+    searchInput.value = contentText;
   });
 });
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -288,18 +288,17 @@ function getHost(uri, href) {
 
 function prompt(aBrowser, aRequest) {
   let {audioDevices: audioDevices, videoDevices: videoDevices,
        sharingScreen: sharingScreen, sharingAudio: sharingAudio,
        requestTypes: requestTypes} = aRequest;
   let uri = Services.io.newURI(aRequest.documentURI, null, null);
   let host = getHost(uri);
   let chromeDoc = aBrowser.ownerDocument;
-  let chromeWin = chromeDoc.defaultView;
-  let stringBundle = chromeWin.gNavigatorBundle;
+  let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
   let stringId = "getUserMedia.share" + requestTypes.join("And") + ".message";
   let message = stringBundle.getFormattedString(stringId, [host]);
 
   let mainLabel;
   if (sharingScreen || sharingAudio) {
     mainLabel = stringBundle.getString("getUserMedia.shareSelectedItems.label");
   } else {
     let string = stringBundle.getString("getUserMedia.shareSelectedDevices.label");
@@ -356,30 +355,30 @@ function prompt(aBrowser, aRequest) {
     });
   }
 
   let options = {
     eventCallback: function(aTopic, aNewBrowser) {
       if (aTopic == "swapping")
         return true;
 
-      let chromeDoc = this.browser.ownerDocument;
+      let doc = this.browser.ownerDocument;
 
       // Clean-up video streams of screensharing previews.
       if ((aTopic == "dismissed" || aTopic == "removed") &&
           requestTypes.includes("Screen")) {
-        let video = chromeDoc.getElementById("webRTC-previewVideo");
+        let video = doc.getElementById("webRTC-previewVideo");
         video.deviceId = undefined;
         if (video.stream) {
           video.stream.getTracks().forEach(t => t.stop());
           video.stream = null;
           video.src = null;
-          chromeDoc.getElementById("webRTC-preview").hidden = true;
+          doc.getElementById("webRTC-preview").hidden = true;
         }
-        let menupopup = chromeDoc.getElementById("webRTC-selectWindow-menupopup");
+        let menupopup = doc.getElementById("webRTC-selectWindow-menupopup");
         if (menupopup._commandEventListener) {
           menupopup.removeEventListener("command", menupopup._commandEventListener);
           menupopup._commandEventListener = null;
         }
       }
 
       if (aTopic != "showing")
         return false;
@@ -413,19 +412,19 @@ function prompt(aBrowser, aRequest) {
         // test; only that they are set. This is because if audio is allowed
         // and video is denied persistently, we don't want to show the prompt,
         // and will grant audio access immediately.
         if ((!audioDevices.length || micPerm) && (!videoDevices.length || camPerm)) {
           // All permissions we were about to request are already persistently set.
           let allowedDevices = [];
           if (videoDevices.length && camPerm == perms.ALLOW_ACTION) {
             allowedDevices.push(videoDevices[0].deviceIndex);
-            let perms = Services.perms;
-            perms.add(uri, "MediaManagerVideo", perms.ALLOW_ACTION,
-                      perms.EXPIRE_SESSION);
+            Services.perms.add(uri, "MediaManagerVideo",
+                               Services.perms.ALLOW_ACTION,
+                               Services.perms.EXPIRE_SESSION);
           }
           if (audioDevices.length && micPerm == perms.ALLOW_ACTION)
             allowedDevices.push(audioDevices[0].deviceIndex);
 
           // Remember on which URIs we found persistent permissions so that we
           // can remove them if the user clicks 'Stop Sharing'. There's no
           // other way for the stop sharing code to know the hostnames of frames
           // using devices until bug 1066082 is fixed.
@@ -452,29 +451,29 @@ function prompt(aBrowser, aRequest) {
 
       function listScreenShareDevices(menupopup, devices) {
         while (menupopup.lastChild)
           menupopup.removeChild(menupopup.lastChild);
 
         let type = devices[0].mediaSource;
         let typeName = type.charAt(0).toUpperCase() + type.substr(1);
 
-        let label = chromeDoc.getElementById("webRTC-selectWindow-label");
-        let stringId = "getUserMedia.select" + typeName;
+        let label = doc.getElementById("webRTC-selectWindow-label");
+        let gumStringId = "getUserMedia.select" + typeName;
         label.setAttribute("value",
-                           stringBundle.getString(stringId + ".label"));
+                           stringBundle.getString(gumStringId + ".label"));
         label.setAttribute("accesskey",
-                           stringBundle.getString(stringId + ".accesskey"));
+                           stringBundle.getString(gumStringId + ".accesskey"));
 
         // "No <type>" is the default because we can't pick a
         // 'default' window to share.
         addDeviceToList(menupopup,
                         stringBundle.getString("getUserMedia.no" + typeName + ".label"),
                         "-1");
-        menupopup.appendChild(chromeDoc.createElement("menuseparator"));
+        menupopup.appendChild(doc.createElement("menuseparator"));
 
         // Build the list of 'devices'.
         let monitorIndex = 1;
         for (let i = 0; i < devices.length; ++i) {
           let device = devices[i];
 
           let name;
           // Building screen list from available screens.
@@ -489,49 +488,49 @@ function prompt(aBrowser, aRequest) {
           }
           else {
             name = device.name;
             if (type == "application") {
               // The application names returned by the platform are of the form:
               // <window count>\x1e<application name>
               let sepIndex = name.indexOf("\x1e");
               let count = name.slice(0, sepIndex);
-              let stringId = "getUserMedia.shareApplicationWindowCount.label";
-              name = PluralForm.get(parseInt(count), stringBundle.getString(stringId))
+              let sawcStringId = "getUserMedia.shareApplicationWindowCount.label";
+              name = PluralForm.get(parseInt(count), stringBundle.getString(sawcStringId))
                                .replace("#1", name.slice(sepIndex + 1))
                                .replace("#2", count);
             }
           }
           let item = addDeviceToList(menupopup, name, i, typeName);
           item.deviceId = device.id;
           if (device.scary)
             item.scary = true;
         }
 
         // Always re-select the "No <type>" item.
-        chromeDoc.getElementById("webRTC-selectWindow-menulist").removeAttribute("value");
-        chromeDoc.getElementById("webRTC-all-windows-shared").hidden = true;
+        doc.getElementById("webRTC-selectWindow-menulist").removeAttribute("value");
+        doc.getElementById("webRTC-all-windows-shared").hidden = true;
         menupopup._commandEventListener = event => {
-          let video = chromeDoc.getElementById("webRTC-previewVideo");
+          let video = doc.getElementById("webRTC-previewVideo");
           if (video.stream) {
             video.stream.getTracks().forEach(t => t.stop());
             video.stream = null;
           }
 
           let deviceId = event.target.deviceId;
           if (deviceId == undefined) {
-            chromeDoc.getElementById("webRTC-preview").hidden = true;
+            doc.getElementById("webRTC-preview").hidden = true;
             video.src = null;
             return;
           }
 
           let scary = event.target.scary;
-          let warning = chromeDoc.getElementById("webRTC-previewWarning");
+          let warning = doc.getElementById("webRTC-previewWarning");
           warning.hidden = !scary;
-          let chromeWin = chromeDoc.defaultView;
+          let chromeWin = doc.defaultView;
           if (scary) {
             warning.hidden = false;
             let string;
             let bundle = chromeWin.gNavigatorBundle;
 
             let learnMoreText =
               bundle.getString("getUserMedia.shareScreen.learnMoreLabel");
             let baseURL =
@@ -541,96 +540,96 @@ function prompt(aBrowser, aRequest) {
               learnMoreText + "</label>";
 
             if (type == "screen") {
               string = bundle.getFormattedString("getUserMedia.shareScreenWarning.message",
                                                  [learnMore]);
             }
             else {
               let brand =
-                chromeDoc.getElementById("bundle_brand").getString("brandShortName");
+                doc.getElementById("bundle_brand").getString("brandShortName");
               string = bundle.getFormattedString("getUserMedia.shareFirefoxWarning.message",
                                                  [brand, learnMore]);
             }
             warning.innerHTML = string;
           }
 
           let perms = Services.perms;
-          let chromeUri = Services.io.newURI(chromeDoc.documentURI, null, null);
+          let chromeUri = Services.io.newURI(doc.documentURI, null, null);
           perms.add(chromeUri, "MediaManagerVideo", perms.ALLOW_ACTION,
                     perms.EXPIRE_SESSION);
 
           video.deviceId = deviceId;
           let constraints = { video: { mediaSource: type, deviceId: {exact: deviceId } } };
           chromeWin.navigator.mediaDevices.getUserMedia(constraints).then(stream => {
             if (video.deviceId != deviceId) {
               // The user has selected a different device or closed the panel
               // before getUserMedia finished.
               stream.getTracks().forEach(t => t.stop());
               return;
             }
             video.src = chromeWin.URL.createObjectURL(stream);
             video.stream = stream;
-            chromeDoc.getElementById("webRTC-preview").hidden = false;
+            doc.getElementById("webRTC-preview").hidden = false;
             video.onloadedmetadata = function(e) {
               video.play();
             };
           });
         };
         menupopup.addEventListener("command", menupopup._commandEventListener);
       }
 
       function addDeviceToList(menupopup, deviceName, deviceIndex, type) {
-        let menuitem = chromeDoc.createElement("menuitem");
+        let menuitem = doc.createElement("menuitem");
         menuitem.setAttribute("value", deviceIndex);
         menuitem.setAttribute("label", deviceName);
         menuitem.setAttribute("tooltiptext", deviceName);
         if (type)
           menuitem.setAttribute("devicetype", type);
         menupopup.appendChild(menuitem);
         return menuitem;
       }
 
-      chromeDoc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length || sharingScreen;
-      chromeDoc.getElementById("webRTC-selectWindowOrScreen").hidden = !sharingScreen || !videoDevices.length;
-      chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length || sharingAudio;
+      doc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length || sharingScreen;
+      doc.getElementById("webRTC-selectWindowOrScreen").hidden = !sharingScreen || !videoDevices.length;
+      doc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length || sharingAudio;
 
-      let camMenupopup = chromeDoc.getElementById("webRTC-selectCamera-menupopup");
-      let windowMenupopup = chromeDoc.getElementById("webRTC-selectWindow-menupopup");
-      let micMenupopup = chromeDoc.getElementById("webRTC-selectMicrophone-menupopup");
+      let camMenupopup = doc.getElementById("webRTC-selectCamera-menupopup");
+      let windowMenupopup = doc.getElementById("webRTC-selectWindow-menupopup");
+      let micMenupopup = doc.getElementById("webRTC-selectMicrophone-menupopup");
       if (sharingScreen)
         listScreenShareDevices(windowMenupopup, videoDevices);
       else
         listDevices(camMenupopup, videoDevices);
 
       if (!sharingAudio)
         listDevices(micMenupopup, audioDevices);
 
       this.mainAction.callback = function(aState, aRemember) {
         let allowedDevices = [];
         let perms = Services.perms;
         if (videoDevices.length) {
           let listId = "webRTC-select" + (sharingScreen ? "Window" : "Camera") + "-menulist";
-          let videoDeviceIndex = chromeDoc.getElementById(listId).value;
+          let videoDeviceIndex = doc.getElementById(listId).value;
           let allowCamera = videoDeviceIndex != "-1";
           if (allowCamera) {
             allowedDevices.push(videoDeviceIndex);
             // Session permission will be removed after use
             // (it's really one-shot, not for the entire session)
             perms.add(uri, "MediaManagerVideo", perms.ALLOW_ACTION,
                       perms.EXPIRE_SESSION);
           }
           if (aRemember) {
             perms.add(uri, "camera",
                       allowCamera ? perms.ALLOW_ACTION : perms.DENY_ACTION);
           }
         }
         if (audioDevices.length) {
           if (!sharingAudio) {
-            let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value;
+            let audioDeviceIndex = doc.getElementById("webRTC-selectMicrophone-menulist").value;
             let allowMic = audioDeviceIndex != "-1";
             if (allowMic)
               allowedDevices.push(audioDeviceIndex);
             if (aRemember) {
               perms.add(uri, "microphone",
                         allowMic ? perms.ALLOW_ACTION : perms.DENY_ACTION);
             }
           } else {
@@ -669,19 +668,21 @@ function prompt(aBrowser, aRequest) {
   let anchorId = "webRTC-share" + iconType + "-notification-icon";
 
   let iconClass = iconType.toLowerCase();
   if (iconClass == "devices")
     iconClass = "camera";
   options.popupIconClass = iconClass + "-icon";
 
   notification =
-    chromeWin.PopupNotifications.show(aBrowser, "webRTC-shareDevices", message,
-                                      anchorId, mainAction, secondaryActions,
-                                      options);
+    chromeDoc.defaultView
+             .PopupNotifications
+             .show(aBrowser, "webRTC-shareDevices", message,
+                   anchorId, mainAction, secondaryActions,
+                   options);
   notification.callID = aRequest.callID;
 }
 
 function removePrompt(aBrowser, aCallId) {
   let chromeWin = aBrowser.ownerGlobal;
   let notification =
     chromeWin.PopupNotifications.getNotification("webRTC-shareDevices", aBrowser);
   if (notification && notification.callID == aCallId)
@@ -760,18 +761,18 @@ function getGlobalIndicator() {
       let count = activeStreams.length;
       let label = PluralForm.get(count, bundle.GetStringFromName(labelId)).replace("#1", count);
       menuitem.setAttribute("label", label);
       menuitem.setAttribute("disabled", "true");
       this.appendChild(menuitem);
 
       for (let stream of activeStreams) {
         let item = this.ownerDocument.createElement("menuitem");
-        let labelId = "webrtcIndicator.controlSharingOn.menuitem";
-        let label = stream.browser.contentTitle || stream.uri;
+        labelId = "webrtcIndicator.controlSharingOn.menuitem";
+        label = stream.browser.contentTitle || stream.uri;
         item.setAttribute("label", bundle.formatStringFromName(labelId, [label], 1));
         item.setAttribute("type", type);
         item.stream = stream;
         item.addEventListener("command", indicator._command);
         this.appendChild(item);
       }
 
       return true;