Bug 1325623 - Fix most no-undef eslint issues in toolkit/components. r?Mossop draft
authorMark Banner <standard8@mozilla.com>
Fri, 23 Dec 2016 16:00:46 +0000
changeset 453503 efb2d2adda7cb5417c2ae25a3fa4f3a80f7e0f0c
parent 453266 2785aaf276ba29fb2e1f5607d90d441fee42efb4
child 540489 dc96ac28d774ebe01b4ee8bd455be793d627acdd
push id39695
push userbmo:standard8@mozilla.com
push dateFri, 23 Dec 2016 18:28:26 +0000
reviewersMossop
bugs1325623
milestone53.0a1
Bug 1325623 - Fix most no-undef eslint issues in toolkit/components. r?Mossop MozReview-Commit-ID: DYJa1uNVagw
testing/mochitest/mochitest.eslintrc.js
testing/xpcshell/xpcshell.eslintrc.js
toolkit/.eslintrc.js
toolkit/components/contextualidentity/tests/unit/.eslintrc.js
toolkit/components/cookie/content/cookieAcceptDialog.js
toolkit/components/ctypes/tests/unit/test_finalizer.js
toolkit/components/ctypes/tests/unit/test_jsctypes.js
toolkit/components/extensions/test/mochitest/.eslintrc.js
toolkit/components/feeds/FeedProcessor.js
toolkit/components/filepicker/nsFilePicker.js
toolkit/components/formautofill/test/xpcshell/head.js
toolkit/components/formautofill/test/xpcshell/loader.js
toolkit/components/jsdownloads/src/DownloadCore.jsm
toolkit/components/jsdownloads/src/Downloads.jsm
toolkit/components/jsdownloads/test/unit/common_test_Download.js
toolkit/components/jsdownloads/test/unit/head.js
toolkit/components/mozintl/test/.eslintrc.js
toolkit/components/places/nsPlacesExpiration.js
toolkit/components/places/tests/bookmarks/head_bookmarks.js
toolkit/components/places/tests/bookmarks/test_1016953-renaming-uncompressed.js
toolkit/components/places/tests/bookmarks/test_818584-discard-duplicate-backups.js
toolkit/components/places/tests/bookmarks/test_818593-store-backup-metadata.js
toolkit/components/places/tests/bookmarks/test_bookmarks.js
toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
toolkit/components/places/tests/expiration/head_expiration.js
toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
toolkit/components/places/tests/favicons/head_favicons.js
toolkit/components/places/tests/history/head_history.js
toolkit/components/places/tests/migration/head_migration.js
toolkit/components/places/tests/queries/head_queries.js
toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
toolkit/components/places/tests/unifiedcomplete/test_search_engine_current.js
toolkit/components/places/tests/unit/head_bookmarks.js
toolkit/components/places/tests/unit/test_415757.js
toolkit/components/places/tests/unit/test_async_transactions.js
toolkit/components/places/tests/unit/test_bookmarks_html.js
toolkit/components/places/tests/unit/test_bookmarks_json.js
toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js
toolkit/components/places/tests/unit/test_history_clear.js
toolkit/components/places/tests/unit/test_preventive_maintenance.js
toolkit/components/places/tests/unit/test_sync_utils.js
toolkit/components/printing/content/printPreviewBindings.xml
toolkit/components/printing/content/printUtils.js
toolkit/components/printing/content/printdialog.js
toolkit/components/prompts/test/test_bug619644.html
toolkit/components/prompts/test/test_bug620145.html
toolkit/components/prompts/test/test_dom_prompts.html
toolkit/components/prompts/test/test_subresources_prompts.html
toolkit/components/reader/test/.eslintrc.js
toolkit/components/satchel/test/browser/browser_privbrowsing_perwindowpb.js
toolkit/components/satchel/test/satchel_common.js
toolkit/components/satchel/test/test_bug_511615.html
toolkit/components/satchel/test/test_bug_787624.html
toolkit/components/satchel/test/test_datalist_with_caching.html
toolkit/components/satchel/test/test_form_autocomplete.html
toolkit/components/satchel/test/test_form_autocomplete_with_list.html
toolkit/components/satchel/test/test_form_submission.html
toolkit/components/satchel/test/test_form_submission_cap.html
toolkit/components/satchel/test/test_form_submission_cap2.html
toolkit/components/satchel/test/test_popup_direction.html
toolkit/components/satchel/test/test_popup_enter_event.html
toolkit/components/satchel/test/unit/test_db_update_v4b.js
toolkit/components/satchel/test/unit/test_history_api.js
toolkit/components/search/tests/xpcshell/test_json_cache.js
toolkit/components/startup/tests/unit/head_startup.js
toolkit/components/telemetry/datareporting-prefs.js
toolkit/components/telemetry/healthreport-prefs.js
toolkit/components/telemetry/tests/browser/.eslintrc.js
toolkit/components/telemetry/tests/browser/browser_TelemetryGC.js
toolkit/components/telemetry/tests/unit/head.js
toolkit/components/telemetry/tests/unit/test_TelemetryCaptureStack.js
toolkit/components/telemetry/tests/unit/test_TelemetryController.js
toolkit/components/telemetry/tests/unit/test_TelemetryEvents.js
toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js
toolkit/components/thumbnails/test/head.js
toolkit/components/tooltiptext/tests/.eslintrc.js
--- a/testing/mochitest/mochitest.eslintrc.js
+++ b/testing/mochitest/mochitest.eslintrc.js
@@ -7,29 +7,32 @@ module.exports = {
   },
 
   "env": {
     "browser": true,
   },
 
   // All globals made available in the test environment.
   "globals": {
+    // $ is defined in SimpleTest.js
+    "$": false,
     "add_task": false,
     "Assert": false,
     "EventUtils": false,
     "executeSoon": false,
     "export_assertions": false,
     "finish": false,
     "getRootDirectory": false,
     "getTestFilePath": false,
     "gTestPath": false,
     "info": false,
     "is": false,
     "isDeeply": false,
     "isnot": false,
+    "netscape": false,
     "ok": false,
     "promise": false,
     "registerCleanupFunction": false,
     "requestLongerTimeout": false,
     "SimpleTest": false,
     "SpecialPowers": false,
     "todo": false,
     "todo_is": false,
--- a/testing/xpcshell/xpcshell.eslintrc.js
+++ b/testing/xpcshell/xpcshell.eslintrc.js
@@ -3,20 +3,22 @@ module.exports = {
   rules: {
     "mozilla/import-headjs-globals": "warn",
     "mozilla/mark-test-function-used": "warn",
     "no-shadow": "error",
   },
 
   // All globals made available in the test environment.
   "globals": {
+    "_TEST_FILE": false,
     "add_task": false,
     "add_test": false,
     "Assert": false,
     "deepEqual": false,
+    "do_await_remote_message": false,
     "do_check_eq": false,
     "do_check_false": false,
     "do_check_matches": false,
     "do_check_neq": false,
     "do_check_null": false,
     "do_check_true": false,
     "do_execute_soon": false,
     "do_get_cwd": false,
@@ -25,33 +27,38 @@ module.exports = {
     "do_get_profile": false,
     "do_get_tempdir": false,
     "do_load_manifest": false,
     "do_load_module": false,
     "do_parse_document": false,
     "do_print": false,
     "do_register_cleanup": false,
     "do_report_unexpected_exception": false,
+    "do_send_remote_message": false,
     "do_test_finished": false,
     "do_test_pending": false,
     "do_throw": false,
     "do_timeout": false,
     "equal": false,
     "greater": false,
     "greaterOrEqual": false,
     "less": false,
     "lessOrEqual": false,
     "load": false,
     "mozinfo": false,
     "notDeepEqual": false,
     "notEqual": false,
     "notStrictEqual": false,
     "ok": false,
+    "runningInParent": false,
     "run_next_test": false,
     "run_test": false,
     "run_test_in_child": false,
     "strictEqual": false,
     "throws": false,
     "todo": false,
     "todo_check_false": false,
     "todo_check_true": false,
+    // Firefox specific function.
+    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/uneval
+    "uneval": false,
   }
 };
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -203,10 +203,11 @@ module.exports = {
     "es6": true,
     "browser": true,
   },
   "globals": {
     "Components": false,
     "dump": true,
     "openDialog": false,
     "sizeToContent": false,
+    "ChromeWorker": false,
   }
 };
new file mode 100644
--- /dev/null
+++ b/toolkit/components/contextualidentity/tests/unit/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../../testing/xpcshell/xpcshell.eslintrc.js"
+  ]
+};
--- a/toolkit/components/cookie/content/cookieAcceptDialog.js
+++ b/toolkit/components/cookie/content/cookieAcceptDialog.js
@@ -87,17 +87,17 @@ function onload()
 
       // use value for the header, so it doesn't wrap.
       var headerNode = document.getElementById("dialog-header");
       headerNode.setAttribute("value", messageParagraphs[0]);
 
       // use childnodes here, the text can wrap
       for (var i = 1; i < messageParagraphs.length; i++) {
         var descriptionNode = document.createElement("description");
-        text = document.createTextNode(messageParagraphs[i]);
+        let text = document.createTextNode(messageParagraphs[i]);
         descriptionNode.appendChild(text);
         messageParent.appendChild(descriptionNode);
       }
 
       if (cookie) {
         document.getElementById('ifl_name').setAttribute("value", cookie.name);
         document.getElementById('ifl_value').setAttribute("value", cookie.value);
         document.getElementById('ifl_host').setAttribute("value", cookie.host);
--- a/toolkit/components/ctypes/tests/unit/test_finalizer.js
+++ b/toolkit/components/ctypes/tests/unit/test_finalizer.js
@@ -254,17 +254,17 @@ function run_test()
   library.close();
 }
 
 // If only I could have Promises to test this :)
 // There is only so much we can do at this stage,
 // if we want to avoid tests overlapping.
 function test_cycles(size, tc) {
   // Now, restart this with unreferenced cycles
-  for (i = 0; i < size / 2; ++i) {
+  for (let i = 0; i < size / 2; ++i) {
     let a = {
       a: ctypes.CDataFinalizer(tc.acquire(i * 2), tc.release),
       b: {
         b: ctypes.CDataFinalizer(tc.acquire(i * 2 + 1), tc.release)
       }
     };
     a.b.a = a;
   }
@@ -320,17 +320,17 @@ function test_result_dispose(size, tc, c
   // Allocate |size| items with references
   for (let i = 0; i < size; ++i) {
     let value = ctypes.CDataFinalizer(tc.acquire(i), tc.release);
     cleanup.add(value);
     ref.push(value);
   }
   do_check_eq(count_finalized(size, tc), 0);
 
-  for (i = 0; i < size; ++i) {
+  for (let i = 0; i < size; ++i) {
     let witness = ref[i].dispose();
     ref[i] = null;
     if (!tc.released(i, witness)) {
       do_print("test_result_dispose failure at index " + i);
       do_check_true(false);
     }
   }
 
@@ -362,17 +362,17 @@ function test_executing_dispose(size, tc
     }
   );
   do_check_eq(count_finalized(size, tc), size);
 
   // Remove references
   ref = [];
 
   // Re-acquire data and make sure that everything has been reinialized
-  for (i = 0; i < size; ++i) {
+  for (let i = 0; i < size; ++i) {
     tc.acquire(i);
   }
 
   do_check_eq(count_finalized(size, tc), 0);
 
 
   // Attempt to trigger finalizations, ensure that they do not take place
   trigger_gc();
@@ -444,9 +444,8 @@ function test_do_not_execute_finalizers_
     cleanup.add(value);
     ref.push(value);
   }
   trigger_gc(); // This might trigger some finalizations, but it should not
 
   // Check that _nothing_ has been finalized
   do_check_eq(count_finalized(size, tc), 0);
 }
-
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js
@@ -5,18 +5,18 @@
 
 try {
   // We might be running without privileges, in which case it's up to the
   // harness to give us the 'ctypes' object.
   Components.utils.import("resource://gre/modules/ctypes.jsm");
 } catch (e) {
 }
 
-CTYPES_TEST_LIB = ctypes.libraryName("jsctypes-test");
-CTYPES_UNICODE_LIB = ctypes.libraryName("jsctyp\u00E8s-t\u00EB\u00DFt");
+const CTYPES_TEST_LIB = ctypes.libraryName("jsctypes-test");
+const CTYPES_UNICODE_LIB = ctypes.libraryName("jsctyp\u00E8s-t\u00EB\u00DFt");
 
 function do_check_throws(f, type, stack)
 {
   if (!stack) {
     try {
       // We might not have a 'Components' object.
       stack = Components.stack.caller;
     } catch (e) {
@@ -67,31 +67,31 @@ function run_test()
   run_integer_tests(library, ctypes.unsigned, "unsigned_int", 4, false, [0, 0xffffffff]);
 
   run_float_tests(library, ctypes.float32_t, "float32_t", 4);
   run_float_tests(library, ctypes.float64_t, "float64_t", 8);
   run_float_tests(library, ctypes.float, "float", 4);
   run_float_tests(library, ctypes.double, "double", 8);
 
   // Test the wrapped integer types.
-  s64limits = ["-9223372036854775808", "9223372036854775807",
-               "-9223372036854775809", "9223372036854775808"];
-  u64limits = ["0", "18446744073709551615", "-1", "18446744073709551616"];
+  const s64limits = ["-9223372036854775808", "9223372036854775807",
+                     "-9223372036854775809", "9223372036854775808"];
+  const u64limits = ["0", "18446744073709551615", "-1", "18446744073709551616"];
 
   run_wrapped_integer_tests(library, ctypes.int64_t, "int64_t", 8, true,
                             ctypes.Int64, "ctypes.Int64", s64limits);
   run_wrapped_integer_tests(library, ctypes.uint64_t, "uint64_t", 8, false,
                             ctypes.UInt64, "ctypes.UInt64", u64limits);
   run_wrapped_integer_tests(library, ctypes.long_long, "long_long", 8, true,
                             ctypes.Int64, "ctypes.Int64", s64limits);
   run_wrapped_integer_tests(library, ctypes.unsigned_long_long, "unsigned_long_long", 8, false,
                             ctypes.UInt64, "ctypes.UInt64", u64limits);
 
-  s32limits = [-0x80000000, 0x7fffffff, -0x80000001, 0x80000000];
-  u32limits = [0, 0xffffffff, -1, 0x100000000];
+  const s32limits = [-0x80000000, 0x7fffffff, -0x80000001, 0x80000000];
+  const u32limits = [0, 0xffffffff, -1, 0x100000000];
 
   let slimits, ulimits;
   if (ctypes.long.size == 8) {
     slimits = s64limits;
     ulimits = u64limits;
   } else if (ctypes.long.size == 4) {
     slimits = s32limits;
     ulimits = u32limits;
@@ -1766,17 +1766,17 @@ function run_PointerType_tests() {
         do_print("Checking that typed array " + (view.constructor.name) +
                  " can NOT be converted to " + item_type + " array");
         do_check_throws(function() { array_type(view); }, TypeError);
       } else {
         do_print("Checking that typed array " + (view.constructor.name) +
                  " can be converted to " + item_type + " array");
 
         // Convert ArrayBuffer to array of the right size and check contents
-        c_array = array_type(c_arraybuffer);
+        let c_array = array_type(c_arraybuffer);
         for (let k = 0; k < number_of_items; ++k) {
           do_check_eq(c_array[k], view[k]);
         }
 
         // Convert typed array to array of the right size and check contents
         c_array = array_type(view);
         for (let k = 0; k < number_of_items; ++k) {
           do_check_eq(c_array[k], view[k]);
@@ -2685,24 +2685,24 @@ function run_variadic_tests(library) {
 
   add_char_short_int_va(result.address(),
                         ctypes.char(5),
                         ctypes.short(7),
                         ctypes.uint32_t(11));
 
   do_check_eq(result.value, 3 + 5 + 7 + 11);
 
-  result = ctypes.int32_t.array(3)([1, 1, 1]),
-      v1 = ctypes.int32_t.array(4)([1, 2, 3, 5]),
-      v2 = ctypes.int32_t.array(3)([7, 11, 13]),
-      vector_add_va = library.declare("test_vector_add_va_cdecl",
+  result = ctypes.int32_t.array(3)([1, 1, 1]);
+  let v1 = ctypes.int32_t.array(4)([1, 2, 3, 5]);
+  let v2 = ctypes.int32_t.array(3)([7, 11, 13]);
+  let vector_add_va = library.declare("test_vector_add_va_cdecl",
                                       ctypes.default_abi, ctypes.int32_t.ptr,
-                                      ctypes.uint8_t, ctypes.uint8_t, "..."),
+                                      ctypes.uint8_t, ctypes.uint8_t, "...");
       // Note that vector_add_va zeroes out result first.
-      vec_sum = vector_add_va(2, 3, result, v1, v2);
+  let vec_sum = vector_add_va(2, 3, result, v1, v2);
   do_check_eq(vec_sum.contents, 8);
   do_check_eq(result[0], 8);
   do_check_eq(result[1], 13);
   do_check_eq(result[2], 16);
 
   do_check_true(!!(sum_va_type().value = sum_va_type()));
   let sum_notva_type = ctypes.FunctionType(sum_va_type.targetType.abi,
                                            sum_va_type.targetType.returnType,
--- a/toolkit/components/extensions/test/mochitest/.eslintrc.js
+++ b/toolkit/components/extensions/test/mochitest/.eslintrc.js
@@ -3,17 +3,16 @@
 module.exports = { // eslint-disable-line no-undef
   "extends": "../../../../../testing/mochitest/mochitest.eslintrc.js",
 
   "env": {
     "webextensions": true,
   },
 
   "globals": {
-    "ChromeWorker": false,
     "onmessage": true,
     "sendAsyncMessage": false,
 
     "waitForLoad": true,
     "promiseConsoleOutput": true,
 
     "ExtensionTestUtils": false,
     "NetUtil": true,
--- a/toolkit/components/feeds/FeedProcessor.js
+++ b/toolkit/components/feeds/FeedProcessor.js
@@ -150,17 +150,17 @@ function bagHasKey(bag, key) {
   catch (e) {
     return false;
   }
 }
 
 function makePropGetter(key) {
   return function FeedPropGetter(bag) {
     try {
-      return value = bag.getProperty(key);
+      return bag.getProperty(key);
     }
     catch (e) {
     }
     return null;
   }
 }
 
 const RDF_NS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
--- a/toolkit/components/filepicker/nsFilePicker.js
+++ b/toolkit/components/filepicker/nsFilePicker.js
@@ -15,16 +15,17 @@
  * (Though ANSI C++ provides exceptions, they are verboten in Mozilla code
  * for portability reasons -- and even when you're building completely
  * platform-specific code, you can't throw across an XPCOM method boundary.)
  */
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const DEBUG = false; /* set to true to enable debug messages */
+var debug;
 
 const LOCAL_FILE_CONTRACTID = "@mozilla.org/file/local;1";
 const APPSHELL_SERV_CONTRACTID  = "@mozilla.org/appshell/appShellService;1";
 const STRBUNDLE_SERV_CONTRACTID = "@mozilla.org/intl/stringbundle;1";
 
 const nsIAppShellService    = Components.interfaces.nsIAppShellService;
 const nsILocalFile          = Components.interfaces.nsILocalFile;
 const nsIFileURL            = Components.interfaces.nsIFileURL;
--- a/toolkit/components/formautofill/test/xpcshell/head.js
+++ b/toolkit/components/formautofill/test/xpcshell/head.js
@@ -1,17 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /*
  * Initialization specific to Form Autofill xpcshell tests.
  *
- * This file is loaded by "loader.js".
+ * This file is loaded alongside loader.js.
  */
 
+/* import-globals-from loader.js */
+
 "use strict";
 
 // The testing framework is fully initialized at this point, you can add
 // xpcshell specific test initialization here.  If you need shared functions or
 // initialization that are not specific to xpcshell, consider adding them to
 // "head_common.js" in the parent folder instead.
 
 add_task_in_parent_process(function* test_xpcshell_initialize_profile() {
--- a/toolkit/components/formautofill/test/xpcshell/loader.js
+++ b/toolkit/components/formautofill/test/xpcshell/loader.js
@@ -12,32 +12,34 @@
 
 "use strict";
 
 var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
 Cu.import("resource://gre/modules/Services.jsm", this);
 
+/* import-globals-from ../loader_common.js */
 Services.scriptloader.loadSubScript(
   Services.io.newFileURI(do_get_file("loader_common.js")).spec, this);
 
 // Define output functions so they look the same across all frameworks.
 var Output = {
   print: do_print,
 };
 
 var executeSoon = do_execute_soon;
 var setTimeout = (fn, delay) => do_timeout(delay, fn);
 
 // Define task registration functions, see description in "loader_common.js".
 var add_task_in_parent_process = add_task;
 var add_task_in_child_process = function() {};
 var add_task_in_both_processes = add_task;
 
+/* import-globals-from ../head_common.js */
 Services.scriptloader.loadSubScript(
   Services.io.newFileURI(do_get_file("head_common.js")).spec, this);
 
 // Tests are always run asynchronously and with the profile loaded.
 function run_test() {
   do_get_profile();
   run_next_test();
 }
--- a/toolkit/components/jsdownloads/src/DownloadCore.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadCore.jsm
@@ -83,16 +83,17 @@ XPCOMUtils.defineLazyServiceGetter(this,
            Ci.nsPIExternalAppLauncher);
 XPCOMUtils.defineLazyServiceGetter(this, "gExternalHelperAppService",
            "@mozilla.org/uriloader/external-helper-app-service;1",
            Ci.nsIExternalHelperAppService);
 XPCOMUtils.defineLazyServiceGetter(this, "gPrintSettingsService",
            "@mozilla.org/gfx/printsettings-service;1",
            Ci.nsIPrintSettingsService);
 
+/* global DownloadIntegration */
 Integration.downloads.defineModuleGetter(this, "DownloadIntegration",
             "resource://gre/modules/DownloadIntegration.jsm");
 
 const BackgroundFileSaverStreamListener = Components.Constructor(
       "@mozilla.org/network/background-file-saver;1?mode=streamlistener",
       "nsIBackgroundFileSaver");
 
 /**
--- a/toolkit/components/jsdownloads/src/Downloads.jsm
+++ b/toolkit/components/jsdownloads/src/Downloads.jsm
@@ -33,16 +33,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/DownloadList.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "DownloadUIHelper",
                                   "resource://gre/modules/DownloadUIHelper.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Promise",
                                   "resource://gre/modules/Promise.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "Task",
                                   "resource://gre/modules/Task.jsm");
 
+/* global DownloadIntegration */
 Integration.downloads.defineModuleGetter(this, "DownloadIntegration",
             "resource://gre/modules/DownloadIntegration.jsm");
 
 // Downloads
 
 /**
  * This object is exposed directly to the consumers of this JavaScript module,
  * and provides the only entry point to get references to back-end objects.
--- a/toolkit/components/jsdownloads/test/unit/common_test_Download.js
+++ b/toolkit/components/jsdownloads/test/unit/common_test_Download.js
@@ -4,16 +4,19 @@
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
  * This script is loaded by "test_DownloadCore.js" and "test_DownloadLegacy.js"
  * with different values of the gUseLegacySaver variable, to apply tests to both
  * the "copy" and "legacy" saver implementations.
  */
 
+/* import-globals-from head.js */
+/* global gUseLegacySaver */
+
 "use strict";
 
 // Globals
 
 const kDeleteTempFileOnExit = "browser.helperApps.deleteTempFileOnExit";
 
 /**
  * Creates and starts a new download, using either DownloadCopySaver or
--- a/toolkit/components/jsdownloads/test/unit/head.js
+++ b/toolkit/components/jsdownloads/test/unit/head.js
@@ -43,16 +43,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "MockRegistrar",
                                   "resource://testing-common/MockRegistrar.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(this, "gExternalHelperAppService",
            "@mozilla.org/uriloader/external-helper-app-service;1",
            Ci.nsIExternalHelperAppService);
 
+/* global DownloadIntegration */
 Integration.downloads.defineModuleGetter(this, "DownloadIntegration",
             "resource://gre/modules/DownloadIntegration.jsm");
 
 const ServerSocket = Components.Constructor(
                                 "@mozilla.org/network/server-socket;1",
                                 "nsIServerSocket",
                                 "init");
 const BinaryOutputStream = Components.Constructor(
new file mode 100644
--- /dev/null
+++ b/toolkit/components/mozintl/test/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../testing/xpcshell/xpcshell.eslintrc.js"
+  ]
+};
--- a/toolkit/components/places/nsPlacesExpiration.js
+++ b/toolkit/components/places/nsPlacesExpiration.js
@@ -828,17 +828,17 @@ nsPlacesExpiration.prototype = {
       // unique places that may fit an optimal database size on this hardware.
       // Oldest pages over this threshold will be expired.
       let memSizeBytes = MEMSIZE_FALLBACK_BYTES;
       try {
         // Limit the size on systems with small memory.
          memSizeBytes = Services.sysinfo.getProperty("memsize");
       } catch (ex) {}
       if (memSizeBytes <= 0) {
-        memsize = MEMSIZE_FALLBACK_BYTES;
+        memSizeBytes = MEMSIZE_FALLBACK_BYTES;
       }
 
       let diskAvailableBytes = DISKSIZE_FALLBACK_BYTES;
       try {
         // Protect against a full disk or tiny quota.
         let dbFile = this._db.databaseFile;
         dbFile.QueryInterface(Ci.nsILocalFile);
         diskAvailableBytes = dbFile.diskSpaceAvailable;
--- a/toolkit/components/places/tests/bookmarks/head_bookmarks.js
+++ b/toolkit/components/places/tests/bookmarks/head_bookmarks.js
@@ -7,14 +7,15 @@ var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
--- a/toolkit/components/places/tests/bookmarks/test_1016953-renaming-uncompressed.js
+++ b/toolkit/components/places/tests/bookmarks/test_1016953-renaming-uncompressed.js
@@ -53,17 +53,17 @@ add_task(function* test_same_date_diff_h
                               "bug10169583_bookmarks.json");
   let {count} = yield BookmarkJSONUtils.exportToFile(tempPath);
   let dateObj = new Date();
   let filename = "bookmarks-" + PlacesBackups.toISODateString(dateObj) + "_" +
                   count + "_" + "differentHash==" + ".json";
   let backupFile = OS.Path.join(backupFolder, filename);
   yield OS.File.move(tempPath, backupFile);
   yield PlacesBackups.create(); // Force compressed backup
-  mostRecentBackupFile = yield PlacesBackups.getMostRecentBackup();
+  let mostRecentBackupFile = yield PlacesBackups.getMostRecentBackup();
 
   // Decode lz4 compressed file to json and check if json is valid
   let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].
                         createInstance(Ci.nsIScriptableUnicodeConverter);
   converter.charset = "UTF-8";
   let result = yield OS.File.read(mostRecentBackupFile, { compression: "lz4" });
   let jsonString = converter.convertFromByteArray(result, result.length);
   do_print("Check is valid JSON");
--- a/toolkit/components/places/tests/bookmarks/test_818584-discard-duplicate-backups.js
+++ b/toolkit/components/places/tests/bookmarks/test_818584-discard-duplicate-backups.js
@@ -41,17 +41,17 @@ add_task(function*() {
   let bookmarkId = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.bookmarks.bookmarksMenuFolder,
                                                         uri("http://foo.com"),
                                                         PlacesUtils.bookmarks.DEFAULT_INDEX,
                                                         "foo");
   // We must enforce a backup since one for today already exists.  The forced
   // backup will replace the existing one.
   yield PlacesBackups.create(undefined, true);
   do_check_eq(backupFiles.length, 1);
-  recentBackup = yield PlacesBackups.getMostRecentBackup();
+  let recentBackup = yield PlacesBackups.getMostRecentBackup();
   do_check_neq(recentBackup, OS.Path.join(backupFolder, oldBackupName));
   matches = OS.Path.basename(recentBackup).match(PlacesBackups.filenamesRegex);
   do_check_eq(matches[1], PlacesBackups.toISODateString(new Date()));
   do_check_eq(matches[2], count + 1);
   do_check_neq(matches[3], hash);
 
   // Clean up
   PlacesUtils.bookmarks.removeItem(bookmarkId);
--- a/toolkit/components/places/tests/bookmarks/test_818593-store-backup-metadata.js
+++ b/toolkit/components/places/tests/bookmarks/test_818593-store-backup-metadata.js
@@ -38,20 +38,19 @@ add_task(function* test_saveBookmarksToJ
   // Clear all backups in our backups folder.
   yield PlacesBackups.create(0);
   do_check_eq((yield PlacesBackups.getBackupFiles()).length, 0);
 
   // Test create() which saves bookmarks with metadata on the filename.
   yield PlacesBackups.create();
   do_check_eq((yield PlacesBackups.getBackupFiles()).length, 1);
 
-  mostRecentBackupFile = yield PlacesBackups.getMostRecentBackup();
+  let mostRecentBackupFile = yield PlacesBackups.getMostRecentBackup();
   do_check_neq(mostRecentBackupFile, null);
   matches = OS.Path.basename(recentBackup).match(PlacesBackups.filenamesRegex);
   do_check_eq(matches[2], nodeCount);
   do_check_eq(matches[3].length, 24);
 
   // Cleanup
   backupFile.remove(false);
   yield PlacesBackups.create(0);
   PlacesUtils.bookmarks.removeItem(bookmarkId);
 });
-
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js
@@ -352,17 +352,17 @@ add_task(function* test_bookmarks() {
     rootNode.containerOpen = false;
   } catch (ex) {
     do_throw("test removeFolderChildren() - querying for children failed: " + ex);
   }
   // 3) remove all children
   bs.removeFolderChildren(tmpFolder);
   // 4) confirm that folder has 0 children
   try {
-    result = hs.executeQuery(query, options);
+    let result = hs.executeQuery(query, options);
     let rootNode = result.root;
     rootNode.containerOpen = true;
     do_check_eq(rootNode.childCount, 0);
     rootNode.containerOpen = false;
   } catch (ex) {
     do_throw("removeFolderChildren(): " + ex);
   }
 
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_eraseEverything.js
@@ -63,17 +63,17 @@ add_task(function* test_eraseEverything(
   Assert.equal(frecencyForUrl("http://example.com/"), frecencyForMozilla);
 
   // Check there are no orphan annotations.
   let conn = yield PlacesUtils.promiseDBConnection();
   let annoAttrs = yield conn.execute(`SELECT id, name FROM moz_anno_attributes`);
   // Bug 1306445 will eventually remove the mobile root anno.
   Assert.equal(annoAttrs.length, 1);
   Assert.equal(annoAttrs[0].getResultByName("name"), PlacesUtils.MOBILE_ROOT_ANNO);
-  let annos = rows = yield conn.execute(`SELECT item_id, anno_attribute_id FROM moz_items_annos`);
+  let annos = yield conn.execute(`SELECT item_id, anno_attribute_id FROM moz_items_annos`);
   Assert.equal(annos.length, 1);
   Assert.equal(annos[0].getResultByName("item_id"), PlacesUtils.mobileFolderId);
   Assert.equal(annos[0].getResultByName("anno_attribute_id"), annoAttrs[0].getResultByName("id"));
 });
 
 add_task(function* test_eraseEverything_roots() {
   yield PlacesUtils.bookmarks.eraseEverything();
 
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_remove.js
@@ -98,17 +98,17 @@ add_task(function* remove_bookmark_orpha
   checkBookmarkObject(bm2);
 
   // Check there are no orphan annotations.
   let conn = yield PlacesUtils.promiseDBConnection();
   let annoAttrs = yield conn.execute(`SELECT id, name FROM moz_anno_attributes`);
   // Bug 1306445 will eventually remove the mobile root anno.
   Assert.equal(annoAttrs.length, 1);
   Assert.equal(annoAttrs[0].getResultByName("name"), PlacesUtils.MOBILE_ROOT_ANNO);
-  let annos = rows = yield conn.execute(`SELECT item_id, anno_attribute_id FROM moz_items_annos`);
+  let annos = yield conn.execute(`SELECT item_id, anno_attribute_id FROM moz_items_annos`);
   Assert.equal(annos.length, 1);
   Assert.equal(annos[0].getResultByName("item_id"), PlacesUtils.mobileFolderId);
   Assert.equal(annos[0].getResultByName("anno_attribute_id"), annoAttrs[0].getResultByName("id"));
 });
 
 add_task(function* remove_bookmark_empty_title() {
   let bm1 = yield PlacesUtils.bookmarks.insert({ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
                                                  type: PlacesUtils.bookmarks.TYPE_BOOKMARK,
--- a/toolkit/components/places/tests/expiration/head_expiration.js
+++ b/toolkit/components/places/tests/expiration/head_expiration.js
@@ -8,16 +8,17 @@ var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
 
 
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
@@ -72,17 +72,17 @@ add_task(function* test_notifications_on
         parentGuid: PlacesUtils.bookmarks.unfiledGuid,
         title: null,
         url: page
       });
       currentTest.bookmarks.push(page);
     }
 
     // Observe history.
-    historyObserver = {
+    let historyObserver = {
       onBeginUpdateBatch: function PEX_onBeginUpdateBatch() {},
       onEndUpdateBatch: function PEX_onEndUpdateBatch() {},
       onClearHistory: function() {},
       onVisit: function() {},
       onTitleChanged: function() {},
       onDeleteURI: function(aURI, aGUID, aReason) {
         currentTest.receivedNotifications++;
         // Check this uri was not bookmarked.
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
@@ -97,17 +97,17 @@ add_task(function* test_notifications_on
         parentGuid: PlacesUtils.bookmarks.unfiledGuid,
         title: null,
         url: page
       });
       currentTest.bookmarks.push(page);
     }
 
     // Observe history.
-    historyObserver = {
+    let historyObserver = {
       onBeginUpdateBatch: function PEX_onBeginUpdateBatch() {},
       onEndUpdateBatch: function PEX_onEndUpdateBatch() {},
       onClearHistory: function() {},
       onVisit: function() {},
       onTitleChanged: function() {},
       onDeleteURI: function(aURI, aGUID, aReason) {
         // Check this uri was not bookmarked.
         do_check_eq(currentTest.bookmarks.indexOf(aURI.spec), -1);
--- a/toolkit/components/places/tests/favicons/head_favicons.js
+++ b/toolkit/components/places/tests/favicons/head_favicons.js
@@ -7,16 +7,17 @@ var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
 
 
--- a/toolkit/components/places/tests/history/head_history.js
+++ b/toolkit/components/places/tests/history/head_history.js
@@ -8,12 +8,13 @@ var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
--- a/toolkit/components/places/tests/migration/head_migration.js
+++ b/toolkit/components/places/tests/migration/head_migration.js
@@ -4,16 +4,17 @@
 "use strict"
 
 var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
 
 const DB_FILENAME = "places.sqlite";
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -8,16 +8,17 @@ var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
 
 
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -9,16 +9,17 @@ var Cu = Components.utils;
 
 const FRECENCY_DEFAULT = 10000;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://testing-common/httpd.js");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
 
 const TITLE_SEARCH_ENGINE_SEPARATOR = " \u00B7\u2013\u00B7 ";
--- a/toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
@@ -148,24 +148,24 @@ add_task(function* test_complete_fragmen
     completed: "http://smokey.mozilla.org/foo?bacon=delicious#bar",
   });
   yield cleanup();
 });
 
 add_task(function* test_autocomplete_enabled_pref() {
   Services.prefs.setBoolPref(PREF_AUTOCOMPLETE_ENABLED, false);
   let types = ["history", "bookmark", "openpage"];
-  for (type of types) {
+  for (let type of types) {
     do_check_eq(Services.prefs.getBoolPref("browser.urlbar.suggest." + type), false,
                 "suggest." + type + "pref should be false");
   }
   Services.prefs.setBoolPref(PREF_AUTOCOMPLETE_ENABLED, true);
-  for (type of types) {
+  for (let type of types) {
     do_check_eq(Services.prefs.getBoolPref("browser.urlbar.suggest." + type), true,
                 "suggest." + type + "pref should be true");
   }
 
   // Clear prefs.
   Services.prefs.clearUserPref(PREF_AUTOCOMPLETE_ENABLED);
-  for (type of types) {
+  for (let type of types) {
     Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
   }
 });
--- a/toolkit/components/places/tests/unifiedcomplete/test_search_engine_current.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_search_engine_current.js
@@ -27,17 +27,17 @@ add_task(function*() {
     search: "mozzarella cheese",
     searchParam: "enable-actions",
     matches: [ makeSearchMatch("mozzarella cheese", { heuristic: true }) ]
   });
 
   do_print("search engine, after current engine has changed");
   Services.search.addEngineWithDetails("MozSearch2", "", "", "", "GET",
                                        "http://s.example.com/search2");
-  engine = Services.search.getEngineByName("MozSearch2");
+  let engine = Services.search.getEngineByName("MozSearch2");
   notEqual(Services.search.currentEngine, engine, "New engine shouldn't be the current engine yet");
   Services.search.currentEngine = engine;
   yield check_autocomplete({
     search: "mozilla",
     searchParam: "enable-actions",
     matches: [ makeSearchMatch("mozilla", { engineName: "MozSearch2", heuristic: true }) ]
   });
 
--- a/toolkit/components/places/tests/unit/head_bookmarks.js
+++ b/toolkit/components/places/tests/unit/head_bookmarks.js
@@ -7,14 +7,15 @@ var Ci = Components.interfaces;
 var Cc = Components.classes;
 var Cr = Components.results;
 var Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 // Import common head.
 {
+  /* import-globals-from ../head_common.js */
   let commonFile = do_get_file("../head_common.js", false);
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
--- a/toolkit/components/places/tests/unit/test_415757.js
+++ b/toolkit/components/places/tests/unit/test_415757.js
@@ -81,17 +81,17 @@ add_task(function* test_execute()
   for (let i = 0; i < TOTAL_SITES; i++) {
     let site = "http://www.test-" + i + ".com/";
     let testURI = uri(site);
     do_check_true(uri_in_db(testURI));
   }
 
   // check that annotation on the removed item does not exists
   try {
-    PlacesUtils.annotations.getPageAnnotation(testAnnoDeletedURI, testAnnoName);
+    PlacesUtils.annotations.getPageAnnotation(testAnnoDeletedURI, testAnnoDeletedName);
     do_throw("fetching page-annotation that doesn't exist, should've thrown");
   } catch (ex) {}
 
   // check that annotation on the NOT removed item still exists
   try {
     var annoVal = PlacesUtils.annotations.getPageAnnotation(testAnnoRetainedURI,
                                                             testAnnoRetainedName);
   } catch (ex) {
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -1466,17 +1466,17 @@ add_task(function* test_livemark_txns() 
   // Cleanup
   observer.reset();
   yield PT.clearTransactionsHistory();
 });
 
 add_task(function* test_copy() {
   function* duplicate_and_test(aOriginalGuid) {
     let txn = PT.Copy({ guid: aOriginalGuid, newParentGuid: rootGuid });
-    yield duplicateGuid = yield txn.transact();
+    let duplicateGuid = yield txn.transact();
     let originalInfo = yield PlacesUtils.promiseBookmarksTree(aOriginalGuid);
     let duplicateInfo = yield PlacesUtils.promiseBookmarksTree(duplicateGuid);
     yield ensureEqualBookmarksTrees(originalInfo, duplicateInfo, false);
 
     function* redo() {
       yield PT.redo();
       yield ensureBookmarksTreeRestoredCorrectly(originalInfo);
       yield PT.redo();
--- a/toolkit/components/places/tests/unit/test_bookmarks_html.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_html.js
@@ -299,17 +299,17 @@ function* testImportedBookmarks()
   }
 }
 
 function* checkItem(aExpected, aNode)
 {
   let id = aNode.itemId;
 
   return Task.spawn(function* () {
-    for (prop in aExpected) {
+    for (let prop in aExpected) {
       switch (prop) {
         case "type":
           do_check_eq(aNode.type, aExpected.type);
           break;
         case "title":
           do_check_eq(aNode.title, aExpected.title);
           break;
         case "description":
--- a/toolkit/components/places/tests/unit/test_bookmarks_json.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_json.js
@@ -153,17 +153,17 @@ function* testImportedBookmarks() {
     root.containerOpen = false;
   }
 }
 
 function* checkItem(aExpected, aNode) {
   let id = aNode.itemId;
 
   return Task.spawn(function* () {
-    for (prop in aExpected) {
+    for (let prop in aExpected) {
       switch (prop) {
         case "type":
           do_check_eq(aNode.type, aExpected.type);
           break;
         case "title":
           do_check_eq(aNode.title, aExpected.title);
           break;
         case "description":
--- a/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js
+++ b/toolkit/components/places/tests/unit/test_bookmarks_restore_notification.js
@@ -111,17 +111,17 @@ function* checkObservers(expectPromises,
 
   let [resultSubject, resultData] = yield promiseResult;
   Assert.equal(resultData, expectedData.data,
     "Data for current test should be what is expected");
 
   // Make sure folder ID is what is expected.  For importing HTML into a
   // folder, this will be an integer, otherwise null.
   if (resultSubject) {
-    Assert.equal(aSubject.QueryInterface(Ci.nsISupportsPRInt64).data,
+    Assert.equal(resultSubject.QueryInterface(Ci.nsISupportsPRInt64).data,
                 expectedData.folderId);
   } else {
     Assert.equal(expectedData.folderId, null);
   }
 }
 
 /**
  * Run after every test cases.
--- a/toolkit/components/places/tests/unit/test_history_clear.js
+++ b/toolkit/components/places/tests/unit/test_history_clear.js
@@ -101,17 +101,17 @@ add_task(function* test_history_clear()
   // check browserHistory returns no entries
   do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
 
   yield promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
   yield PlacesTestUtils.promiseAsyncUpdates();
 
   // Check that frecency for not cleared items (bookmarks) has been converted
   // to -1.
-  stmt = mDBConn.createStatement(
+  let stmt = mDBConn.createStatement(
     "SELECT h.id FROM moz_places h WHERE h.frecency > 0 ");
   do_check_false(stmt.executeStep());
   stmt.finalize();
 
   stmt = mDBConn.createStatement(
     `SELECT h.id FROM moz_places h WHERE h.frecency < 0
        AND EXISTS (SELECT id FROM moz_bookmarks WHERE fk = h.id) LIMIT 1`);
   do_check_true(stmt.executeStep());
--- a/toolkit/components/places/tests/unit/test_preventive_maintenance.js
+++ b/toolkit/components/places/tests/unit/test_preventive_maintenance.js
@@ -829,17 +829,17 @@ tests.push({
 
   _placeId: null,
   _invalidPlaceId: 1337,
 
   setup: function() {
     // Add a place to ensure place_id = 1 is valid
     this._placeId = addPlace();
     // Add a valid visit and an invalid one
-    stmt = mDBConn.createStatement("INSERT INTO moz_historyvisits(place_id) VALUES (:place_id)");
+    let stmt = mDBConn.createStatement("INSERT INTO moz_historyvisits(place_id) VALUES (:place_id)");
     stmt.params["place_id"] = this._placeId;
     stmt.execute();
     stmt.reset();
     stmt.params["place_id"] = this._invalidPlaceId;
     stmt.execute();
     stmt.finalize();
   },
 
@@ -955,17 +955,17 @@ tests.push({
   _placeId: null,
 
   setup: function() {
     // Add a place to ensure place_id = 1 is valid
     this._placeId = addPlace();
     // Insert a bookmark
     this._bookmarkId = addBookmark(this._placeId);
     // Add a used attribute.
-    stmt = mDBConn.createStatement("INSERT INTO moz_anno_attributes (name) VALUES (:anno)");
+    let stmt = mDBConn.createStatement("INSERT INTO moz_anno_attributes (name) VALUES (:anno)");
     stmt.params['anno'] = this._usedItemAttribute;
     stmt.execute();
     stmt.finalize();
     stmt = mDBConn.createStatement("INSERT INTO moz_items_annos (item_id, anno_attribute_id) VALUES (:item_id, (SELECT id FROM moz_anno_attributes WHERE name = :anno))");
     stmt.params["item_id"] = this._bookmarkId;
     stmt.params["anno"] = this._usedItemAttribute;
     stmt.execute();
     stmt.reset();
--- a/toolkit/components/places/tests/unit/test_sync_utils.js
+++ b/toolkit/components/places/tests/unit/test_sync_utils.js
@@ -252,21 +252,21 @@ add_task(function* test_dedupe() {
   });
   let tbBmk = yield PlacesSyncUtils.bookmarks.insert({
     kind: "bookmark",
     syncId: makeGuid(),
     parentSyncId: parentFolder.syncId,
     url: "http://getthunderbird.com",
   });
 
-  yield rejects(
+  yield Assert.rejects(
     PlacesSyncUtils.bookmarks.dedupe(makeGuid(), makeGuid(), makeGuid()),
     "Should reject attempts to de-dupe nonexistent items"
   );
-  yield rejects(PlacesSyncUtils.bookmarks.dedupe("menu", makeGuid(), "places"),
+  yield Assert.rejects(PlacesSyncUtils.bookmarks.dedupe("menu", makeGuid(), "places"),
     "Should reject attempts to de-dupe local roots");
 
   do_print("De-dupe with same remote parent");
   {
     let localId = yield PlacesUtils.promiseItemId(mozBmk.syncId);
     let newRemoteSyncId = makeGuid();
 
     let changes = yield PlacesSyncUtils.bookmarks.dedupe(
@@ -277,17 +277,17 @@ add_task(function* test_dedupe() {
     ].sort(), "Should bump change counter of parent");
     ok(changes[mozBmk.syncId].tombstone,
       "Should write tombstone for old local sync ID");
     ok(Object.values(changes).every(change => change.counter === 1),
       "Change counter for every bookmark should be 1");
 
     ok(!(yield PlacesUtils.bookmarks.fetch(mozBmk.syncId)),
       "Bookmark with old local sync ID should not exist");
-    yield rejects(PlacesUtils.promiseItemId(mozBmk.syncId),
+    yield Assert.rejects(PlacesUtils.promiseItemId(mozBmk.syncId),
       "Should invalidate GUID cache entry for old local sync ID");
 
     let newMozBmk = yield PlacesUtils.bookmarks.fetch(newRemoteSyncId);
     equal(newMozBmk.guid, newRemoteSyncId,
       "Should change local sync ID to remote sync ID");
     equal(yield PlacesUtils.promiseItemId(newRemoteSyncId), localId,
       "Should add new remote sync ID to GUID cache");
 
@@ -696,17 +696,17 @@ add_task(function* test_update_move_root
     });
     equal(sameRoot.syncId, "menu",
       "Menu root GUID should not change");
     equal(sameRoot.parentSyncId, "places",
       "Parent Places root GUID should not change");
   }
 
   do_print("Try reparenting root");
-  yield rejects(PlacesSyncUtils.bookmarks.update({
+  yield Assert.rejects(PlacesSyncUtils.bookmarks.update({
     syncId: "menu",
     parentSyncId: "toolbar",
   }));
 
   yield PlacesUtils.bookmarks.eraseEverything();
   yield PlacesSyncUtils.bookmarks.reset();
 });
 
@@ -866,17 +866,17 @@ add_task(function* test_update_livemark(
       let livemark = yield PlacesUtils.livemarks.addLivemark({
         parentGuid: PlacesUtils.bookmarks.menuGuid,
         feedURI,
         index: PlacesUtils.bookmarks.DEFAULT_INDEX,
       });
 
       // Since we're reinserting, we need to pass all properties required
       // for a new livemark. `update` won't merge the old and new ones.
-      yield rejects(PlacesSyncUtils.bookmarks.update({
+      yield Assert.rejects(PlacesSyncUtils.bookmarks.update({
         syncId: livemark.guid,
         feed: site + "/feed/2",
       }), "Reinserting livemark with changed feed URL requires full record");
 
       let newLivemark = yield PlacesSyncUtils.bookmarks.update({
         kind: "livemark",
         parentSyncId: "menu",
         syncId: livemark.guid,
@@ -892,17 +892,17 @@ add_task(function* test_update_livemark(
     {
       let livemark = yield PlacesUtils.livemarks.addLivemark({
         parentGuid: PlacesUtils.bookmarks.menuGuid,
         feedURI,
       });
       ok(livemark.feedURI.equals(feedURI), "Livemark feed URI should match");
       ok(!livemark.siteURI, "Livemark should not have site URI");
 
-      yield rejects(PlacesSyncUtils.bookmarks.update({
+      yield Assert.rejects(PlacesSyncUtils.bookmarks.update({
         syncId: livemark.guid,
         site,
       }), "Reinserting livemark with new site URL requires full record");
 
       let newLivemark = yield PlacesSyncUtils.bookmarks.update({
         kind: "livemark",
         parentSyncId: "menu",
         syncId: livemark.guid,
@@ -923,17 +923,17 @@ add_task(function* test_update_livemark(
     {
       let livemark = yield PlacesUtils.livemarks.addLivemark({
         parentGuid: PlacesUtils.bookmarks.menuGuid,
         feedURI,
         siteURI: uri(site),
         index: PlacesUtils.bookmarks.DEFAULT_INDEX,
       });
 
-      yield rejects(PlacesSyncUtils.bookmarks.update({
+      yield Assert.rejects(PlacesSyncUtils.bookmarks.update({
         syncId: livemark.guid,
         site: null,
       }), "Reinserting livemark witout site URL requires full record");
 
       let newLivemark = yield PlacesSyncUtils.bookmarks.update({
         kind: "livemark",
         parentSyncId: "menu",
         syncId: livemark.guid,
@@ -951,17 +951,17 @@ add_task(function* test_update_livemark(
     {
       let livemark = yield PlacesUtils.livemarks.addLivemark({
         parentGuid: PlacesUtils.bookmarks.menuGuid,
         feedURI,
         siteURI: uri(site),
         index: PlacesUtils.bookmarks.DEFAULT_INDEX,
       });
 
-      yield rejects(PlacesSyncUtils.bookmarks.update({
+      yield Assert.rejects(PlacesSyncUtils.bookmarks.update({
         syncId: livemark.guid,
         site: site + "/new",
       }), "Reinserting livemark with changed site URL requires full record");
 
       let newLivemark = yield PlacesSyncUtils.bookmarks.update({
         kind: "livemark",
         parentSyncId: "menu",
         syncId: livemark.guid,
--- a/toolkit/components/printing/content/printPreviewBindings.xml
+++ b/toolkit/components/printing/content/printPreviewBindings.xml
@@ -10,17 +10,17 @@
 <!ENTITY % printPreviewDTD SYSTEM "chrome://global/locale/printPreview.dtd" >
 %printPreviewDTD;
 ]>
 
 <bindings id="printPreviewBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
 
-  <binding id="printpreviewtoolbar" 
+  <binding id="printpreviewtoolbar"
            extends="chrome://global/content/bindings/toolbar.xml#toolbar">
     <resources>
       <stylesheet src="chrome://global/skin/printPreview.css"/>
     </resources>
 
     <content>
       <xul:button label="&print.label;" accesskey="&print.accesskey;"
         oncommand="this.parentNode.print();" icon="print"/>
@@ -47,46 +47,46 @@
         oncommand="parentNode.navigate(0, 0, 'end');" tooltiptext="&endarrow.tooltip;"/>
 
       <xul:toolbarseparator class="toolbarseparator-primary"/>
       <xul:vbox align="center" pack="center">
         <xul:label value="&scale.label;" accesskey="&scale.accesskey;" control="scale"/>
       </xul:vbox>
 
       <xul:hbox align="center" pack="center">
-        <xul:menulist id="scale" crop="none" 
+        <xul:menulist id="scale" crop="none"
           oncommand="parentNode.parentNode.scale(this.selectedItem.value);">
           <xul:menupopup>
             <xul:menuitem value="0.3" label="&p30.label;"/>
             <xul:menuitem value="0.4" label="&p40.label;"/>
             <xul:menuitem value="0.5" label="&p50.label;"/>
             <xul:menuitem value="0.6" label="&p60.label;"/>
             <xul:menuitem value="0.7" label="&p70.label;"/>
             <xul:menuitem value="0.8" label="&p80.label;"/>
             <xul:menuitem value="0.9" label="&p90.label;"/>
             <xul:menuitem value="1" label="&p100.label;"/>
             <xul:menuitem value="1.25" label="&p125.label;"/>
             <xul:menuitem value="1.5" label="&p150.label;"/>
             <xul:menuitem value="1.75" label="&p175.label;"/>
             <xul:menuitem value="2" label="&p200.label;"/>
             <xul:menuseparator/>
-            <xul:menuitem flex="1" value="ShrinkToFit" 
+            <xul:menuitem flex="1" value="ShrinkToFit"
               label="&ShrinkToFit.label;"/>
             <xul:menuitem value="Custom" label="&Custom.label;"/>
           </xul:menupopup>
         </xul:menulist>
       </xul:hbox>
 
       <xul:toolbarseparator class="toolbarseparator-primary"/>
       <xul:hbox align="center" pack="center">
         <xul:toolbarbutton label="&portrait.label;" checked="true"
           accesskey="&portrait.accesskey;"
           type="radio" group="orient" class="toolbar-portrait-page tabbable"
           oncommand="parentNode.parentNode.orient('portrait');"/>
-        <xul:toolbarbutton label="&landscape.label;" 
+        <xul:toolbarbutton label="&landscape.label;"
           accesskey="&landscape.accesskey;"
           type="radio" group="orient" class="toolbar-landscape-page tabbable"
           oncommand="parentNode.parentNode.orient('landscape');"/>
       </xul:hbox>
 
       <xul:toolbarseparator class="toolbarseparator-primary"/>
       <xul:checkbox label="&simplifyPage.label;" checked="false" disabled="true"
         accesskey="&simplifyPage.accesskey;"
@@ -167,16 +167,17 @@
           $("navigateEnd").label = ltr ? "⏭" : "⏮";
         ]]>
         </body>
       </method>
 
       <method name="doPageSetup">
         <body>
         <![CDATA[
+          /* import-globals-from printUtils.js */
           var didOK = PrintUtils.showPageSetup();
           if (didOK) {
             // the changes that effect the UI
             this.updateToolbar();
 
             // Now do PrintPreview
             PrintUtils.printPreview();
           }
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -342,17 +342,17 @@ var PrintUtils = {
       "NOT_AVAILABLE",
       "NOT_IMPLEMENTED",
       "OUT_OF_MEMORY",
       "UNEXPECTED",
     ];
 
     // PERR_FAILURE is the catch-all error message if we've gotten one that
     // we don't recognize.
-    msgName = "PERR_FAILURE";
+    let msgName = "PERR_FAILURE";
 
     for (let code of MSG_CODES) {
       let nsErrorResult = "NS_ERROR_" + code;
       if (Components.results[nsErrorResult] == nsresult) {
         msgName = "PERR_" + code;
         break;
       }
     }
--- a/toolkit/components/printing/content/printdialog.js
+++ b/toolkit/components/printing/content/printdialog.js
@@ -123,17 +123,17 @@ listElement.prototype =
             dialog.propertiesButton.setAttribute("disabled", "true");
             dialog.fileCheck.setAttribute("disabled", "true");
             dialog.printButton.setAttribute("disabled", "true");
           }
           else {
             // build popup menu from printer names
             var list = document.getElementById("printerList");
             do {
-              printerNameStr = aDataObject.getNext();
+              let printerNameStr = aDataObject.getNext();
               list.appendItem(printerNameStr, printerNameStr, getPrinterDescription(printerNameStr));
             } while (aDataObject.hasMore());
             this.listElement.removeAttribute("disabled");
           }
         }
   };
 
 // ---------------------------------------------------
@@ -417,9 +417,8 @@ function chooseFile()
       return true;
     }
   } catch (ex) {
     dump(ex);
   }
 
   return false;
 }
-
--- a/toolkit/components/prompts/test/test_bug619644.html
+++ b/toolkit/components/prompts/test/test_bug619644.html
@@ -10,16 +10,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
   <script type="text/javascript" src="prompt_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=619644">Mozilla Bug 619644</a>
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from prompt_common.js */
 // This is a little yucky, but it works
 // The contents of bug619644_inner.html
 const expectedFinalDoc =
 "<head><\/head><body><p>Original content<\/p>\n<script>\n    window.opener.postMessage(\"\", \"*\");\n    confirm(\"Message\");\n    document.write(\"Extra content\");\n    window.opener.postMessage(document.documentElement.innerHTML, \"*\");\n<\/script>Extra content<\/body>";
 
 if (!isTabModal) {
   todo(false, "Test disabled when tab modal prompts are not enabled.");
 } else {
--- a/toolkit/components/prompts/test/test_bug620145.html
+++ b/toolkit/components/prompts/test/test_bug620145.html
@@ -19,16 +19,18 @@
 </div>
 <div id="text2" style="max-width: 100px">
   This is another short piece of text used for testing that mouse selecting is
   stopped when an alert appears.
 </div>
 <button id="button" onmouseup="openAlert()">Button</button>
 
 <script class="testbody" type="text/javascript">
+/* import-globals-from ../../../../testing/mochitest/tests/SimpleTest/EventUtils.js */
+/* import-globals-from prompt_common.js */
 var selectionTest = false;
 
 function openAlert() {
   info("opening alert...");
   alert("hello!");
   info("...alert done.");
 }
 
@@ -52,17 +54,17 @@ add_task(function* runTest() {
     checked     : false,
     focused     : "button0",
     defButton   : "button0",
   };
   action = {
     buttonClick: "ok",
   };
 
-  promptDone = handlePrompt(state, action);
+  let promptDone = handlePrompt(state, action);
 
   var button = $("button");
   dispatchMouseEvent(button, "mousedown");
   dispatchMouseEvent(button, "mouseup");
   // alert appears at this point, to be closed by the chrome script.
 
   yield promptDone;
   checkSelection();
@@ -77,17 +79,17 @@ add_task(function* runTest() {
 
   yield promptDone;
   checkSelection();
 });
 
 function dispatchMouseEvent(target, type)
 {
   var win = target.ownerDocument.defaultView;
-  e = document.createEvent("MouseEvent");
+  let e = document.createEvent("MouseEvent");
   e.initEvent(type, false, false, win, 0, 1, 1, 1, 1,
               false, false, false, false, 0, null);
   var utils = SpecialPowers.getDOMWindowUtils(win);
   utils.dispatchDOMEventViaPresShell(target, e, true);
   ok(true, type + " sent to " + target.id);
 }
 
 function checkSelection()
--- a/toolkit/components/prompts/test/test_dom_prompts.html
+++ b/toolkit/components/prompts/test/test_dom_prompts.html
@@ -8,16 +8,17 @@
   <script type="text/javascript" src="prompt_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <pre id="test">
 </pre>
 
 <script class="testbody" type="text/javascript">
+/* import-globals-from prompt_common.js */
 var rv;
 var state, action;
 
 add_task(function* test_alert_ok() {
     info("Starting test: Alert");
     state = {
         msg         : "This is the alert text.",
         iconClass   : "alert-icon",
@@ -31,17 +32,17 @@ add_task(function* test_alert_ok() {
         checked     : false,
         focused     : "button0",
         defButton   : "button0",
     };
     action = {
         buttonClick: "ok",
     };
 
-    promptDone = handlePrompt(state, action);
+    let promptDone = handlePrompt(state, action);
 
     alert("This is the alert text.");
 
     yield promptDone;
 });
 
 // bug 861605 made the arguments to alert/confirm optional (prompt already was).
 add_task(function* test_alert_noargs() {
@@ -59,17 +60,17 @@ add_task(function* test_alert_noargs() {
         checked     : false,
         focused     : "button0",
         defButton   : "button0",
     };
     action = {
         buttonClick: "ok",
     };
 
-    promptDone = handlePrompt(state, action);
+    let promptDone = handlePrompt(state, action);
 
     try {
         alert();
         ok(true, "alert() without arguments should not throw!");
     } catch (e) {
         ok(false, "alert() without arguments should not throw!");
     }
 
@@ -92,17 +93,17 @@ add_task(function* test_confirm_ok() {
         checked     : false,
         focused     : "button0",
         defButton   : "button0",
     };
     action = {
         buttonClick: "ok",
     };
 
-    promptDone = handlePrompt(state, action);
+    let promptDone = handlePrompt(state, action);
 
     rv = confirm("This is the confirm text.");
     is(rv, true, "check prompt return value");
 
     yield promptDone;
 });
 
 // bug 861605 made the arguments to alert/confirm optional (prompt already was).
@@ -121,17 +122,17 @@ add_task(function* test_confirm_noargs()
         checked     : false,
         focused     : "button0",
         defButton   : "button0",
     };
     action = {
         buttonClick: "ok",
     };
 
-    promptDone = handlePrompt(state, action);
+    let promptDone = handlePrompt(state, action);
 
     try {
         rv = confirm();
         ok(true, "confirm() without arguments should not throw!");
     } catch (e) {
         ok(false, "confirm() without arguments should not throw!");
     }
     is(rv, true, "check prompt return value");
@@ -155,17 +156,17 @@ add_task(function* test_prompt_ok() {
         checked     : false,
         focused     : "textField",
         defButton   : "button0",
     };
     action = {
         buttonClick: "ok",
     };
 
-    promptDone = handlePrompt(state, action);
+    let promptDone = handlePrompt(state, action);
 
     rv = prompt("This is the Prompt text.");
     is(rv, "", "check prompt return value");
 
     yield promptDone;
 });
 
 // bug 861605 made the arguments to alert/confirm optional (prompt already was).
@@ -184,17 +185,17 @@ add_task(function* test_prompt_noargs() 
         checked     : false,
         focused     : "textField",
         defButton   : "button0",
     };
     action = {
         buttonClick: "ok",
     };
 
-    promptDone = handlePrompt(state, action);
+    let promptDone = handlePrompt(state, action);
 
     try {
         rv = prompt();
         ok(true, "prompt() without arguments should not throw!");
     } catch (e) {
         ok(false, "prompt() without arguments should not throw!");
     }
     is(rv, "", "check prompt return value");
--- a/toolkit/components/prompts/test/test_subresources_prompts.html
+++ b/toolkit/components/prompts/test/test_subresources_prompts.html
@@ -25,16 +25,17 @@
 
 <iframe id="iframe_same_origin" src="bug625187_iframe.html"></iframe>
 
 <iframe id="iframe_prompt"></iframe>
 
 <pre id="test"></pre>
 
 <script class="testbody" type="text/javascript">
+/* import-globals-from prompt_common.js */
 var iframe1Loaded = onloadPromiseFor("iframe_diff_origin");
 var iframe2Loaded = onloadPromiseFor("iframe_same_origin");
 var iframe_prompt = document.getElementById("iframe_prompt");
 
 add_task(function* runTest()
 {
   // This test depends on tab modal prompts being enabled.
   if (!isTabModal) {
@@ -61,17 +62,17 @@ add_task(function* runTest()
     checked     : false,
     focused     : "button0",
     defButton   : "button0",
   };
   action = {
     buttonClick: "ok",
   };
 
-  promptDone = handlePrompt(state, action);
+  let promptDone = handlePrompt(state, action);
 
   var button = document.querySelector("button");
   dispatchMouseEvent(button, "click");
 
   yield promptDone;
 
 
   // mostly reusing same state/action
@@ -111,16 +112,17 @@ add_task(function* runTest()
 add_task(function* runTestAuth()
 {
   // Following tests chack prompt message for a cross-origin and not
   // cross-origin subresources load
 
   // Force parent to not look for tab-modal prompts, as they're not
   // used for auth prompts.
   isTabModal = false;
+  let state, action;
 
   state = {
     msg         : "http://mochi.test:8888 is requesting your username " +
                   "and password. The site says: “mochitest”",
     title       : "Authentication Required",
     textValue   : "",
     passValue   : "",
     iconClass   : "authentication-icon question-icon",
@@ -136,17 +138,17 @@ add_task(function* runTestAuth()
 
   action = {
     buttonClick : "ok",
     setCheckbox : false,
     textField   : "mochiuser1",
     passField   : "mochipass1",
   };
 
-  promptDone = handlePrompt(state, action);
+  let promptDone = handlePrompt(state, action);
 
   var iframe3Loaded = onloadPromiseFor("iframe_prompt");
   iframe_prompt.src = "authenticate.sjs?user=mochiuser1&pass=mochipass1";
   yield promptDone;
   yield iframe3Loaded;
   checkEchoedAuthInfo({user: "mochiuser1", pass: "mochipass1"},
                       iframe_prompt.contentDocument);
 
new file mode 100644
--- /dev/null
+++ b/toolkit/components/reader/test/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../testing/mochitest/browser.eslintrc.js"
+  ]
+};
--- a/toolkit/components/satchel/test/browser/browser_privbrowsing_perwindowpb.js
+++ b/toolkit/components/satchel/test/browser/browser_privbrowsing_perwindowpb.js
@@ -23,17 +23,17 @@ add_task(function* test() {
     let doneCounting = {};
     doneCounting.promise = new Promise(resolve => doneCounting.resolve = resolve);
     FormHistory.count({ fieldname: "field", value: "value" },
                       {
                         handleResult(result) {
                           count = result;
                         },
                         handleError(error) {
-                          do_throw("Error occurred searching form history: " + error);
+                          Assert.ok(false, "Error occurred searching form history: " + error);
                         },
                         handleCompletion(num) {
                           if (aShouldValueExist) {
                             is(count, 1, "In non-PB mode, we add a single entry");
                           } else {
                             is(count, 0, "In PB mode, we don't add any entries");
                           }
 
--- a/toolkit/components/satchel/test/satchel_common.js
+++ b/toolkit/components/satchel/test/satchel_common.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 ../../../../testing/mochitest/tests/SimpleTest/SimpleTest.js */
+
 var gPopupShownExpected = false;
 var gPopupShownListener;
 var gLastAutoCompleteResults;
 var gChromeScript;
 
 /*
  * Returns the element with the specified |name| attribute.
  */
--- a/toolkit/components/satchel/test/test_bug_511615.html
+++ b/toolkit/components/satchel/test/test_bug_511615.html
@@ -18,16 +18,17 @@ Test for Form History Autocomplete Untru
   <form id="form1" onsubmit="return false;">
     <input  type="text" name="field1">
     <button type="submit">Submit</button>
   </form>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from satchel_common.js */
 
 var resolvePopupShownListener;
 registerPopupShownListener(() => resolvePopupShownListener());
 
 function waitForNextPopup() {
   return new Promise(resolve => { resolvePopupShownListener = resolve; });
 }
 
@@ -69,17 +70,17 @@ function checkSelectedIndexAfterResponse
   }).then(popupState => {
     is(popupState.open, true, "Popup should still be open.");
     is(popupState.selectedIndex, expectedIndex, "Selected index should match.");
   });
 }
 
 function doKeyUnprivileged(key) {
   let keyName = "DOM_VK_" + key.toUpperCase();
-  let keycode, charcode;
+  let keycode, charcode, alwaysval;
 
   if (key.length == 1) {
       keycode = 0;
       charcode = key.charCodeAt(0);
       alwaysval = charcode;
   } else {
       keycode = KeyEvent[keyName];
       if (!keycode)
--- a/toolkit/components/satchel/test/test_bug_787624.html
+++ b/toolkit/components/satchel/test/test_bug_787624.html
@@ -45,16 +45,17 @@ Form History Layout test: form field aut
         <button type="submit">Submit</button>
       </form>
     </div>
   </div>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from satchel_common.js */
 
 /** Test for Form History autocomplete Layout: Bug 787624 **/
 
 var resolvePopupShownListener;
 registerPopupShownListener(() => resolvePopupShownListener());
 
 function waitForNextPopup() {
   return new Promise(resolve => { resolvePopupShownListener = resolve; });
--- a/toolkit/components/satchel/test/test_datalist_with_caching.html
+++ b/toolkit/components/satchel/test/test_datalist_with_caching.html
@@ -25,16 +25,19 @@ Form History test: form field autocomple
     <option value="First"></option>
     <option value="Second"></option>
     <option value="Secomundo"></option>
   </datalist>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from ../../../../testing/mochitest/tests/SimpleTest/EventUtils.js */
+/* import-globals-from ../../../../testing/mochitest/tests/SimpleTest/SpawnTask.js */
+/* import-globals-from satchel_common.js */
 
 var input = $_(1, "field1");
 
 function setupFormHistory(aCallback) {
   updateFormHistory([
     { op : "remove" },
     { op : "add", fieldname : "field1", value : "Sec" },
   ], () => {
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -134,16 +134,18 @@ Form History test: form field autocomple
     <input  type="datetime-local" name="field17">
     <button type="submit">Submit</button>
   </form>
 
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from ../../../../testing/mochitest/tests/SimpleTest/EventUtils.js */
+/* import-globals-from satchel_common.js */
 
 /** Test for Form History autocomplete **/
 
 var input = $_(1, "field1");
 const shiftModifier = Event.SHIFT_MASK;
 
 function setupFormHistory(aCallback) {
   updateFormHistory([
@@ -1066,9 +1068,8 @@ function startTest() {
 window.onload = startTest;
 
 SimpleTest.waitForExplicitFinish();
 SimpleTest.requestFlakyTimeout("untriaged");
 </script>
 </pre>
 </body>
 </html>
-
--- a/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
@@ -36,16 +36,18 @@ Form History test: form field autocomple
     <option value="Google" label="PASS1">FAIL</option>
     <option value="Reddit">PASS2</option>
     <option value="final"></option>
   </datalist>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from ../../../../testing/mochitest/tests/SimpleTest/EventUtils.js */
+/* import-globals-from satchel_common.js */
 
 /** Test for Form History autocomplete **/
 
 var input = $_(1, "field1");
 const shiftModifier = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
 
 function setupFormHistory(aCallback) {
   updateFormHistory([
--- a/toolkit/components/satchel/test/test_form_submission.html
+++ b/toolkit/components/satchel/test/test_form_submission.html
@@ -1,21 +1,21 @@
 <!DOCTYPE HTML>
 <html>
 <head>
   <title>Satchel Test for Form Submisstion</title>
-  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>  
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <script type="text/javascript" src="satchel_common.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 </head>
 <body>
 <p id="display"></p>
 <iframe id="iframe" src="https://example.com/tests/toolkit/components/satchel/test/subtst_form_submission_1.html"></iframe>
 <div id="content" style="display: none">
-  
+
   <!-- ===== Things that should not be saved. ===== -->
 
   <!-- autocomplete=off for input -->
   <form id="form1" onsubmit="return checkSubmit(1)">
     <input type="text" name="test1" autocomplete="off">
     <button type="submit">Submit</button>
   </form>
 
@@ -254,17 +254,17 @@
   <form id="form110" onsubmit="return checkSubmit(110)">
     <input type="text" name="test10">
     <button type="submit">Submit</button>
   </form>
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
-
+/* import-globals-from satchel_common.js */
 var numSubmittedForms = 0;
 
 var ccNumbers = {
   valid15: [
     "930771457288760", "474915027480942",
     "924894781317325", "714816113937185",
     "790466087343106", "474320195408363",
     "219211148122351", "633038472250799",
--- a/toolkit/components/satchel/test/test_form_submission_cap.html
+++ b/toolkit/components/satchel/test/test_form_submission_cap.html
@@ -12,16 +12,17 @@
 
   <form id="form1" onsubmit="return checkSubmit(1)">
     <button type="submit">Submit</button>
   </form>
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from satchel_common.js */
 
 /* Test for bug 492701.
    Save only the first MAX_FIELDS_SAVED changed fields in a form.
    Generate numInputFields = MAX_FIELDS_SAVED + 1 fields, change all values,
    and test that only MAX_FIELDS_SAVED are actually saved and that
    field # numInputFields was not saved.
 */
 
@@ -33,43 +34,43 @@ function checkInitialState() {
     function(num) {
       ok(!num, "checking for initially empty storage");
       startTest();
     });
 }
 
 function startTest() {
   var form = document.getElementById("form1");
-  for (i = 1; i <= numInputFields; i++) {
+  for (let i = 1; i <= numInputFields; i++) {
     var newField = document.createElement("input");
     newField.setAttribute("type", "text");
     newField.setAttribute("name", "test" + i);
     form.appendChild(newField);
   }
 
   // Fill in values for the various fields. We could just set the <input>'s
   // value attribute, but we don't save default form values (and we want to
   // ensure unsaved values are because of autocomplete=off or whatever).
-  for (i = 1; i <= numInputFields; i++) {
+  for (let i = 1; i <= numInputFields; i++) {
     $_(1, "test" + i).value = i;
   }
 
   // submit the first form.
   var button = getFormSubmitButton(1);
   button.click();
 }
 
 
 // Called by each form's onsubmit handler.
 function checkSubmit(formNum) {
   ok(true, "form " + formNum + " submitted");
   numSubmittedForms++;
 
   // check that the first (numInputFields - 1) CHANGED fields are saved
-  for (i = 1; i < numInputFields; i++) { // check all but last
+  for (let i = 1; i < numInputFields; i++) { // check all but last
     checkForSave("test" + i, i, "checking saved value " + i);
   }
 
   // End the test.
   is(numSubmittedForms, 1, "Ensuring all forms were submitted.");
   SimpleTest.finish();
   return false; // return false to cancel current form submission
 }
--- a/toolkit/components/satchel/test/test_form_submission_cap2.html
+++ b/toolkit/components/satchel/test/test_form_submission_cap2.html
@@ -117,16 +117,17 @@
     <input type="text" name="test100" value="100">
     <input type="text" name="test101" value="101">
     <button type="submit">Submit</button>
   </form>
 
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from satchel_common.js */
 
 var numSubmittedForms = 0;
 var numInputFields = 101;
 
 function checkInitialState() {
   countEntries(null, null,
     function(num) {
       ok(!num, "checking for initially empty storage");
--- a/toolkit/components/satchel/test/test_popup_direction.html
+++ b/toolkit/components/satchel/test/test_popup_direction.html
@@ -17,16 +17,17 @@ Test for Popup Direction
   <form id="form1" onsubmit="return false;">
     <input  type="text" name="field1">
     <button type="submit">Submit</button>
   </form>
 </div>
 
 <pre id="test">
 <script class="testbody" type="text/javascript">
+/* import-globals-from satchel_common.js */
 
 var resolvePopupShownListener;
 registerPopupShownListener(() => resolvePopupShownListener());
 
 function waitForNextPopup() {
   return new Promise(resolve => { resolvePopupShownListener = resolve; });
 }
 
--- a/toolkit/components/satchel/test/test_popup_enter_event.html
+++ b/toolkit/components/satchel/test/test_popup_enter_event.html
@@ -16,16 +16,18 @@ Form History test: Test for events while
   <form id="form1">
     <input  type="text" name="field1">
     <button type="submit">Submit</button>
   </form>
 </div>
 
 <pre id="test">
 <script class="testbody">
+/* import-globals-from satchel_common.js */
+
 var form = document.getElementById("form1");
 var input = $_(1, "field1");
 var expectedValue = "value1";
 
 function setupFormHistory(aCallback) {
   updateFormHistory([
     { op : "remove" },
     { op : "add", fieldname : "field1", value : "value1" },
--- a/toolkit/components/satchel/test/unit/test_db_update_v4b.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v4b.js
@@ -30,17 +30,17 @@ function* next_test()
   testfile.copyTo(profileDir, "formhistory.sqlite");
   do_check_eq(3, getDBVersion(testfile));
 
   // ===== 1 =====
   testnum++;
 
   destFile = profileDir.clone();
   destFile.append("formhistory.sqlite");
-  dbConnection = Services.storage.openUnsharedDatabase(destFile);
+  let dbConnection = Services.storage.openUnsharedDatabase(destFile);
 
   // check for upgraded schema.
   do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion);
 
   // Check that the index was added
   do_check_true(dbConnection.tableExists("moz_deleted_formhistory"));
   dbConnection.close();
 
--- a/toolkit/components/satchel/test/unit/test_history_api.js
+++ b/toolkit/components/satchel/test/unit/test_history_api.js
@@ -11,17 +11,17 @@ function countDeletedEntries(expected)
 {
   let deferred = Promise.defer();
   let stmt = dbConnection.createAsyncStatement("SELECT COUNT(*) AS numEntries FROM moz_deleted_formhistory");
   stmt.executeAsync({
     handleResult: function(resultSet) {
       do_check_eq(expected, resultSet.getNextRow().getResultByName("numEntries"));
       deferred.resolve();
     },
-    handleError : function() {
+    handleError : function(error) {
       do_throw("Error occurred counting deleted entries: " + error);
       deferred.reject();
     },
     handleCompletion : function() {
       stmt.finalize();
     }
   });
   return deferred.promise;
@@ -32,17 +32,17 @@ function checkTimeDeleted(guid, checkFun
   let deferred = Promise.defer();
   let stmt = dbConnection.createAsyncStatement("SELECT timeDeleted FROM moz_deleted_formhistory WHERE guid = :guid");
   stmt.params.guid = guid;
   stmt.executeAsync({
     handleResult: function(resultSet) {
       checkFunction(resultSet.getNextRow().getResultByName("timeDeleted"));
       deferred.resolve();
     },
-    handleError : function() {
+    handleError : function(error) {
       do_throw("Error occurred getting deleted entries: " + error);
       deferred.reject();
     },
     handleCompletion : function() {
       stmt.finalize();
     }
   });
   return deferred.promise;
@@ -138,17 +138,17 @@ add_task(function* ()
   dbFile.append("formhistory.sqlite");
   dbConnection = Services.storage.openUnsharedDatabase(dbFile);
 
   let deferred = Promise.defer();
 
   let stmt = dbConnection.createAsyncStatement("DELETE FROM moz_deleted_formhistory");
   stmt.executeAsync({
     handleResult: function(resultSet) { },
-    handleError : function() {
+    handleError : function(error) {
       do_throw("Error occurred counting deleted all entries: " + error);
     },
     handleCompletion : function() {
       stmt.finalize();
       deferred.resolve();
     }
   });
   yield deferred.promise;
@@ -263,18 +263,18 @@ add_task(function* ()
     // Only handle the first result
     if (results.length > 0) {
       let result = results[0];
       return [result.timesUsed, result.firstUsed, result.lastUsed, result.guid];
     }
     return undefined;
   }
 
-  results = yield promiseSearchEntries(["timesUsed", "firstUsed", "lastUsed"],
-                                       { fieldname: "field1", value: "value1" });
+  let results = yield promiseSearchEntries(["timesUsed", "firstUsed", "lastUsed"],
+                                           { fieldname: "field1", value: "value1" });
   let [timesUsed, firstUsed, lastUsed] = processFirstResult(results);
   do_check_eq(1, timesUsed);
   do_check_true(firstUsed > 0);
   do_check_true(lastUsed > 0);
   yield promiseCountEntries(null, null, num => do_check_eq(num, 1));
 
   // ===== 11 =====
   // Add another single entry
--- a/toolkit/components/search/tests/xpcshell/test_json_cache.js
+++ b/toolkit/components/search/tests/xpcshell/test_json_cache.js
@@ -10,17 +10,17 @@
 /**
  * Gets a directory from the directory service.
  * @param aKey
  *        The directory service key indicating the directory to get.
  */
 var _dirSvc = null;
 function getDir(aKey, aIFace) {
   if (!aKey) {
-    FAIL("getDir requires a directory key!");
+    do_throw("getDir requires a directory key!");
   }
 
   if (!_dirSvc) {
     _dirSvc = Cc["@mozilla.org/file/directory_service;1"].
                getService(Ci.nsIProperties);
   }
   return _dirSvc.get(aKey, aIFace || Ci.nsIFile);
 }
--- a/toolkit/components/startup/tests/unit/head_startup.js
+++ b/toolkit/components/startup/tests/unit/head_startup.js
@@ -19,12 +19,14 @@ function createAppInfo(ID, name, version
 
   let XULAppInfoFactory = {
     createInstance: function(outer, iid) {
       if (outer != null)
         throw Components.results.NS_ERROR_NO_AGGREGATION;
       return gAppInfo.QueryInterface(iid);
     }
   };
-  let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
+
+  let registrar =
+    Components.manager.QueryInterface(Components.interfaces.nsIComponentRegistrar);
   registrar.registerFactory(XULRUNTIME_CID, "XULRuntime",
                             XULRUNTIME_CONTRACTID, XULAppInfoFactory);
 }
--- a/toolkit/components/telemetry/datareporting-prefs.js
+++ b/toolkit/components/telemetry/datareporting-prefs.js
@@ -1,11 +1,13 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+/* global pref */
+
 pref("datareporting.policy.dataSubmissionEnabled", true);
 pref("datareporting.policy.dataSubmissionPolicyNotifiedTime", "0");
 pref("datareporting.policy.dataSubmissionPolicyAcceptedVersion", 0);
 pref("datareporting.policy.dataSubmissionPolicyBypassNotification", false);
 pref("datareporting.policy.currentPolicyVersion", 2);
 pref("datareporting.policy.minimumPolicyVersion", 1);
 pref("datareporting.policy.minimumPolicyVersion.channel-beta", 2);
--- a/toolkit/components/telemetry/healthreport-prefs.js
+++ b/toolkit/components/telemetry/healthreport-prefs.js
@@ -1,10 +1,12 @@
 /* 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/. */
 
+/* global pref */
+
 pref("datareporting.healthreport.infoURL", "https://www.mozilla.org/legal/privacy/firefox.html#health-report");
 
 // Health Report is enabled by default on all channels.
 pref("datareporting.healthreport.uploadEnabled", true);
 
 pref("datareporting.healthreport.about.reportUrl", "https://fhr.cdn.mozilla.net/%LOCALE%/v4/");
new file mode 100644
--- /dev/null
+++ b/toolkit/components/telemetry/tests/browser/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../../testing/mochitest/browser.eslintrc.js"
+  ]
+};
--- a/toolkit/components/telemetry/tests/browser/browser_TelemetryGC.js
+++ b/toolkit/components/telemetry/tests/browser/browser_TelemetryGC.js
@@ -107,16 +107,18 @@ add_task(function* test() {
 
   // Set these prefs to ensure that we get measurements.
   yield SpecialPowers.pushPrefEnv({"set": [["javascript.options.mem.notify", true]]});
 
   function runRemote(f) {
     gBrowser.selectedBrowser.messageManager.loadFrameScript(`data:,(${f})()`, false);
   }
 
+  // These are available to frame scripts.
+  /* global addMessageListener:false, removeMessageListener: false */
   function initScript() {
     const {GCTelemetry} = Components.utils.import("resource://gre/modules/GCTelemetry.jsm", {});
 
     /*
      * Don't shut down GC telemetry if it was already running before the test!
      * Note: We need to use a multiline comment here since this code is turned into a data: URI.
      */
     let shutdown = GCTelemetry.init();
--- a/toolkit/components/telemetry/tests/unit/head.js
+++ b/toolkit/components/telemetry/tests/unit/head.js
@@ -189,16 +189,20 @@ function createAppInfo(ID = "xpcshell@te
 
 // Fake the timeout functions for the TelemetryScheduler.
 function fakeSchedulerTimer(set, clear) {
   let session = Cu.import("resource://gre/modules/TelemetrySession.jsm");
   session.Policy.setSchedulerTickTimeout = set;
   session.Policy.clearSchedulerTickTimeout = clear;
 }
 
+/* global TelemetrySession:false, TelemetryEnvironment:false, TelemetryController:false,
+          TelemetryStorage:false, TelemetrySend:false, TelemetryReportingPolicy:false
+ */
+
 /**
  * Fake the current date.
  * This passes all received arguments to a new Date constructor and
  * uses the resulting date to fake the time in Telemetry modules.
  *
  * @return Date The new faked date.
  */
 function fakeNow(...args) {
@@ -303,16 +307,18 @@ if (runningInParent) {
   // FHR uploads should be enabled.
   Services.prefs.setBoolPref("datareporting.healthreport.uploadEnabled", true);
 
   fakePingSendTimer((callback, timeout) => {
     Services.tm.mainThread.dispatch(() => callback(), Ci.nsIThread.DISPATCH_NORMAL);
   },
   () => {});
 
+  // This gets imported via fakeNow();
+  /* global TelemetrySend */
   do_register_cleanup(() => TelemetrySend.shutdown());
 }
 
 TelemetryController.testInitLogging();
 
 // Avoid timers interrupting test behavior.
 fakeSchedulerTimer(() => {}, () => {});
 // Make pind sending predictable.
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryCaptureStack.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryCaptureStack.js
@@ -152,17 +152,17 @@ add_task({
   let stacks = captureStacks(TEST_STACK_KEYS[0], false);
   let original = {
     captures: stacks.captures.find(capture => capture[0] === TEST_STACK_KEYS[0]),
     stacks: stacks.stacks
   };
 
   // Capture stack for a new key.
   let uniqueKey = TEST_STACK_KEYS[1] + "-UNIQUE-KEY-2";
-  updated = captureStacks(uniqueKey);
+  let updated = captureStacks(uniqueKey);
 
   // The length of captured stacks should increase to reflect the new capture.
   Assert.equal(original.stacks.length + 1, updated.stacks.length);
 
   // The information for TEST_STACK_KEYS[0] should remain same.
   Assert.deepEqual(
     original.captures,
     updated.captures.find(capture => capture[0] === TEST_STACK_KEYS[0])
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
@@ -406,17 +406,17 @@ add_task(function* test_midnightPingSend
   // Clean-up.
   fakeMidnightPingFuzzingDelay(0);
   fakePingSendTimer(() => {}, () => {});
 });
 
 add_task(function* test_changePingAfterSubmission() {
   // Submit a ping with a custom payload.
   let payload = { canary: "test" };
-  let pingPromise = TelemetryController.submitExternalPing(TEST_PING_TYPE, payload, options);
+  let pingPromise = TelemetryController.submitExternalPing(TEST_PING_TYPE, payload);
 
   // Change the payload with a predefined value.
   payload.canary = "changed";
 
   // Wait for the ping to be archived.
   const pingId = yield pingPromise;
 
   // Make sure our changes didn't affect the submitted payload.
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryEvents.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEvents.js
@@ -101,17 +101,17 @@ add_task(function* test_recording() {
   };
 
   // Check that the expected events were recorded.
   let events = Telemetry.snapshotBuiltinEvents(OPTIN, false);
   checkEvents(events, expected);
 
   // Check serializing only opt-out events.
   events = Telemetry.snapshotBuiltinEvents(OPTOUT, false);
-  filtered = expected.filter(e => e.optout == true);
+  let filtered = expected.filter(e => e.optout == true);
   checkEvents(events, filtered);
 });
 
 add_task(function* test_clear() {
   Telemetry.clearEvents();
 
   const COUNT = 10;
   for (let i = 0; i < COUNT; ++i) {
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -269,29 +269,29 @@ function checkScalars(processes) {
                   name + " contains an unsupported value type (" + valueType + ")");
     }
   }
 
   // Check that we have valid scalar entries.
   const scalars = parentProcess.scalars;
   for (let name in scalars) {
     Assert.equal(typeof name, "string", "Scalar names must be strings.");
-    checkScalar(scalar[name]);
+    checkScalar(scalars [name]);
   }
 
   // Check that we have valid keyed scalar entries.
   const keyedScalars = parentProcess.keyedScalars;
   for (let name in keyedScalars) {
     Assert.equal(typeof name, "string", "Scalar names must be strings.");
     Assert.ok(Object.keys(keyedScalars[name]).length,
               "The reported keyed scalars must contain at least 1 key.");
     for (let key in keyedScalars[name]) {
       Assert.equal(typeof key, "string", "Keyed scalar keys must be strings.");
       Assert.ok(key.length <= 70, "Keyed scalar keys can't have more than 70 characters.");
-      checkScalar(scalar[name][key]);
+      checkScalar(scalars[name][key]);
     }
   }
 }
 
 function checkEvents(processes) {
   // Check that the events section is available in the ping payload.
   const parent = processes.parent;
   Assert.ok("events" in parent, "The events section must be available in the parent process.");
@@ -791,17 +791,17 @@ add_task(function* test_checkSubsessionH
     "TELEMETRY_TEST_KEYED_RELEASE_OPTOUT",
   ]);
 
   // Compare the two sets of histograms.
   // The "subsession" histograms should match the registered
   // "classic" histograms. However, histograms can change
   // between us collecting the different payloads, so we only
   // check for deep equality on known stable histograms.
-  checkHistograms = (classic, subsession) => {
+  let checkHistograms = (classic, subsession) => {
     for (let id of Object.keys(classic)) {
       if (!registeredIds.has(id)) {
         continue;
       }
 
       Assert.ok(id in subsession);
       if (stableHistograms.has(id)) {
         Assert.deepEqual(classic[id],
@@ -809,17 +809,17 @@ add_task(function* test_checkSubsessionH
       } else {
         Assert.equal(classic[id].histogram_type,
                      subsession[id].histogram_type);
       }
     }
   };
 
   // Same as above, except for keyed histograms.
-  checkKeyedHistograms = (classic, subsession) => {
+  let checkKeyedHistograms = (classic, subsession) => {
     for (let id of Object.keys(classic)) {
       if (!registeredIds.has(id)) {
         continue;
       }
 
       Assert.ok(id in subsession);
       if (stableKeyedHistograms.has(id)) {
         Assert.deepEqual(classic[id],
@@ -948,17 +948,17 @@ add_task(function* test_checkSubsessionD
     return;
   }
 
   // Keep track of the active ticks count if the session recorder is available.
   let sessionRecorder = TelemetryController.getSessionRecorder();
   let activeTicksAtSubsessionStart = sessionRecorder.activeTicks;
   let expectedActiveTicks = activeTicksAtSubsessionStart;
 
-  incrementActiveTicks = () => {
+  let incrementActiveTicks = () => {
     sessionRecorder.incrementActiveTicks();
     ++expectedActiveTicks;
   }
 
   yield TelemetryController.testReset();
 
   // Both classic and subsession payload data should be the same on the first subsession.
   incrementActiveTicks();
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryStopwatch.js
@@ -6,17 +6,17 @@ Cu.import("resource://gre/modules/Teleme
 var TelemetryStopwatch = tmpScope.TelemetryStopwatch;
 
 const HIST_NAME = "TELEMETRY_SEND_SUCCESS";
 const HIST_NAME2 = "RANGE_CHECKSUM_ERRORS";
 const KEYED_HIST = { id: "TELEMETRY_INVALID_PING_TYPE_SUBMITTED", key: "TEST" };
 
 var refObj = {}, refObj2 = {};
 
-var originalCount1, originalCount2;
+var originalCount1, originalCount2, originalCount3;
 
 function run_test() {
   let histogram = Telemetry.getHistogramById(HIST_NAME);
   let snapshot = histogram.snapshot();
   originalCount1 = snapshot.counts.reduce((a, b) => a += b);
 
   histogram = Telemetry.getHistogramById(HIST_NAME2);
   snapshot = histogram.snapshot();
--- a/toolkit/components/thumbnails/test/head.js
+++ b/toolkit/components/thumbnails/test/head.js
@@ -1,11 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+// Note: All tests in this directory are expected to have a runTests function
+// which TestRunner will use.
+/* global runTests */
+
 var tmp = {};
 Cu.import("resource://gre/modules/PageThumbs.jsm", tmp);
 Cu.import("resource://gre/modules/BackgroundPageThumbs.jsm", tmp);
 Cu.import("resource://gre/modules/NewTabUtils.jsm", tmp);
 Cu.import("resource:///modules/sessionstore/SessionStore.jsm", tmp);
 Cu.import("resource://gre/modules/FileUtils.jsm", tmp);
 Cu.import("resource://gre/modules/osfile.jsm", tmp);
 var {PageThumbs, BackgroundPageThumbs, NewTabUtils, PageThumbsStorage, SessionStore, FileUtils, OS} = tmp;
new file mode 100644
--- /dev/null
+++ b/toolkit/components/tooltiptext/tests/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+  "extends": [
+    "../../../../testing/mochitest/browser.eslintrc.js"
+  ]
+};