Bug 1556380 - Enable more ESLint rules for extensions/. r=Ehsan
authorMegha <meghajais.mj@hotmail.com>
Fri, 06 Dec 2019 21:05:20 +0000
changeset 506399 259a20e6ad45880d79585fd7c1b55d6b24f4e72b
parent 506398 b145da4214191a4f726ff10fa8d895077e5e5312
child 506400 d444961b5e7009684bda8e4ceb2519186eb6f942
push id102853
push usermbanner@mozilla.com
push dateWed, 11 Dec 2019 08:31:00 +0000
treeherderautoland@259a20e6ad45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersEhsan
bugs1556380
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1556380 - Enable more ESLint rules for extensions/. r=Ehsan Differential Revision: https://phabricator.services.mozilla.com/D43355
.eslintrc.js
extensions/permissions/test/PermissionTestUtils.jsm
extensions/permissions/test/unit/test_permmanager_cleardata.js
extensions/permissions/test/unit/test_permmanager_defaults.js
extensions/permissions/test/unit/test_permmanager_expiration.js
extensions/permissions/test/unit/test_permmanager_getAllForPrincipal.js
extensions/permissions/test/unit/test_permmanager_getAllWithTypePrefix.js
extensions/permissions/test/unit/test_permmanager_getPermissionObject.js
extensions/permissions/test/unit/test_permmanager_idn.js
extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js
extensions/permissions/test/unit/test_permmanager_matches.js
extensions/permissions/test/unit/test_permmanager_matchesuri.js
extensions/permissions/test/unit/test_permmanager_migrate_4-7.js
extensions/permissions/test/unit/test_permmanager_migrate_4-7_no_history.js
extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js
extensions/permissions/test/unit/test_permmanager_migrate_5-7b.js
extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js
extensions/permissions/test/unit/test_permmanager_migrate_6-7b.js
extensions/permissions/test/unit/test_permmanager_migrate_7-8.js
extensions/permissions/test/unit/test_permmanager_migrate_9-10.js
extensions/permissions/test/unit/test_permmanager_notifications.js
extensions/permissions/test/unit/test_permmanager_oa_strip.js
extensions/permissions/test/unit/test_permmanager_removeall.js
extensions/permissions/test/unit/test_permmanager_removebytype.js
extensions/permissions/test/unit/test_permmanager_removebytypesince.js
extensions/permissions/test/unit/test_permmanager_removepermission.js
extensions/permissions/test/unit/test_permmanager_removesince.js
extensions/permissions/test/unit/test_permmanager_subdomains.js
extensions/spellcheck/hunspell/tests/unit/test_hunspell.js
extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js
extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xhtml
extensions/spellcheck/tests/mochitest/helper_bug1170484.js
extensions/spellcheck/tests/mochitest/test_bug1170484.html
extensions/spellcheck/tests/mochitest/test_bug1272623.html
extensions/universalchardet/tests/CharsetDetectionTests.js
extensions/universalchardet/tests/test_bug431054.html
tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -104,33 +104,16 @@ module.exports = {
       "mozilla/simpletest": true,
     },
     "files": [
       ...mochitestTestPaths.map(path => `${path}/**/*.js`),
       ...chromeTestPaths.map(path => `${path}/**/*.js`),
     ],
   }, {
     "files": [
-      "extensions/permissions/test/**",
-      "extensions/spellcheck/**",
-      "extensions/universalchardet/tests/**",
-    ],
-    "rules": {
-      "mozilla/reject-importGlobalProperties": "off",
-      "mozilla/use-default-preference-values": "off",
-      "mozilla/use-services": "off",
-      "no-array-constructor": "off",
-      "no-undef": "off",
-      "no-unused-vars": "off",
-      "no-useless-concat": "off",
-      "no-redeclare": "off",
-      "no-global-assign": "off",
-    }
-  }, {
-    "files": [
       "netwerk/cookie/test/browser/**",
       "netwerk/test/browser/**",
       "netwerk/test/mochitests/**",
       "netwerk/test/unit*/**",
     ],
     "rules": {
       "mozilla/consistent-if-bracing": "off",
       "mozilla/reject-importGlobalProperties": "off",
@@ -627,28 +610,28 @@ module.exports = {
       "toolkit/content/tests/chrome/bug429723_window.xhtml",
       "toolkit/content/tests/chrome/bug451540_window.xhtml",
       "toolkit/content/tests/chrome/dialog_dialogfocus.xhtml",
       "toolkit/content/tests/chrome/findbar_entireword_window.xhtml",
       "toolkit/content/tests/chrome/findbar_events_window.xhtml",
       "toolkit/content/tests/chrome/findbar_window.xhtml",
       "toolkit/content/tests/chrome/frame_popup_anchor.xhtml",
       "toolkit/content/tests/chrome/frame_subframe_origin_subframe1.xhtml",
-      "toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xhtml",   
+      "toolkit/content/tests/chrome/frame_subframe_origin_subframe2.xhtml",
       "toolkit/content/tests/chrome/test_arrowpanel.xhtml",
       "toolkit/content/tests/chrome/test_autocomplete2.xhtml",
       "toolkit/content/tests/chrome/test_autocomplete3.xhtml",
       "toolkit/content/tests/chrome/test_autocomplete4.xhtml",
       "toolkit/content/tests/chrome/test_autocomplete5.xhtml",
       "toolkit/content/tests/chrome/test_autocomplete_emphasis.xhtml",
       "toolkit/content/tests/chrome/test_autocomplete_mac_caret.xhtml",
       "toolkit/content/tests/chrome/test_autocomplete_placehold_last_complete.xhtml",
       "toolkit/content/tests/chrome/test_browser_drop.xhtml",
       "toolkit/content/tests/chrome/test_bug1048178.xhtml",
-      "toolkit/content/tests/chrome/test_bug382990.xhtml",  
+      "toolkit/content/tests/chrome/test_bug382990.xhtml",
       "toolkit/content/tests/chrome/test_bug437844.xhtml",
       "toolkit/content/tests/chrome/test_bug624329.xhtml",
       "toolkit/content/tests/chrome/test_bug792324.xhtml",
       "toolkit/content/tests/chrome/test_contextmenu_list.xhtml",
       "toolkit/content/tests/chrome/test_cursorsnap.xhtml",
       "toolkit/content/tests/chrome/test_dialogfocus.xhtml",
       "toolkit/content/tests/chrome/test_hiddenitems.xhtml",
       "toolkit/content/tests/chrome/test_hiddenpaging.xhtml",
@@ -660,48 +643,48 @@ module.exports = {
       "toolkit/content/tests/chrome/test_mousescroll.xhtml",
       "toolkit/content/tests/chrome/test_mozinputbox_dictionary.xhtml",
       "toolkit/content/tests/chrome/test_notificationbox.xhtml",
       "toolkit/content/tests/chrome/test_panel_focus.xhtml",
       "toolkit/content/tests/chrome/test_popup_keys.xhtml",
       "toolkit/content/tests/chrome/test_popup_scaled.xhtml",
       "toolkit/content/tests/chrome/test_popupincontent.xhtml",
       "toolkit/content/tests/chrome/test_popupremoving.xhtml",
-      "toolkit/content/tests/chrome/test_popupremoving_frame.xhtml",    
+      "toolkit/content/tests/chrome/test_popupremoving_frame.xhtml",
       "toolkit/content/tests/chrome/test_position.xhtml",
       "toolkit/content/tests/chrome/test_preferences.xhtml",
       "toolkit/content/tests/chrome/test_richlistbox.xhtml",
       "toolkit/content/tests/chrome/test_righttoleft.xhtml",
       "toolkit/content/tests/chrome/test_screenPersistence.xhtml",
       "toolkit/content/tests/chrome/test_scrollbar.xhtml",
       "toolkit/content/tests/chrome/test_showcaret.xhtml",
       "toolkit/content/tests/chrome/test_tabbox.xhtml",
       "toolkit/content/tests/chrome/test_textbox_search.xhtml",
       "toolkit/content/tests/chrome/test_tree_view.xhtml",
-      "toolkit/content/tests/chrome/window_browser_drop.xhtml",   
+      "toolkit/content/tests/chrome/window_browser_drop.xhtml",
       "toolkit/content/tests/chrome/window_cursorsnap_dialog.xhtml",
       "toolkit/content/tests/chrome/window_cursorsnap_wizard.xhtml",
       "toolkit/content/tests/chrome/window_keys.xhtml",
       "toolkit/content/tests/chrome/window_largemenu.xhtml",
       "toolkit/content/tests/chrome/window_panel.xhtml",
       "toolkit/content/tests/chrome/window_panel_anchoradjust.xhtml",
       "toolkit/content/tests/chrome/window_popup_preventdefault_chrome.xhtml",
       "toolkit/content/tests/chrome/window_preferences.xhtml",
       "toolkit/content/tests/chrome/window_preferences3.xhtml",
       "toolkit/content/tests/chrome/window_preferences_beforeaccept.xhtml",
-      "toolkit/content/tests/chrome/window_preferences_commandretarget.xhtml",  
+      "toolkit/content/tests/chrome/window_preferences_commandretarget.xhtml",
       "toolkit/content/tests/chrome/window_preferences_onsyncfrompreference.xhtml",
       "toolkit/content/tests/chrome/window_subframe_origin.xhtml",
       "toolkit/content/tests/chrome/window_titlebar.xhtml",
       "toolkit/content/tests/chrome/window_tooltip.xhtml",
       "toolkit/content/tests/widgets/test_contextmenu_menugroup.xhtml",
       "toolkit/content/tests/widgets/test_contextmenu_nested.xhtml",
       "toolkit/content/tests/widgets/test_editor_currentURI.xhtml",
       "toolkit/content/tests/widgets/test_popupanchor.xhtml",
-      "toolkit/content/tests/widgets/test_popupreflows.xhtml",  
+      "toolkit/content/tests/widgets/test_popupreflows.xhtml",
       "toolkit/content/tests/widgets/window_menubar.xhtml",
       "toolkit/modules/tests/chrome/test_bug544442_checkCert.xhtml",
       "toolkit/profile/test/test_create_profile.xhtml",
     ],
     "rules": {
       "object-shorthand": "off",
       "consistent-return": "off",
       "mozilla/consistent-if-bracing": "off",
--- a/extensions/permissions/test/PermissionTestUtils.jsm
+++ b/extensions/permissions/test/PermissionTestUtils.jsm
@@ -3,23 +3,21 @@
 
 /*
  * Utility module for tests to access the PermissionManager
  * with uri or origin string parameters.
  */
 
 "use strict";
 
-let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-  Ci.nsIPermissionManager
-);
+const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
-let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-  Ci.nsIScriptSecurityManager
-);
+let pm = Services.perms;
+
+let secMan = Services.scriptSecurityManager;
 
 const EXPORTED_SYMBOLS = ["PermissionTestUtils"];
 
 /**
  * Convert origin string or uri to principal.
  * If passed an nsIPrincipal it will be returned without conversion.
  * @param {Ci.nsIPrincipal|Ci.nsIURI|string} subject - Subject to convert to principal
  * @returns {Ci.nsIPrincipal} Principal created from subject
--- a/extensions/permissions/test/unit/test_permmanager_cleardata.js
+++ b/extensions/permissions/test/unit/test_permmanager_cleardata.js
@@ -17,21 +17,21 @@ function getData(aPattern) {
 }
 
 // Use aEntries to create principals, add permissions to them and check that they have them.
 // Then, it is notifying 'clear-origin-attributes-data' with the given aData and check if the permissions
 // of principals[i] matches the permission in aResults[i].
 function test(aEntries, aData, aResults) {
   let principals = [];
 
-  for (entry of aEntries) {
+  for (const entry of aEntries) {
     principals.push(createPrincipal(entry.origin, entry.originAttributes));
   }
 
-  for (principal of principals) {
+  for (const principal of principals) {
     Assert.equal(
       pm.testPermissionFromPrincipal(principal, "test/clear-origin"),
       pm.UNKNOWN_ACTION
     );
     pm.addFromPrincipal(
       principal,
       "test/clear-origin",
       pm.ALLOW_ACTION,
@@ -58,19 +58,17 @@ function test(aEntries, aData, aResults)
       pm.removeFromPrincipal(principals[i], "test/clear-origin");
     }
   }
 }
 
 function run_test() {
   do_get_profile();
 
-  pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  pm = Services.perms;
 
   let entries = [
     { origin: "http://example.com", originAttributes: {} },
     {
       origin: "http://example.com",
       originAttributes: { inIsolatedMozBrowser: true },
     },
   ];
--- a/extensions/permissions/test/unit/test_permmanager_defaults.js
+++ b/extensions/permissions/test/unit/test_permmanager_defaults.js
@@ -56,19 +56,17 @@ add_task(async function do_test() {
 
   // This will force the permission-manager to reload the data.
   Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");
 
   let permIsolateUserContext = Services.prefs.getBoolPref(
     "permissions.isolateBy.userContext"
   );
 
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   // test the default permission was applied.
   let principal = Services.scriptSecurityManager.createContentPrincipal(
     TEST_ORIGIN,
     {}
   );
   let principalHttps = Services.scriptSecurityManager.createContentPrincipal(
     TEST_ORIGIN_HTTPS,
@@ -411,21 +409,17 @@ function findCapabilityViaDB(origin = TE
     origin,
     {}
   );
   let originStr = principal.origin;
 
   let file = Services.dirsvc.get("ProfD", Ci.nsIFile);
   file.append("permissions.sqlite");
 
-  let storage = Cc["@mozilla.org/storage/service;1"].getService(
-    Ci.mozIStorageService
-  );
-
-  let connection = storage.openDatabase(file);
+  let connection = Services.storage.openDatabase(file);
 
   let query = connection.createStatement(
     "SELECT permission FROM moz_perms WHERE origin = :origin AND type = :type"
   );
   query.bindByName("origin", originStr);
   query.bindByName("type", type);
 
   if (!query.executeStep()) {
--- a/extensions/permissions/test/unit/test_permmanager_expiration.js
+++ b/extensions/permissions/test/unit/test_permmanager_expiration.js
@@ -1,28 +1,24 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 // Test that permissions with specific expiry times behave as expected.
-
 var test_generator = do_run_test();
 
 function run_test() {
   do_test_pending();
   test_generator.next();
 }
 
 function continue_test() {
   do_run_generator(test_generator);
 }
 
 function* do_run_test() {
-  // Set up a profile.
-  let profile = do_get_profile();
-
   let pm = Services.perms;
   let permURI = NetUtil.newURI("http://example.com");
   let principal = Services.scriptSecurityManager.createContentPrincipal(
     permURI,
     {}
   );
 
   let now = Number(Date.now());
--- a/extensions/permissions/test/unit/test_permmanager_getAllForPrincipal.js
+++ b/extensions/permissions/test/unit/test_permmanager_getAllForPrincipal.js
@@ -1,31 +1,25 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function check_enumerator(principal, permissions) {
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
-
-  let perms = pm.getAllForPrincipal(principal);
-  for ([type, capability] of permissions) {
+  let perms = Services.perms.getAllForPrincipal(principal);
+  for (let [type, capability] of permissions) {
     let perm = perms.shift();
     Assert.ok(perm != null);
     Assert.equal(perm.type, type);
     Assert.equal(perm.capability, capability);
-    Assert.equal(perm.expireType, pm.EXPIRE_NEVER);
+    Assert.equal(perm.expireType, Services.perms.EXPIRE_NEVER);
   }
   Assert.ok(!perms.length);
 }
 
 function run_test() {
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
     "http://example.com"
   );
   let subPrincipal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
     "http://sub.example.com"
   );
 
--- a/extensions/permissions/test/unit/test_permmanager_getAllWithTypePrefix.js
+++ b/extensions/permissions/test/unit/test_permmanager_getAllWithTypePrefix.js
@@ -1,32 +1,28 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function check_enumerator(prefix, permissions) {
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   let array = pm.getAllWithTypePrefix(prefix);
   for (let [principal, type, capability] of permissions) {
     let perm = array.shift();
     Assert.ok(perm != null);
     Assert.ok(perm.principal.equals(principal));
     Assert.equal(perm.type, type);
     Assert.equal(perm.capability, capability);
     Assert.equal(perm.expireType, pm.EXPIRE_NEVER);
   }
   Assert.equal(array.length, 0);
 }
 
 function run_test() {
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
     "http://example.com"
   );
   let subPrincipal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
     "http://sub.example.com"
   );
 
--- a/extensions/permissions/test/unit/test_permmanager_getPermissionObject.js
+++ b/extensions/permissions/test/unit/test_permmanager_getPermissionObject.js
@@ -1,29 +1,23 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function getPrincipalFromURI(aURI) {
-  let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let ssm = Services.scriptSecurityManager;
   let uri = NetUtil.newURI(aURI);
   return ssm.createContentPrincipal(uri, {});
 }
 
 function getSystemPrincipal() {
-  return Cc["@mozilla.org/scriptsecuritymanager;1"]
-    .getService(Ci.nsIScriptSecurityManager)
-    .getSystemPrincipal();
+  return Services.scriptSecurityManager.getSystemPrincipal();
 }
 
 function run_test() {
-  var pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  var pm = Services.perms;
 
   Assert.equal(
     null,
     pm.getPermissionObject(getSystemPrincipal(), "test/pobject", false)
   );
 
   let principal = getPrincipalFromURI("http://example.com");
   let subPrincipal = getPrincipalFromURI("http://sub.example.com");
@@ -35,17 +29,16 @@ function run_test() {
   pm.addFromPrincipal(principal, "test/pobject", pm.ALLOW_ACTION);
   var rootPerm = pm.getPermissionObject(principal, "test/pobject", false);
   Assert.ok(rootPerm != null);
   Assert.equal(rootPerm.principal.origin, "http://example.com");
   Assert.equal(rootPerm.type, "test/pobject");
   Assert.equal(rootPerm.capability, pm.ALLOW_ACTION);
   Assert.equal(rootPerm.expireType, pm.EXPIRE_NEVER);
 
-  var rootPerm2 = pm.getPermissionObject(principal, "test/pobject", true);
   Assert.ok(rootPerm != null);
   Assert.equal(rootPerm.principal.origin, "http://example.com");
 
   var subPerm = pm.getPermissionObject(subPrincipal, "test/pobject", true);
   Assert.equal(null, subPerm);
   subPerm = pm.getPermissionObject(subPrincipal, "test/pobject", false);
   Assert.ok(subPerm != null);
   Assert.equal(subPerm.principal.origin, "http://example.com");
--- a/extensions/permissions/test/unit/test_permmanager_idn.js
+++ b/extensions/permissions/test/unit/test_permmanager_idn.js
@@ -1,21 +1,18 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function getPrincipalFromDomain(aDomain) {
-  let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let ssm = Services.scriptSecurityManager;
   let uri = NetUtil.newURI("http://" + aDomain);
   return ssm.createContentPrincipal(uri, {});
 }
 
 function run_test() {
-  let profile = do_get_profile();
   let pm = Services.perms;
   let perm = "test-idn";
 
   // We create three principal linked to IDN.
   // One with just a domain, one with a subdomain and one with the TLD
   // containing a UTF-8 character.
   let mainDomainPrincipal = getPrincipalFromDomain("fôû.com");
   let subDomainPrincipal = getPrincipalFromDomain("fôô.bàr.com");
--- a/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js
+++ b/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js
@@ -1,23 +1,20 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
-
 var DEBUG_TEST = false;
 
 function run_test() {
   // Setup a profile directory.
   var dir = do_get_profile();
   // Get the db file.
   var file = dir.clone();
   file.append("permissions.sqlite");
 
-  var storage = Cc["@mozilla.org/storage/service;1"].getService(
-    Ci.mozIStorageService
-  );
+  var storage = Services.storage;
 
   // Create database.
   var connection = storage.openDatabase(file);
   // The file should now exist.
   Assert.ok(file.exists());
 
   connection.schemaVersion = 3;
   connection.executeSimpleSQL("DROP TABLE moz_hosts");
@@ -218,22 +215,18 @@ function run_test() {
         data.isInBrowserElement +
         ", 0)"
     );
   }
 
   // This will force the permission-manager to reload the data.
   Services.obs.notifyObservers(null, "testonly-reload-permissions-from-disk");
 
-  let earliestNow = Number(Date.now());
   // Initialize the permission manager service
-  var pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
-  let latestNow = Number(Date.now());
+  var pm = Services.perms;
 
   // The schema should be upgraded to 10, and a 'modificationTime' column should
   // exist with all records having a value of 0.
   Assert.equal(connection.schemaVersion, 10);
 
   let select = connection.createStatement(
     "SELECT modificationTime FROM moz_perms"
   );
@@ -246,18 +239,16 @@ function run_test() {
   // check we found at least 1 record that was migrated.
   Assert.greater(
     numMigrated,
     0,
     "we found at least 1 record that was migrated"
   );
 
   // This permission should always be there.
-  let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let ssm = Services.scriptSecurityManager;
   let uri = NetUtil.newURI("http://example.org");
   let principal = ssm.createContentPrincipal(uri, {});
   Assert.equal(
     pm.testPermissionFromPrincipal(principal, "test-load-invalid-entries"),
     Ci.nsIPermissionManager.ALLOW_ACTION
   );
 }
--- a/extensions/permissions/test/unit/test_permmanager_matches.js
+++ b/extensions/permissions/test/unit/test_permmanager_matches.js
@@ -1,11 +1,13 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
+var attrs;
+
 function matches_always(perm, principals) {
   principals.forEach(principal => {
     Assert.ok(
       perm.matches(principal, true),
       "perm: " + perm.principal.origin + ", princ: " + principal.origin
     );
     Assert.ok(
       perm.matches(principal, false),
@@ -37,23 +39,19 @@ function matches_never(perm, principals)
       !perm.matches(principal, false),
       "perm: " + perm.principal.origin + ", princ: " + principal.origin
     );
   });
 }
 
 function run_test() {
   // initialize the permission manager service
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
-  let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let secMan = Services.scriptSecurityManager;
 
   // Add some permissions
   let uri0 = NetUtil.newURI("http://google.com/search?q=foo#hashtag");
   let uri1 = NetUtil.newURI("http://hangouts.google.com/subdir");
   let uri2 = NetUtil.newURI("http://google.org/");
   let uri3 = NetUtil.newURI("https://google.com/some/random/subdirectory");
   let uri4 = NetUtil.newURI("https://hangouts.google.com/#!/hangout");
   let uri5 = NetUtil.newURI("http://google.com:8096/");
--- a/extensions/permissions/test/unit/test_permmanager_matchesuri.js
+++ b/extensions/permissions/test/unit/test_permmanager_matchesuri.js
@@ -36,42 +36,32 @@ function matches_never(perm, uris) {
     Assert.ok(
       !perm.matchesURI(uri, false),
       "perm: " + perm.principal.origin + ", URI: " + uri.spec
     );
   });
 }
 
 function mk_permission(uri) {
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
-  let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let secMan = Services.scriptSecurityManager;
 
   // Get the permission from the principal!
   let principal = secMan.createContentPrincipal(uri, {});
 
   pm.addFromPrincipal(principal, "test/matchesuri", pm.ALLOW_ACTION);
   let permission = pm.getPermissionObject(principal, "test/matchesuri", true);
 
   return permission;
 }
 
 function run_test() {
   // initialize the permission manager service
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
-
-  let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let pm = Services.perms;
 
   let fileprefix = "file:///";
   if (Services.appinfo.OS == "WINNT") {
     // Windows rejects files if they don't have a drive. See Bug 1180870
     fileprefix += "c:/";
   }
 
   // Add some permissions
--- a/extensions/permissions/test/unit/test_permmanager_migrate_4-7.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_4-7.js
@@ -86,16 +86,17 @@ add_task(async function test() {
       expireTime,
       modificationTime,
       appId,
       isInBrowserElement,
     };
   }
 
   // Add some rows to the database
+  // eslint-disable-next-line no-unused-vars
   let created = [
     insertHost("foo.com", "A", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "C", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 1000, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 2000, true),
     insertHost("sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("subber.sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("bar.ca", "B", 1, 0, 0, 0, 0, false),
--- a/extensions/permissions/test/unit/test_permmanager_migrate_4-7_no_history.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_4-7_no_history.js
@@ -126,16 +126,17 @@ add_task(function test() {
       expireTime,
       modificationTime,
       appId,
       isInBrowserElement,
     };
   }
 
   // Add some rows to the database
+  // eslint-disable-next-line no-unused-vars
   let created = [
     insertHost("foo.com", "A", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "C", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 1000, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 2000, true),
     insertHost("sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("subber.sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("bar.ca", "B", 1, 0, 0, 0, 0, false),
--- a/extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_5-7a.js
@@ -104,17 +104,16 @@ add_task(async function test() {
       origin,
       type,
       permission,
       expireType,
       expireTime,
       modificationTime,
     };
   }
-
   function insertHost(
     host,
     type,
     permission,
     expireType,
     expireTime,
     modificationTime,
     appId,
@@ -153,16 +152,17 @@ add_task(async function test() {
 
   let created5 = [
     insertOrigin("https://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com^inBrowser=1", "A", 2, 0, 0, 0),
   ];
 
   // Add some rows to the database
+  // eslint-disable-next-line no-unused-vars
   let created = [
     insertHost("foo.com", "A", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "C", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 1000, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 2000, true),
     insertHost("sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("subber.sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("bar.ca", "B", 1, 0, 0, 0, 0, false),
--- a/extensions/permissions/test/unit/test_permmanager_migrate_5-7b.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_5-7b.js
@@ -44,17 +44,16 @@ add_task(function test() {
     "INSERT INTO moz_hosts (" +
       "id, origin, type, permission, expireType, expireTime, modificationTime" +
       ") VALUES (" +
       ":id, :origin, :type, :permission, :expireType, :expireTime, :modificationTime" +
       ")"
   );
 
   let id = 0;
-
   function insertOrigin(
     origin,
     type,
     permission,
     expireType,
     expireTime,
     modificationTime
   ) {
@@ -80,16 +79,17 @@ add_task(function test() {
       type,
       permission,
       expireType,
       expireTime,
       modificationTime,
     };
   }
 
+  // eslint-disable-next-line no-unused-vars
   let created5 = [
     insertOrigin("https://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com^appId=1000&inBrowser=1", "A", 2, 0, 0, 0),
 
     insertOrigin("http://127.0.0.1", "B", 2, 0, 0, 0),
     insertOrigin("http://localhost", "B", 2, 0, 0, 0),
   ];
--- a/extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_6-7a.js
@@ -153,16 +153,17 @@ add_task(async function test() {
 
   let created6 = [
     insertOrigin("https://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com^inBrowser=1", "A", 2, 0, 0, 0),
   ];
 
   // Add some rows to the database
+  // eslint-disable-next-line no-unused-vars
   let created = [
     insertHost("foo.com", "A", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "C", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 1000, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 2000, true),
     insertHost("sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("subber.sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("bar.ca", "B", 1, 0, 0, 0, 0, false),
--- a/extensions/permissions/test/unit/test_permmanager_migrate_6-7b.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_6-7b.js
@@ -44,17 +44,16 @@ add_task(function test() {
     "INSERT INTO moz_perms (" +
       "id, origin, type, permission, expireType, expireTime, modificationTime" +
       ") VALUES (" +
       ":id, :origin, :type, :permission, :expireType, :expireTime, :modificationTime" +
       ")"
   );
 
   let id = 0;
-
   function insertOrigin(
     origin,
     type,
     permission,
     expireType,
     expireTime,
     modificationTime
   ) {
@@ -80,16 +79,17 @@ add_task(function test() {
       type,
       permission,
       expireType,
       expireTime,
       modificationTime,
     };
   }
 
+  // eslint-disable-next-line no-unused-vars
   let created6 = [
     insertOrigin("https://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com^appId=1000&inBrowser=1", "A", 2, 0, 0, 0),
   ];
 
   let created4 = []; // Didn't create any v4 entries, so the DB should be empty
 
--- a/extensions/permissions/test/unit/test_permmanager_migrate_7-8.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_7-8.js
@@ -152,25 +152,26 @@ add_task(async function test() {
       permission,
       expireType,
       expireTime,
       modificationTime,
       appId,
       isInBrowserElement,
     };
   }
-
+  // eslint-disable-next-line no-unused-vars
   let created7 = [
     insertOrigin("https://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com^inBrowser=1", "A", 2, 0, 0, 0),
     insertOrigin("https://192.0.2.235", "A", 2, 0, 0),
   ];
 
   // Add some rows to the database
+  // eslint-disable-next-line no-unused-vars
   let created = [
     insertHost("foo.com", "A", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "C", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 1000, false),
     insertHost("foo.com", "A", 1, 0, 0, 0, 2000, true),
     insertHost("sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("subber.sub.foo.com", "B", 1, 0, 0, 0, 0, false),
     insertHost("bar.ca", "B", 1, 0, 0, 0, 0, false),
--- a/extensions/permissions/test/unit/test_permmanager_migrate_9-10.js
+++ b/extensions/permissions/test/unit/test_permmanager_migrate_9-10.js
@@ -139,24 +139,25 @@ add_task(async function test() {
       permission,
       expireType,
       expireTime,
       modificationTime,
       appId,
       isInBrowserElement,
     };
   }
-
+  // eslint-disable-next-line no-unused-vars
   let created7 = [
     insertOrigin("https://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com", "A", 2, 0, 0, 0),
     insertOrigin("http://foo.com^inBrowser=1", "A", 2, 0, 0, 0),
   ];
 
   // Add some rows to the database
+  // eslint-disable-next-line no-unused-vars
   let created = [
     insertHost("foo.com", "A", 1, 0, 0, 0, 0, false),
     insertHost("foo.com", "B", 1, 0, 0, 0, 1000, false),
     insertHost("foo.com", "C", 1, 0, 0, 0, 2000, true),
   ];
 
   // CLose the db connection
   stmt6Insert.finalize();
--- a/extensions/permissions/test/unit/test_permmanager_notifications.js
+++ b/extensions/permissions/test/unit/test_permmanager_notifications.js
@@ -12,25 +12,20 @@ function run_test() {
   test_generator.next();
 }
 
 function continue_test() {
   do_run_generator(test_generator);
 }
 
 function* do_run_test() {
-  // Set up a profile.
-  let profile = do_get_profile();
-
   let pm = Services.perms;
   let now = Number(Date.now());
   let permType = "test/expiration-perm";
-  let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let ssm = Services.scriptSecurityManager;
   let uri = NetUtil.newURI("http://example.com");
   let principal = ssm.createContentPrincipal(uri, {});
 
   let observer = new permission_observer(test_generator, now, permType);
   Services.obs.addObserver(observer, "perm-changed");
 
   // Add a permission, to test the 'add' notification. Note that we use
   // do_execute_soon() so that we can use our generator to continue the test
--- a/extensions/permissions/test/unit/test_permmanager_oa_strip.js
+++ b/extensions/permissions/test/unit/test_permmanager_oa_strip.js
@@ -23,19 +23,17 @@ let principalUserContext2 = Services.scr
   { userContextId: 2 }
 );
 
 function testOAIsolation(permIsolateUserContext, permIsolatePrivateBrowsing) {
   info(
     `testOAIsolation: permIsolateUserContext: ${permIsolateUserContext}; permIsolatePrivateBrowsing: ${permIsolatePrivateBrowsing}`
   );
 
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   Services.prefs.setBoolPref(
     "permissions.isolateBy.userContext",
     permIsolateUserContext
   );
   Services.prefs.setBoolPref(
     "permissions.isolateBy.privateBrowsing",
     permIsolatePrivateBrowsing
--- a/extensions/permissions/test/unit/test_permmanager_removeall.js
+++ b/extensions/permissions/test/unit/test_permmanager_removeall.js
@@ -1,19 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
   // setup a profile directory
   var dir = do_get_profile();
 
   // initialize the permission manager service
-  var pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  var pm = Services.perms;
 
   // get the db file
   var file = dir.clone();
   file.append("permissions.sqlite");
   Assert.ok(file.exists());
 
   // corrupt the file
   var ostream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(
--- a/extensions/permissions/test/unit/test_permmanager_removebytype.js
+++ b/extensions/permissions/test/unit/test_permmanager_removebytype.js
@@ -1,18 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
   Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   // initialize the permission manager service
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   Assert.equal(pm.all.length, 0);
 
   // add some permissions
   let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
     "http://amazon.com:8080"
   );
   let principal2 = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
--- a/extensions/permissions/test/unit/test_permmanager_removebytypesince.js
+++ b/extensions/permissions/test/unit/test_permmanager_removebytypesince.js
@@ -1,18 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 add_task(async function test() {
   Services.prefs.setCharPref("permissions.manager.defaultsUrl", "");
 
   // initialize the permission manager service
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   Assert.equal(pm.all.length, 0);
 
   // add some permissions
   let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
     "http://amazon.com:8080"
   );
   let principal2 = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
--- a/extensions/permissions/test/unit/test_permmanager_removepermission.js
+++ b/extensions/permissions/test/unit/test_permmanager_removepermission.js
@@ -1,16 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
   // initialize the permission manager service
-  let pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  let pm = Services.perms;
 
   Assert.equal(pm.all.length, 0);
 
   // add some permissions
   let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
     "http://amazon.com:8080"
   );
   let principal2 = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
--- a/extensions/permissions/test/unit/test_permmanager_removesince.js
+++ b/extensions/permissions/test/unit/test_permmanager_removesince.js
@@ -10,19 +10,16 @@ function run_test() {
   test_generator.next();
 }
 
 function continue_test() {
   do_run_generator(test_generator);
 }
 
 function* do_run_test() {
-  // Set up a profile.
-  let profile = do_get_profile();
-
   let pm = Services.perms;
 
   // to help with testing edge-cases, we will arrange for .removeAllSince to
   // remove *all* permissions from one principal and one permission from another.
   let permURI1 = NetUtil.newURI("http://example.com");
   let principal1 = Services.scriptSecurityManager.createContentPrincipal(
     permURI1,
     {}
--- a/extensions/permissions/test/unit/test_permmanager_subdomains.js
+++ b/extensions/permissions/test/unit/test_permmanager_subdomains.js
@@ -1,23 +1,19 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function getPrincipalFromURI(aURI) {
-  let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService(
-    Ci.nsIScriptSecurityManager
-  );
+  let ssm = Services.scriptSecurityManager;
   let uri = NetUtil.newURI(aURI);
   return ssm.createContentPrincipal(uri, {});
 }
 
 function run_test() {
-  var pm = Cc["@mozilla.org/permissionmanager;1"].getService(
-    Ci.nsIPermissionManager
-  );
+  var pm = Services.perms;
 
   // Adds a permission to a sub-domain. Checks if it is working.
   let sub1Principal = getPrincipalFromURI("http://sub1.example.com");
   pm.addFromPrincipal(sub1Principal, "test/subdomains", pm.ALLOW_ACTION, 0, 0);
   Assert.equal(
     pm.testPermissionFromPrincipal(sub1Principal, "test/subdomains"),
     pm.ALLOW_ACTION
   );
--- a/extensions/spellcheck/hunspell/tests/unit/test_hunspell.js
+++ b/extensions/spellcheck/hunspell/tests/unit/test_hunspell.js
@@ -146,31 +146,32 @@ const tests = [
   ["opentaal-cpdpat", "iso-8859-1"],
   ["opentaal-cpdpat2", "iso-8859-1"],
   ["2999225", "iso-8859-1"],
   ["onlyincompound2", "iso-8859-1"],
   ["forceucase", "iso-8859-1"],
   ["warn", "iso-8859-1"],
 ];
 
+// eslint-disable-next-line no-shadow
 function* do_get_file_by_line(file, charset) {
   dump("getting file by line for file " + file.path + "\n");
-  dump("using charset " + charset + "\n");
+  dump("using charset1" + charset + "\n");
   let fis = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
     Ci.nsIFileInputStream
   );
   fis.init(file, 0x1 /* READONLY */, 0o444, Ci.nsIFileInputStream.CLOSE_ON_EOF);
 
   let lis = Cc["@mozilla.org/intl/converter-input-stream;1"].createInstance(
     Ci.nsIConverterInputStream
   );
   lis.init(fis, charset, 1024, 0);
   lis.QueryInterface(Ci.nsIUnicharLineInputStream);
 
-  var val = {};
+  let val = {};
   while (lis.readLine(val)) {
     yield val.value;
     val = {};
   }
 }
 
 function do_run_test(checker, name, charset, todo_good, todo_bad) {
   dump("\n\n\n\n");
@@ -186,17 +187,17 @@ function do_run_test(checker, name, char
   dump("Need some expected output\n");
   Assert.ok(good.exists() || bad.exists() || sug.exists());
 
   dump("Setting dictionary to " + name + "\n");
   checker.dictionary = name;
 
   if (good.exists()) {
     var good_counter = 0;
-    for (val of do_get_file_by_line(good, charset)) {
+    for (const val of do_get_file_by_line(good, charset)) {
       let todo = false;
       good_counter++;
       if (todo_good && todo_good[good_counter]) {
         todo = true;
         dump("TODO\n");
       }
 
       dump("Expect word " + val + " is spelled correctly\n");
@@ -205,17 +206,17 @@ function do_run_test(checker, name, char
       } else {
         Assert.ok(checker.check(val));
       }
     }
   }
 
   if (bad.exists()) {
     var bad_counter = 0;
-    for (val of do_get_file_by_line(bad, charset)) {
+    for (const val of do_get_file_by_line(bad, charset)) {
       let todo = false;
       bad_counter++;
       if (todo_bad && todo_bad[bad_counter]) {
         todo = true;
         dump("TODO\n");
       }
 
       dump("Expect word " + val + " is spelled wrong\n");
@@ -236,14 +237,14 @@ function run_test() {
   );
 
   Assert.ok(!!spellChecker, "Should have a spell checker");
   spellChecker.QueryInterface(Ci.mozISpellCheckingEngine);
   let testdir = do_get_file("data/", false);
   spellChecker.loadDictionariesFromDir(testdir);
 
   function do_run_test_closure(test) {
-    [name, charset, todo_good, todo_bad] = test;
+    let [name, charset, todo_good, todo_bad] = test;
     do_run_test(spellChecker, name, charset, todo_good, todo_bad);
   }
 
   tests.forEach(do_run_test_closure);
 }
--- a/extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js
+++ b/extensions/spellcheck/hunspell/tests/unit/test_hunspell_unicode_paths.js
@@ -1,17 +1,15 @@
 "use strict";
 
 const { XPCOMUtils } = ChromeUtils.import(
   "resource://gre/modules/XPCOMUtils.jsm"
 );
 const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
 
-Cu.importGlobalProperties(["TextEncoder"]);
-
 XPCOMUtils.defineLazyServiceGetter(
   this,
   "spellCheck",
   "@mozilla.org/spellchecker/engine;1",
   "mozISpellCheckingEngine"
 );
 
 const nsFile = Components.Constructor(
--- a/extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xhtml
+++ b/extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xhtml
@@ -35,16 +35,17 @@ function setCurrentDictionary(editor, di
   spellchecker.SetCurrentDictionary(dictionary);
 }
 
 function RunTest() {
   var textbox = document.getElementById('textbox');
   textbox.focus();
   var editor = textbox.editor;
 
+  // eslint-disable-next-line mozilla/use-services
   var dir = Cc["@mozilla.org/file/directory_service;1"].
             getService(Ci.nsIProperties).
             get("CurWorkD", Ci.nsIFile);
   dir.append("chrome");
   dir.append("extensions");
   dir.append("spellcheck");
   dir.append("tests");
   dir.append("chrome");
@@ -71,16 +72,17 @@ function RunTest() {
     // test that base and map dictionaries are available
     var dicts = getDictionaryList(editor);
     isnot(dicts.indexOf("base-utf"), -1, "base is available");
     isnot(dicts.indexOf("maputf"), -1, "map is available");
 
     // select base dictionary
     setCurrentDictionary(editor, "base-utf");
 
+    /* eslint-disable no-useless-concat */
     onSpellCheck(textbox, function () {
       // test that base dictionary is in use
       is(getMisspelledWords(editor), "Frühstück" + "qwertyu", "base misspellings");
       is(getCurrentDictionary(editor), "base-utf", "current dictionary");
 
       // select map dictionary
       setCurrentDictionary(editor, "maputf");
 
--- a/extensions/spellcheck/tests/mochitest/helper_bug1170484.js
+++ b/extensions/spellcheck/tests/mochitest/helper_bug1170484.js
@@ -1,12 +1,14 @@
 const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
+/* eslint-env mozilla/frame-script */
+
 // Chrome scripts are run with synchronous messages, so make sure we're completely
 // decoupled from the content process before doing this work.
 Cu.dispatch(function() {
   let chromeWin = Services.ww.activeWindow;
-  contextMenu = chromeWin.document.getElementById("contentAreaContextMenu");
+  let contextMenu = chromeWin.document.getElementById("contentAreaContextMenu");
   var suggestion = contextMenu.querySelector(".spell-suggestion");
   suggestion.doCommand();
   contextMenu.hidePopup();
   sendAsyncMessage("spellingCorrected");
 });
--- a/extensions/spellcheck/tests/mochitest/test_bug1170484.html
+++ b/extensions/spellcheck/tests/mochitest/test_bug1170484.html
@@ -9,16 +9,17 @@ https://bugzilla.mozilla.org/show_bug.cg
   <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <script src="/tests/SimpleTest/EventUtils.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
   <script type="application/javascript">
 
   /** Test for Bug 1170484 **/
   SimpleTest.waitForExplicitFinish();
 
+  /* global onSpellCheck */
   SpecialPowers.Cu.import(
     "resource://testing-common/AsyncSpellCheckTestHelper.jsm", window);
 
   SimpleTest.waitForFocus(doTest, window);
   function doTest() {
     var mutations = 0;
     var observer = new MutationObserver(() => { mutations++; });
     observer.observe($('area'), { childList: true, characterData: true, characterDataOldValue: true, subtree: true });
--- a/extensions/spellcheck/tests/mochitest/test_bug1272623.html
+++ b/extensions/spellcheck/tests/mochitest/test_bug1272623.html
@@ -18,43 +18,46 @@ https://bugzilla.mozilla.org/show_bug.cg
 
 </div>
 <pre id="test">
   <div id="area" contenteditable="true"><b style="font-weight:normal;">testing <span id="misspelled">spellechek</span></b></div>
   <div id="area2" contenteditable="true">testing <span id="misspelled2" style="font-weight:bold;">spellechek</span></div>
 </pre>
 <script>
 
+/* eslint-env mozilla/frame-script */
+
 /** Test for Bug 1272623 **/
 
   async function performCorrection(misspelled, area) {
     synthesizeMouseAtCenter($(misspelled), {}, window);
     await new Promise(resolve => onSpellCheck($(area), resolve));
     synthesizeMouseAtCenter($(misspelled), {type: 'contextmenu'}, window);
 
     // Perform the spelling correction
     let mm = SpecialPowers.loadChromeScript(function() {
       const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
 
       // Chrome scripts are run with synchronous messages, so make sure we're completely
       // decoupled from the content process before doing this work.
       Cu.dispatch(function() {
         let chromeWin = Services.ww.activeWindow;
-        contextMenu = chromeWin.document.getElementById("contentAreaContextMenu");
+        let contextMenu = chromeWin.document.getElementById("contentAreaContextMenu");
         let suggestion = contextMenu.querySelector(".spell-suggestion");
         suggestion.doCommand();
         contextMenu.hidePopup();
         sendAsyncMessage("spellingCorrected");
       });
     });
     info("Loaded chrome script");
     await new Promise(resolve => mm.addMessageListener('spellingCorrected', resolve));
   }
 
   add_task(async function() {
+    /* global onSpellCheck */
     SpecialPowers.Cu.import(
       "resource://testing-common/AsyncSpellCheckTestHelper.jsm", window);
 
     // Wait for the page to be ready
     await new Promise(resolve => SimpleTest.waitForFocus(() => SimpleTest.executeSoon(resolve), window));
 
     // Check that <b> tags aren't inserted inside of other <b> tags when it would change the style
     await performCorrection('misspelled', 'area');
--- a/extensions/universalchardet/tests/CharsetDetectionTests.js
+++ b/extensions/universalchardet/tests/CharsetDetectionTests.js
@@ -1,10 +1,12 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 4 -*- */
 /* vim: set ts=8 et sw=4 tw=80: */
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+
 var gExpectedCharset;
 var gOldPref;
 var gDetectorList;
 var gTestIndex;
 var gLocalDir;
 
 function CharsetDetectionTests(aTestFile, aExpectedCharset, aDetectorList) {
   gExpectedCharset = aExpectedCharset;
@@ -14,28 +16,19 @@ function CharsetDetectionTests(aTestFile
 
   var fileURI = gLocalDir + aTestFile;
   $("testframe").src = fileURI;
 
   SimpleTest.waitForExplicitFinish();
 }
 
 function InitDetectorTests() {
-  var prefService = Cc["@mozilla.org/preferences-service;1"].getService(
-    Ci.nsIPrefBranch
-  );
-  var str = Cc["@mozilla.org/supports-string;1"].createInstance(
-    Ci.nsISupportsString
-  );
-  var loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(
-    Ci.mozIJSSubScriptLoader
-  );
-  var ioService = Cc["@mozilla.org/network/io-service;1"].getService(
-    Ci.nsIIOService
-  );
+  var prefService = Services.prefs;
+  var loader = Services.scriptloader;
+  var ioService = Services.io;
   loader.loadSubScript("chrome://mochikit/content/chrome-harness.js");
 
   try {
     gOldPref = prefService.getComplexValue(
       "intl.charset.detector",
       Ci.nsIPrefLocalizedString
     ).data;
   } catch (e) {
@@ -63,22 +56,19 @@ function InitDetectorTests() {
 
 function SetDetectorPref(aPrefValue) {
   var fallback = "";
   if (aPrefValue == "ja_parallel_state_machine") {
     fallback = "Shift_JIS";
   } else if (aPrefValue == "ruprob" || aPrefValue == "ukprob") {
     fallback = "windows-1251";
   }
-  var prefService = Cc["@mozilla.org/preferences-service;1"].getService(
-    Ci.nsIPrefBranch
-  );
+  var prefService = Services.prefs;
   prefService.setStringPref("intl.charset.detector", aPrefValue);
   prefService.setStringPref("intl.charset.fallback.override", fallback);
-  gCurrentDetector = aPrefValue;
 }
 
 function DoDetectionTest() {
   var iframeDoc = $("testframe").contentDocument;
   var charset = iframeDoc.characterSet;
 
   is(
     charset,
--- a/extensions/universalchardet/tests/test_bug431054.html
+++ b/extensions/universalchardet/tests/test_bug431054.html
@@ -1,34 +1,34 @@
 <!DOCTYPE HTML>
 <html>
 <!--
 https://bugzilla.mozilla.org/show_bug.cgi?id=431054
 -->
 <head>
   <title>Test for Bug 431054</title>
-  <script type="text/javascript" 
+  <script type="text/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
           </script>
   <script type="text/javascript" src="CharsetDetectionTests.js"></script>
-  <link rel="stylesheet" type="text/css" 
+  <link rel="stylesheet" type="text/css"
         href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 </head>
 <body>
 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=426271">Mozilla Bug 431054</a>
 <p id="display"></p>
-<div id="content" style="display: none">  
+<div id="content" style="display: none">
 </div>
 <iframe id="testframe"></iframe>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 /** Test for Bug 431054 **/
 CharsetDetectionTests("bug431054_text.html",
-		      "windows-1252",
-		      new Array("zhtw_parallel_state_machine",
-				"zhcn_parallel_state_machine",
-				"zh_parallel_state_machine",
-				"cjk_parallel_state_machine",
-				"universal_charset_detector"));
+                      "windows-1252",
+                      ["zhtw_parallel_state_machine",
+                      	"zhcn_parallel_state_machine",
+                      	"zh_parallel_state_machine",
+                      	"cjk_parallel_state_machine",
+                      	"universal_charset_detector"]);
 </script>
 </pre>
 </body>
 </html>
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/configs/chrome-test.js
@@ -6,16 +6,21 @@ module.exports = {
     browser: true,
     "mozilla/browser-window": true,
   },
 
   // All globals made available in the test environment.
   globals: {
     // SpecialPowers is injected into the window object via SimpleTest.js
     SpecialPowers: false,
+    extractJarToTmp: false,
+    getChromeDir: false,
+    getJar: false,
+    getResolvedURI: false,
+    getRootDirectory: false,
   },
 
   overrides: [
     {
       env: {
         // Ideally we wouldn't be using the simpletest env here, but our uses of
         // js files mean we pick up everything from the global scope, which could
         // be any one of a number of html files. So we just allow the basics...