Bug 1311315 - General small fixes for no-undef eslint issues in browser/. r?jaws draft
authorMark Banner <standard8@mozilla.com>
Tue, 18 Oct 2016 12:34:35 +0100
changeset 427567 3290005050801b4bebfa714d770e6f2e631b3a5b
parent 427560 3f0aeafe59c40c5e92ba9636fa718cf26088e127
child 534499 27329dac02ac20c484139d6aec322bb519703594
push id33050
push userbmo:standard8@mozilla.com
push dateThu, 20 Oct 2016 15:28:07 +0000
reviewersjaws
bugs1311315
milestone52.0a1
Bug 1311315 - General small fixes for no-undef eslint issues in browser/. r?jaws Drop linting of the .eslintrc.js config files. Fix some minor errors in the code (missing let/const, undefined vars). Let eslint know that some files get their globals from other places (typically via xul script tags). MozReview-Commit-ID: CwxuwPtRUr6
.eslintignore
browser/base/content/aboutNetError.xhtml
browser/base/content/abouthome/aboutHome.js
browser/components/contextualidentity/test/browser/.eslintrc.js
browser/components/contextualidentity/test/browser/browser_windowName.js
browser/components/customizableui/CustomizableWidgets.jsm
browser/components/customizableui/test/browser_988072_sidebar_events.js
browser/components/originattributes/test/browser/file_sharedworker.js
browser/components/preferences/applicationManager.js
browser/components/preferences/fonts.js
browser/components/preferences/handlers.xml
browser/components/preferences/in-content/preferences.js
browser/components/syncedtabs/test/browser/.eslintrc.js
browser/components/syncedtabs/test/xpcshell/.eslintrc.js
browser/components/tests/unit/.eslintrc.js
browser/components/tests/unit/test_distribution.js
browser/extensions/e10srollout/bootstrap.js
browser/extensions/formautofill/test/unit/.eslintrc
browser/extensions/pocket/test/.eslintrc.js
browser/extensions/webcompat/test/browser/.eslintrc.js
browser/modules/WindowsPreviewPerTab.jsm
browser/modules/test/head.js
browser/tools/mozscreenshots/.eslintrc.js
browser/tools/mozscreenshots/controlCenter/browser_controlCenter.js
browser/tools/mozscreenshots/devtools/browser_devtools.js
browser/tools/mozscreenshots/permissionPrompts/browser_permissionPrompts.js
browser/tools/mozscreenshots/preferences/browser_preferences.js
browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js
testing/mochitest/browser.eslintrc.js
testing/xpcshell/xpcshell.eslintrc.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,11 +1,8 @@
-# Allow linting of .eslintrc.js files.
-!**/.eslintrc.js
-
 # Always ignore node_modules.
 **/node_modules/**/*.*
 
 # Exclude expected objdirs.
 obj*/**
 
 # We ignore all these directories by default, until we get them enabled.
 # If you are enabling a directory, please add directory specific exclusions
--- a/browser/base/content/aboutNetError.xhtml
+++ b/browser/base/content/aboutNetError.xhtml
@@ -96,17 +96,17 @@
 
       function doOverride(buttonEl) {
         var event = new CustomEvent("AboutNetErrorOverride", {bubbles:true});
         document.dispatchEvent(event);
         retryThis(buttonEl);
       }
 
       function toggleDisplay(node) {
-        toggle = {
+        const toggle = {
           "": "block",
           "none": "block",
           "block": "none"
         };
         return (node.style.display = toggle[node.style.display]);
       }
 
       function showCertificateErrorReporting() {
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -1,14 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
+/* import-globals-from ../contentSearchUI.js */
+
 // The process of adding a new default snippet involves:
 //   * add a new entity to aboutHome.dtd
 //   * add a <span/> for it in aboutHome.xhtml
 //   * add an entry here in the proper ordering (based on spans)
 // The <a/> part of the snippet will be linked to the corresponding url.
 const DEFAULT_SNIPPETS_URLS = [
   "https://www.mozilla.org/firefox/features/?utm_source=snippet&utm_medium=snippet&utm_campaign=default+feature+snippet"
 , "https://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons"
--- a/browser/components/contextualidentity/test/browser/.eslintrc.js
+++ b/browser/components/contextualidentity/test/browser/.eslintrc.js
@@ -1,7 +1,11 @@
 "use strict";
 
 module.exports = {
   "extends": [
     "../../../../../testing/mochitest/browser.eslintrc.js"
-  ]
+  ],
+
+  "rules": {
+    "no-undef": 2
+  }
 };
--- a/browser/components/contextualidentity/test/browser/browser_windowName.js
+++ b/browser/components/contextualidentity/test/browser/browser_windowName.js
@@ -35,17 +35,17 @@ add_task(function* test() {
   let browser2 = gBrowser.getBrowserForTab(tab2);
   yield BrowserTestUtils.browserLoaded(browser2);
   yield ContentTask.spawn(browser2, null, function(opts) {
     content.window.name = 'tab-2';
   });
 
   // Let's try to open a window from tab1 with a name 'tab-2'.
   info("Opening a window from the first tab...");
-  yield ContentTask.spawn(browser1, { url: BASE_URI + '?new' }, function(opts) {
+  yield ContentTask.spawn(browser1, { url: BASE_URI + '?new' }, function* (opts) {
     yield (new content.window.wrappedJSObject.Promise(resolve => {
       let w = content.window.wrappedJSObject.open(opts.url, 'tab-2');
       w.onload = function() { resolve(); }
     }));
   });
 
   is(browser1.contentTitle, '?old', "Tab1 title must be 'old'");
   is(browser1.contentPrincipal.userContextId, 1, "Tab1 UCI must be 1");
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -1254,18 +1254,19 @@ if (Services.prefs.getBoolPref("privacy.
 }
 
 if (AppConstants.E10S_TESTING_ONLY) {
   if (Services.appinfo.browserTabsRemoteAutostart) {
     CustomizableWidgets.push({
       id: "e10s-button",
       defaultArea: CustomizableUI.AREA_PANEL,
       onBuild: function(aDocument) {
-          node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label"));
-          node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext"));
+        let node = aDocument.createElementNS(kNSXUL, "toolbarbutton");
+        node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label"));
+        node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext"));
       },
       onCommand: function(aEvent) {
         let win = aEvent.view;
         win.OpenBrowserWindow({remote: false});
       },
     });
   }
 }
--- a/browser/components/customizableui/test/browser_988072_sidebar_events.js
+++ b/browser/components/customizableui/test/browser_988072_sidebar_events.js
@@ -132,261 +132,261 @@ function add_sidebar_task(description, s
     gTestSidebarItem.remove();
     removeWidget();
   });
 }
 
 add_sidebar_task(
   "Check that a sidebar that uses a command event listener works",
 function*() {
-  gTestSidebarItem.addEventListener("command", sawEvent);
+  gTestSidebarItem.addEventListener("command", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ command: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses a click event listener works",
 function*() {
-  gTestSidebarItem.addEventListener("click", sawEvent);
+  gTestSidebarItem.addEventListener("click", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ click: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses both click and command event listeners works",
 function*() {
-  gTestSidebarItem.addEventListener("command", sawEvent);
-  gTestSidebarItem.addEventListener("click", sawEvent);
+  gTestSidebarItem.addEventListener("command", window.sawEvent);
+  gTestSidebarItem.addEventListener("click", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ command: 1, click: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses an oncommand attribute works",
 function*() {
-  gTestSidebarItem.setAttribute("oncommand", "sawEvent(event, true)");
+  gTestSidebarItem.setAttribute("oncommand", "window.sawEvent(event, true)");
 }, function*() {
   checkExpectedEvents({ oncommand: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses an onclick attribute works",
 function*() {
-  gTestSidebarItem.setAttribute("onclick", "sawEvent(event, true)");
+  gTestSidebarItem.setAttribute("onclick", "window.sawEvent(event, true)");
 }, function*() {
   checkExpectedEvents({ onclick: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses both onclick and oncommand attributes works",
 function*() {
-  gTestSidebarItem.setAttribute("onclick", "sawEvent(event, true)");
-  gTestSidebarItem.setAttribute("oncommand", "sawEvent(event, true)");
+  gTestSidebarItem.setAttribute("onclick", "window.sawEvent(event, true)");
+  gTestSidebarItem.setAttribute("oncommand", "window.sawEvent(event, true)");
 }, function*() {
   checkExpectedEvents({ onclick: 1, oncommand: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses an onclick attribute and a command listener works",
 function*() {
-  gTestSidebarItem.setAttribute("onclick", "sawEvent(event, true)");
-  gTestSidebarItem.addEventListener("command", sawEvent);
+  gTestSidebarItem.setAttribute("onclick", "window.sawEvent(event, true)");
+  gTestSidebarItem.addEventListener("command", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ onclick: 1, command: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses an oncommand attribute and a click listener works",
 function*() {
-  gTestSidebarItem.setAttribute("oncommand", "sawEvent(event, true)");
-  gTestSidebarItem.addEventListener("click", sawEvent);
+  gTestSidebarItem.setAttribute("oncommand", "window.sawEvent(event, true)");
+  gTestSidebarItem.addEventListener("click", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ click: 1, oncommand: 1 });
 });
 
 add_sidebar_task(
   "A sidebar with both onclick attribute and click listener sees only one event :(",
 function*() {
-  gTestSidebarItem.setAttribute("onclick", "sawEvent(event, true)");
-  gTestSidebarItem.addEventListener("click", sawEvent);
+  gTestSidebarItem.setAttribute("onclick", "window.sawEvent(event, true)");
+  gTestSidebarItem.addEventListener("click", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ onclick: 1 });
 });
 
 add_sidebar_task(
   "A sidebar with both oncommand attribute and command listener sees only one event :(",
 function*() {
-  gTestSidebarItem.setAttribute("oncommand", "sawEvent(event, true)");
-  gTestSidebarItem.addEventListener("command", sawEvent);
+  gTestSidebarItem.setAttribute("oncommand", "window.sawEvent(event, true)");
+  gTestSidebarItem.addEventListener("command", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ oncommand: 1 });
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses a broadcaster with an oncommand attribute works",
 function*() {
   let broadcaster = document.createElement("broadcaster");
   broadcaster.setAttribute("id", "testbroadcaster");
-  broadcaster.setAttribute("oncommand", "sawEvent(event, true)");
+  broadcaster.setAttribute("oncommand", "window.sawEvent(event, true)");
   broadcaster.setAttribute("label", "Test Sidebar");
   document.getElementById("mainBroadcasterSet").appendChild(broadcaster);
 
   gTestSidebarItem.setAttribute("observes", "testbroadcaster");
 }, function*() {
   checkExpectedEvents({ oncommand: 1 });
   document.getElementById("testbroadcaster").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses a broadcaster with an onclick attribute works",
 function*() {
   let broadcaster = document.createElement("broadcaster");
   broadcaster.setAttribute("id", "testbroadcaster");
-  broadcaster.setAttribute("onclick", "sawEvent(event, true)");
+  broadcaster.setAttribute("onclick", "window.sawEvent(event, true)");
   broadcaster.setAttribute("label", "Test Sidebar");
   document.getElementById("mainBroadcasterSet").appendChild(broadcaster);
 
   gTestSidebarItem.setAttribute("observes", "testbroadcaster");
 }, function*() {
   checkExpectedEvents({ onclick: 1 });
   document.getElementById("testbroadcaster").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses a broadcaster with both onclick and oncommand attributes works",
 function*() {
   let broadcaster = document.createElement("broadcaster");
   broadcaster.setAttribute("id", "testbroadcaster");
-  broadcaster.setAttribute("onclick", "sawEvent(event, true)");
-  broadcaster.setAttribute("oncommand", "sawEvent(event, true)");
+  broadcaster.setAttribute("onclick", "window.sawEvent(event, true)");
+  broadcaster.setAttribute("oncommand", "window.sawEvent(event, true)");
   broadcaster.setAttribute("label", "Test Sidebar");
   document.getElementById("mainBroadcasterSet").appendChild(broadcaster);
 
   gTestSidebarItem.setAttribute("observes", "testbroadcaster");
 }, function*() {
   checkExpectedEvents({ onclick: 1, oncommand: 1 });
   document.getElementById("testbroadcaster").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar with a click listener and a broadcaster with an oncommand attribute works",
 function*() {
   let broadcaster = document.createElement("broadcaster");
   broadcaster.setAttribute("id", "testbroadcaster");
-  broadcaster.setAttribute("oncommand", "sawEvent(event, true)");
+  broadcaster.setAttribute("oncommand", "window.sawEvent(event, true)");
   broadcaster.setAttribute("label", "Test Sidebar");
   document.getElementById("mainBroadcasterSet").appendChild(broadcaster);
 
   gTestSidebarItem.setAttribute("observes", "testbroadcaster");
-  gTestSidebarItem.addEventListener("click", sawEvent);
+  gTestSidebarItem.addEventListener("click", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ click: 1, oncommand: 1 });
   document.getElementById("testbroadcaster").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar with a command listener and a broadcaster with an onclick attribute works",
 function*() {
   let broadcaster = document.createElement("broadcaster");
   broadcaster.setAttribute("id", "testbroadcaster");
-  broadcaster.setAttribute("onclick", "sawEvent(event, true)");
+  broadcaster.setAttribute("onclick", "window.sawEvent(event, true)");
   broadcaster.setAttribute("label", "Test Sidebar");
   document.getElementById("mainBroadcasterSet").appendChild(broadcaster);
 
   gTestSidebarItem.setAttribute("observes", "testbroadcaster");
-  gTestSidebarItem.addEventListener("command", sawEvent);
+  gTestSidebarItem.addEventListener("command", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ onclick: 1, command: 1 });
   document.getElementById("testbroadcaster").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar with a click listener and a broadcaster with an onclick " +
   "attribute only sees one event :(",
 function*() {
   let broadcaster = document.createElement("broadcaster");
   broadcaster.setAttribute("id", "testbroadcaster");
-  broadcaster.setAttribute("onclick", "sawEvent(event, true)");
+  broadcaster.setAttribute("onclick", "window.sawEvent(event, true)");
   broadcaster.setAttribute("label", "Test Sidebar");
   document.getElementById("mainBroadcasterSet").appendChild(broadcaster);
 
   gTestSidebarItem.setAttribute("observes", "testbroadcaster");
-  gTestSidebarItem.addEventListener("click", sawEvent);
+  gTestSidebarItem.addEventListener("click", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ onclick: 1 });
   document.getElementById("testbroadcaster").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar with a command listener and a broadcaster with an oncommand " +
   "attribute only sees one event :(",
 function*() {
   let broadcaster = document.createElement("broadcaster");
   broadcaster.setAttribute("id", "testbroadcaster");
-  broadcaster.setAttribute("oncommand", "sawEvent(event, true)");
+  broadcaster.setAttribute("oncommand", "window.sawEvent(event, true)");
   broadcaster.setAttribute("label", "Test Sidebar");
   document.getElementById("mainBroadcasterSet").appendChild(broadcaster);
 
   gTestSidebarItem.setAttribute("observes", "testbroadcaster");
-  gTestSidebarItem.addEventListener("command", sawEvent);
+  gTestSidebarItem.addEventListener("command", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ oncommand: 1 });
   document.getElementById("testbroadcaster").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses a command element with a command event listener works",
 function*() {
   let command = document.createElement("command");
   command.setAttribute("id", "testcommand");
   document.getElementById("mainCommandSet").appendChild(command);
-  command.addEventListener("command", sawEvent);
+  command.addEventListener("command", window.sawEvent);
 
   gTestSidebarItem.setAttribute("command", "testcommand");
 }, function*() {
   checkExpectedEvents({ command: 1 });
   document.getElementById("testcommand").remove();
 });
 
 add_sidebar_task(
   "Check that a sidebar that uses a command element with an oncommand attribute works",
 function*() {
   let command = document.createElement("command");
   command.setAttribute("id", "testcommand");
-  command.setAttribute("oncommand", "sawEvent(event, true)");
+  command.setAttribute("oncommand", "window.sawEvent(event, true)");
   document.getElementById("mainCommandSet").appendChild(command);
 
   gTestSidebarItem.setAttribute("command", "testcommand");
 }, function*() {
   checkExpectedEvents({ oncommand: 1 });
   document.getElementById("testcommand").remove();
 });
 
 add_sidebar_task("Check that a sidebar that uses a command element with a " +
   "command event listener and oncommand attribute works",
 function*() {
   let command = document.createElement("command");
   command.setAttribute("id", "testcommand");
-  command.setAttribute("oncommand", "sawEvent(event, true)");
+  command.setAttribute("oncommand", "window.sawEvent(event, true)");
   document.getElementById("mainCommandSet").appendChild(command);
-  command.addEventListener("command", sawEvent);
+  command.addEventListener("command", window.sawEvent);
 
   gTestSidebarItem.setAttribute("command", "testcommand");
 }, function*() {
   checkExpectedEvents({ command: 1, oncommand: 1 });
   document.getElementById("testcommand").remove();
 });
 
 add_sidebar_task(
   "A sidebar with a command element will still see click events",
 function*() {
   let command = document.createElement("command");
   command.setAttribute("id", "testcommand");
-  command.setAttribute("oncommand", "sawEvent(event, true)");
+  command.setAttribute("oncommand", "window.sawEvent(event, true)");
   document.getElementById("mainCommandSet").appendChild(command);
-  command.addEventListener("command", sawEvent);
+  command.addEventListener("command", window.sawEvent);
 
   gTestSidebarItem.setAttribute("command", "testcommand");
-  gTestSidebarItem.addEventListener("click", sawEvent);
+  gTestSidebarItem.addEventListener("click", window.sawEvent);
 }, function*() {
   checkExpectedEvents({ click: 1, command: 1, oncommand: 1 });
   document.getElementById("testcommand").remove();
 });
--- a/browser/components/originattributes/test/browser/file_sharedworker.js
+++ b/browser/components/originattributes/test/browser/file_sharedworker.js
@@ -1,7 +1,9 @@
 self.randomValue = Math.random();
 
+/* global onconnect:true */
+
 onconnect = function (e) {
   let port = e.ports[0];
   port.postMessage(self.randomValue);
   port.start();
 };
--- a/browser/components/preferences/applicationManager.js
+++ b/browser/components/preferences/applicationManager.js
@@ -1,12 +1,14 @@
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
+/* import-globals-from in-content/applications.js */
+
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 
 var gAppManagerDialog = {
   _removed: [],
 
   init: function appManager_init() {
     this.handlerInfo = window.arguments[0];
--- a/browser/components/preferences/fonts.js
+++ b/browser/components/preferences/fonts.js
@@ -1,13 +1,15 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../../../toolkit/mozapps/preferences/fontbuilder.js */
+
 // browser.display.languageList LOCK ALL when LOCKED
 
 const kDefaultFontType          = "font.default.%LANG%";
 const kFontNameFmtSerif         = "font.name.serif.%LANG%";
 const kFontNameFmtSansSerif     = "font.name.sans-serif.%LANG%";
 const kFontNameFmtMonospace     = "font.name.monospace.%LANG%";
 const kFontNameListFmtSerif     = "font.name-list.serif.%LANG%";
 const kFontNameListFmtSansSerif = "font.name-list.sans-serif.%LANG%";
@@ -96,9 +98,8 @@ var gFontsDialog = {
     let {Services} = Components.utils.import("resource://gre/modules/Services.jsm", {});
     let flags = Services.prompt.BUTTON_POS_1 * Services.prompt.BUTTON_TITLE_CANCEL |
                 Services.prompt.BUTTON_POS_0 * Services.prompt.BUTTON_TITLE_IS_STRING |
                 Services.prompt.BUTTON_POS_1_DEFAULT;
     let buttonChosen = Services.prompt.confirmEx(window, title, warningMessage, flags, confirmLabel, null, "", "", {});
     return buttonChosen == 0;
   },
 };
-
--- a/browser/components/preferences/handlers.xml
+++ b/browser/components/preferences/handlers.xml
@@ -1,13 +1,14 @@
 <?xml version="1.0"?>
 
 <!-- This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<!-- import-globals-from in-content/applications.js -->
 
 <!DOCTYPE overlay [
   <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
   <!ENTITY % applicationsDTD SYSTEM "chrome://browser/locale/preferences/applications.dtd">
   %brandDTD;
   %applicationsDTD;
 ]>
 
--- a/browser/components/preferences/in-content/preferences.js
+++ b/browser/components/preferences/in-content/preferences.js
@@ -1,12 +1,24 @@
 /* - This Source Code Form is subject to the terms of the Mozilla Public
    - License, v. 2.0. If a copy of the MPL was not distributed with this file,
    - You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+// Import globals from the files imported by the .xul files.
+/* import-globals-from subdialogs.js */
+/* import-globals-from advanced.js */
+/* import-globals-from main.js */
+/* import-globals-from search.js */
+/* import-globals-from content.js */
+/* import-globals-from privacy.js */
+/* import-globals-from applications.js */
+/* import-globals-from security.js */
+/* import-globals-from sync.js */
+/* import-globals-from ../../../base/content/utilityOverlay.js */
+
 "use strict";
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 var Cr = Components.results;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
copy from browser/components/contextualidentity/test/browser/.eslintrc.js
copy to browser/components/syncedtabs/test/browser/.eslintrc.js
new file mode 100644
--- /dev/null
+++ b/browser/components/syncedtabs/test/xpcshell/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../../testing/xpcshell/xpcshell.eslintrc.js"
+  ]
+};
new file mode 100644
--- /dev/null
+++ b/browser/components/tests/unit/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../testing/xpcshell/xpcshell.eslintrc.js"
+  ]
+};
--- a/browser/components/tests/unit/test_distribution.js
+++ b/browser/components/tests/unit/test_distribution.js
@@ -4,16 +4,17 @@
 /**
  * Tests that preferences are properly set by distribution.ini
  */
 
 Cu.import("resource://gre/modules/LoadContextInfo.jsm");
 
 // Import common head.
 var commonFile = do_get_file("../../../../toolkit/components/places/tests/head_common.js", false);
+/* import-globals-from ../../../../toolkit/components/places/tests/head_common.js */
 if (commonFile) {
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 const TOPICDATA_DISTRIBUTION_CUSTOMIZATION = "force-distribution-customization";
 const TOPIC_BROWSERGLUE_TEST = "browser-glue-test";
 
--- a/browser/extensions/e10srollout/bootstrap.js
+++ b/browser/extensions/e10srollout/bootstrap.js
@@ -237,17 +237,17 @@ let performLongSpinnerCheck = Task.async
         // The Histogram might not be defined in this ping if no data was recorded for it.
         // In this case, we still add the session length because that was a valid session
         // without a long spinner.
         continue;
       }
 
       let histogram = ping.payload.histograms[LONG_SPINNER_HISTOGRAM];
 
-      for (spinnerTime of Object.keys(histogram.values)) {
+      for (let spinnerTime of Object.keys(histogram.values)) {
         // Only consider spinners that took more than 2 seconds.
         // Note: the first bucket size that fits this criteria is
         // 2297ms. And the largest bucket is 64000ms, meaning that
         // any pause larger than that is only counted as a 64s pause.
         // For reference, the bucket sizes are:
         // 0, 1000, 2297, 5277, 12124, 27856, 64000
         if (spinnerTime >= 2000) {
           totalSpinnerTime += spinnerTime * histogram.values[spinnerTime];
--- a/browser/extensions/formautofill/test/unit/.eslintrc
+++ b/browser/extensions/formautofill/test/unit/.eslintrc
@@ -1,5 +1,5 @@
 {
   "extends": [
-    "../../../../../testing/xpcshell/xpcshell.eslintrc"
+    "../../../../../testing/xpcshell/xpcshell.eslintrc.js"
   ],
 }
new file mode 100644
--- /dev/null
+++ b/browser/extensions/pocket/test/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../testing/mochitest/browser.eslintrc.js"
+  ]
+};
copy from browser/components/contextualidentity/test/browser/.eslintrc.js
copy to browser/extensions/webcompat/test/browser/.eslintrc.js
--- a/browser/modules/WindowsPreviewPerTab.jsm
+++ b/browser/modules/WindowsPreviewPerTab.jsm
@@ -601,17 +601,17 @@ TabWindow.prototype = {
   directRequestProtocols: new Set([
     "file", "chrome", "resource", "about"
   ]),
   onLinkIconAvailable: function (aBrowser, aIconURL) {
     let requestURL = null;
     if (aIconURL) {
       let shouldRequestFaviconURL = true;
       try {
-        urlObject = NetUtil.newURI(aIconURL);
+        let urlObject = NetUtil.newURI(aIconURL);
         shouldRequestFaviconURL =
           !this.directRequestProtocols.has(urlObject.scheme);
       } catch (ex) {}
 
       requestURL = shouldRequestFaviconURL ?
         "moz-anno:favicon:" + aIconURL :
         aIconURL;
     }
--- a/browser/modules/test/head.js
+++ b/browser/modules/test/head.js
@@ -24,11 +24,11 @@ function waitForConditionPromise(conditi
     return undefined;
   }
   setTimeout(checkCondition, SINGLE_TRY_TIMEOUT);
   return defer.promise;
 }
 
 function waitForCondition(condition, nextTest, errorMsg) {
   waitForConditionPromise(condition, errorMsg).then(nextTest, (reason) => {
-    ok(false, reason + (reason.stack ? "\n" + e.stack : ""));
+    ok(false, reason + (reason.stack ? "\n" + reason.stack : ""));
   });
 }
new file mode 100644
--- /dev/null
+++ b/browser/tools/mozscreenshots/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = { // eslint-disable-line no-undef
+  "extends": [
+    "../../../testing/mochitest/browser.eslintrc.js"
+  ],
+};
--- a/browser/tools/mozscreenshots/controlCenter/browser_controlCenter.js
+++ b/browser/tools/mozscreenshots/controlCenter/browser_controlCenter.js
@@ -1,12 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../head.js */
+
 "use strict";
 
 add_task(function* capture() {
   if (!shouldCapture()) {
     return;
   }
   let sets = ["LightweightThemes", "ControlCenter"];
 
--- a/browser/tools/mozscreenshots/devtools/browser_devtools.js
+++ b/browser/tools/mozscreenshots/devtools/browser_devtools.js
@@ -1,12 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../head.js */
+
 "use strict";
 
 add_task(function* capture() {
   if (!shouldCapture()) {
     return;
   }
   let sets = ["DevTools"];
 
--- a/browser/tools/mozscreenshots/permissionPrompts/browser_permissionPrompts.js
+++ b/browser/tools/mozscreenshots/permissionPrompts/browser_permissionPrompts.js
@@ -1,12 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../head.js */
+
 "use strict";
 
 add_task(function* capture() {
   if (!shouldCapture()) {
     return;
   }
   let sets = ["LightweightThemes", "PermissionPrompts"];
 
--- a/browser/tools/mozscreenshots/preferences/browser_preferences.js
+++ b/browser/tools/mozscreenshots/preferences/browser_preferences.js
@@ -1,12 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../head.js */
+
 "use strict";
 
 add_task(function* capture() {
   if (!shouldCapture()) {
     return;
   }
   let sets = ["Preferences"];
 
--- a/browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js
+++ b/browser/tools/mozscreenshots/primaryUI/browser_primaryUI.js
@@ -1,12 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* import-globals-from ../head.js */
+
 "use strict";
 
 add_task(function* capture() {
   if (!shouldCapture()) {
     return;
   }
 
   requestLongerTimeout(20);
--- a/testing/mochitest/browser.eslintrc.js
+++ b/testing/mochitest/browser.eslintrc.js
@@ -24,16 +24,17 @@ module.exports = {
     "export_assertions": false,
     "extractJarToTmp": false,
     "finish": false,
     "getJar": false,
     "getRootDirectory": false,
     "getTestFilePath": false,
     "gTestPath": false,
     "info": false,
+    "ignoreAllUncaughtExceptions": false,
     "is": false,
     "isnot": false,
     "ok": false,
     "registerCleanupFunction": false,
     "requestLongerTimeout": false,
     "SimpleTest": false,
     "SpecialPowers": false,
     "TestUtils": false,
--- a/testing/xpcshell/xpcshell.eslintrc.js
+++ b/testing/xpcshell/xpcshell.eslintrc.js
@@ -15,16 +15,17 @@ module.exports = {
     "do_check_neq": false,
     "do_check_null": false,
     "do_check_true": false,
     "do_execute_soon": false,
     "do_get_cwd": false,
     "do_get_file": false,
     "do_get_idle": false,
     "do_get_profile": false,
+    "do_get_tempdir": false,
     "do_load_module": false,
     "do_parse_document": false,
     "do_print": false,
     "do_register_cleanup": false,
     "do_report_unexpected_exception": false,
     "do_test_finished": false,
     "do_test_pending": false,
     "do_throw": false,