Bug 1329614 - [eslint] Catch more cases of importing globals from 'var foo = Cu.import('...');'. r=jaws
authorMark Banner <standard8@mozilla.com>
Mon, 09 Jan 2017 10:12:26 +0000
changeset 328752 bd9a337129ad8c50f25a44618e0dd2db9d58c457
parent 328751 1ce407daf24336e921c07c795ea207c48f901fd4
child 328753 edcbb6e741c92b72fef23da2ba6b989e77b60012
push id35885
push usermbanner@mozilla.com
push dateTue, 10 Jan 2017 18:58:38 +0000
treeherderautoland@bd9a337129ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1329614
milestone53.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 1329614 - [eslint] Catch more cases of importing globals from 'var foo = Cu.import('...');'. r=jaws MozReview-Commit-ID: 5NKHHb70YA6
b2g/chrome/content/test/mochitest/RecordingStatusChromeScript.js
b2g/components/test/mochitest/permission_handler_chrome.js
b2g/components/test/mochitest/presentation_prompt_handler_chrome.js
b2g/components/test/mochitest/presentation_ui_glue_handler_chrome.js
b2g/components/test/mochitest/screenshot_helper.js
b2g/components/test/mochitest/systemapp_helper.js
b2g/components/test/unit/test_fxaccounts.js
browser/base/content/test/general/browser_bug553455.js
browser/components/extensions/test/browser/head.js
browser/components/migration/tests/unit/test_Edge_db_migration.js
browser/components/migration/tests/unit/test_automigration.js
browser/components/newtab/PreviewProvider.jsm
browser/components/translation/test/unit/test_cld2.js
browser/experiments/test/xpcshell/test_cacherace.js
browser/experiments/test/xpcshell/test_telemetry.js
mobile/android/components/FxAccountsPush.js
services/common/blocklist-clients.js
services/common/kinto-offline-client.js
services/common/kinto-storage-adapter.js
services/common/tests/unit/test_blocklist_certificates.js
services/common/tests/unit/test_blocklist_clients.js
services/common/tests/unit/test_blocklist_pinning.js
services/common/tests/unit/test_blocklist_signatures.js
services/common/tests/unit/test_blocklist_updater.js
services/fxaccounts/tests/xpcshell/test_web_channel.js
services/sync/tests/unit/test_bookmark_tracker.js
toolkit/components/aboutperformance/content/aboutPerformance.js
toolkit/components/extensions/ExtensionStorageSync.jsm
toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html
toolkit/components/extensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html
toolkit/components/extensions/test/xpcshell/head_native_messaging.js
toolkit/components/extensions/test/xpcshell/test_ext_experiments.js
toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_context.js
toolkit/components/extensions/test/xpcshell/test_ext_storage_sync.js
toolkit/components/extensions/test/xpcshell/test_native_messaging.js
toolkit/components/passwordmgr/test/unit/test_getFormFields.js
toolkit/components/passwordmgr/test/unit/test_getPasswordFields.js
toolkit/components/passwordmgr/test/unit/test_getPasswordOrigin.js
toolkit/components/places/tests/unit/test_sync_utils.js
toolkit/components/telemetry/tests/unit/head.js
toolkit/components/telemetry/tests/unit/test_PingAPI.js
toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
toolkit/content/globalOverlay.js
toolkit/modules/InlineSpellCheckerContent.jsm
toolkit/modules/SelectParentHelper.jsm
toolkit/modules/subprocess/test/xpcshell/test_subprocess.js
toolkit/modules/tests/xpcshell/test_CanonicalJSON.js
toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
toolkit/modules/tests/xpcshell/test_Promise.js
toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
toolkit/mozapps/extensions/test/xpcshell/test_XPIStates.js
toolkit/mozapps/extensions/test/xpcshell/test_XPIcancel.js
toolkit/mozapps/extensions/test/xpcshell/test_asyncBlocklistLoad.js
toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js
toolkit/mozapps/extensions/test/xpcshell/test_pluginchange.js
toolkit/mozapps/extensions/test/xpcshell/test_signed_updatepref.js
toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js
toolkit/mozapps/extensions/test/xpcshell/test_webextension_embedded.js
toolkit/xre/test/.eslintrc.js
tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-import-into-var-and-global.js
tools/lint/eslint/eslint-plugin-mozilla/package.json
tools/lint/eslint/modules.json
--- a/b2g/chrome/content/test/mochitest/RecordingStatusChromeScript.js
+++ b/b2g/chrome/content/test/mochitest/RecordingStatusChromeScript.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
-const { Services } = Cu.import('resource://gre/modules/Services.jsm');
-const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm');
+const { Services } = Cu.import('resource://gre/modules/Services.jsm', {});
+const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm', {});
 
 var processId;
 
 function peekChildId(aSubject, aTopic, aData) {
   Services.obs.removeObserver(peekChildId, 'recording-device-events');
   Services.obs.removeObserver(peekChildId, 'recording-device-ipc-events');
   let props = aSubject.QueryInterface(Ci.nsIPropertyBag2);
   if (props.hasKey('childID')) {
--- a/b2g/components/test/mochitest/permission_handler_chrome.js
+++ b/b2g/components/test/mochitest/permission_handler_chrome.js
@@ -7,18 +7,18 @@
 function debug(str) {
   dump("CHROME PERMISSON HANDLER -- " + str + "\n");
 }
 
 var Cc = Components.classes;
 var Ci = Components.interfaces;
 var Cu = Components.utils;
 
-const { Services } = Cu.import("resource://gre/modules/Services.jsm");
-const { SystemAppProxy } = Cu.import("resource://gre/modules/SystemAppProxy.jsm");
+const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
+const { SystemAppProxy } = Cu.import("resource://gre/modules/SystemAppProxy.jsm", {});
 
 var eventHandler = function(evt) {
   if (!evt.detail || evt.detail.type !== "permission-prompt") {
     return;
   }
 
   sendAsyncMessage("permission-request", evt.detail);
 };
@@ -28,9 +28,8 @@ SystemAppProxy.addEventListener("mozChro
 // need to remove ChromeEvent listener after test finished.
 addMessageListener("teardown", function() {
   SystemAppProxy.removeEventListener("mozChromeEvent", eventHandler);
 });
 
 addMessageListener("permission-response", function(detail) {
   SystemAppProxy._sendCustomEvent('mozContentEvent', detail);
 });
-
--- a/b2g/components/test/mochitest/presentation_prompt_handler_chrome.js
+++ b/b2g/components/test/mochitest/presentation_prompt_handler_chrome.js
@@ -4,18 +4,18 @@
 
 'use strict';
 
  function debug(str) {
    dump('presentation_prompt_handler_chrome: ' + str + '\n');
  }
 
 var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-const { XPCOMUtils } = Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm');
+const { XPCOMUtils } = Cu.import('resource://gre/modules/XPCOMUtils.jsm', {});
+const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm', {});
 
 const manager = Cc["@mozilla.org/presentation-device/manager;1"]
                   .getService(Ci.nsIPresentationDeviceManager);
 
 const prompt = Cc['@mozilla.org/presentation-device/prompt;1']
                  .getService(Ci.nsIPresentationDevicePrompt);
 
 function TestPresentationDevice(options) {
@@ -86,9 +86,8 @@ addMessageListener('teardown', function(
 addMessageListener('trigger-device-prompt', function(request_options) {
   let request = new TestPresentationRequest(request_options);
   prompt.promptDeviceSelection(request);
 });
 
 addMessageListener('presentation-select-response', function(detail) {
   SystemAppProxy._sendCustomEvent('mozContentEvent', detail);
 });
-
--- a/b2g/components/test/mochitest/presentation_ui_glue_handler_chrome.js
+++ b/b2g/components/test/mochitest/presentation_ui_glue_handler_chrome.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 'use strict';
 
 var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-const { XPCOMUtils } = Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm');
+const { XPCOMUtils } = Cu.import('resource://gre/modules/XPCOMUtils.jsm', {});
+const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm', {});
 
 const glue = Cc["@mozilla.org/presentation/requestuiglue;1"]
              .createInstance(Ci.nsIPresentationRequestUIGlue);
 
 SystemAppProxy.addEventListener('mozPresentationChromeEvent', function(aEvent) {
   if (!aEvent.detail || aEvent.detail.type !== 'presentation-launch-receiver') {
     return;
   }
--- a/b2g/components/test/mochitest/screenshot_helper.js
+++ b/b2g/components/test/mochitest/screenshot_helper.js
@@ -1,14 +1,14 @@
 var Cu = Components.utils;
 var Ci = Components.interfaces;
 
 Cu.importGlobalProperties(['File']);
 
-const { Services } = Cu.import("resource://gre/modules/Services.jsm");
+const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 
 // Load a duplicated copy of the jsm to prevent messing with the currently running one
 var scope = {};
 Services.scriptloader.loadSubScript("resource://gre/modules/Screenshot.jsm", scope);
 const { Screenshot } = scope;
 
 var index = -1;
 function next() {
--- a/b2g/components/test/mochitest/systemapp_helper.js
+++ b/b2g/components/test/mochitest/systemapp_helper.js
@@ -1,11 +1,11 @@
 var Cu = Components.utils;
 
-const { Services } = Cu.import("resource://gre/modules/Services.jsm");
+const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 
 // Load a duplicated copy of the jsm to prevent messing with the currently running one
 var scope = {};
 Services.scriptloader.loadSubScript("resource://gre/modules/SystemAppProxy.jsm", scope);
 const { SystemAppProxy } = scope;
 
 var frame;
 var customEventTarget;
--- a/b2g/components/test/unit/test_fxaccounts.js
+++ b/b2g/components/test/unit/test_fxaccounts.js
@@ -14,17 +14,17 @@ XPCOMUtils.defineLazyModuleGetter(this, 
   "resource://gre/modules/FxAccountsMgmtService.jsm",
   "FxAccountsMgmtService");
 
 XPCOMUtils.defineLazyModuleGetter(this, "FxAccountsManager",
   "resource://gre/modules/FxAccountsManager.jsm");
 
 // At end of test, restore original state
 const ORIGINAL_AUTH_URI = Services.prefs.getCharPref("identity.fxaccounts.auth.uri");
-var { SystemAppProxy } = Cu.import("resource://gre/modules/FxAccountsMgmtService.jsm");
+var { SystemAppProxy } = Cu.import("resource://gre/modules/FxAccountsMgmtService.jsm", {});
 const ORIGINAL_SENDCUSTOM = SystemAppProxy._sendCustomEvent;
 do_register_cleanup(function() {
   Services.prefs.setCharPref("identity.fxaccounts.auth.uri", ORIGINAL_AUTH_URI);
   SystemAppProxy._sendCustomEvent = ORIGINAL_SENDCUSTOM;
   Services.prefs.clearUserPref("identity.fxaccounts.skipDeviceRegistration");
 });
 
 // Make profile available so that fxaccounts can store user data
@@ -203,10 +203,8 @@ function httpd_setup (handlers, port=-1)
   }
 
   // Set the base URI for convenience.
   let i = server.identity;
   server.baseURI = i.primaryScheme + "://" + i.primaryHost + ":" + i.primaryPort;
 
   return server;
 }
-
-
--- a/browser/base/content/test/general/browser_bug553455.js
+++ b/browser/base/content/test/general/browser_bug553455.js
@@ -5,17 +5,17 @@
 const TESTROOT = "http://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
 const TESTROOT2 = "http://example.org/browser/toolkit/mozapps/extensions/test/xpinstall/";
 const SECUREROOT = "https://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/";
 const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
 const PREF_INSTALL_REQUIREBUILTINCERTS = "extensions.install.requireBuiltInCerts";
 const PROGRESS_NOTIFICATION = "addon-progress";
 
 const { REQUIRE_SIGNING } = Cu.import("resource://gre/modules/addons/AddonConstants.jsm", {});
-const { Task } = Cu.import("resource://gre/modules/Task.jsm");
+const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 
 var rootDir = getRootDirectory(gTestPath);
 var rootPath = rootDir.split('/');
 var chromeName = rootPath[0] + '//' + rootPath[2];
 var croot = chromeName + "/content/browser/toolkit/mozapps/extensions/test/xpinstall/";
 var jar = getJar(croot);
 if (jar) {
   var tmpdir = extractJarToTmp(jar);
--- a/browser/components/extensions/test/browser/head.js
+++ b/browser/components/extensions/test/browser/head.js
@@ -12,18 +12,18 @@
  *          openExtensionContextMenu closeExtensionContextMenu
  *          openActionContextMenu openSubmenu closeActionContextMenu
  *          openTabContextMenu closeTabContextMenu
  *          imageBuffer getListStyleImage getPanelForNode
  *          awaitExtensionPanel awaitPopupResize
  *          promiseContentDimensions alterContent
  */
 
-const {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm");
-const {CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm");
+const {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm", {});
+const {CustomizableUI} = Cu.import("resource:///modules/CustomizableUI.jsm", {});
 
 // We run tests under two different configurations, from browser.ini and
 // browser-remote.ini. When running from browser-remote.ini, the tests are
 // copied to the sub-directory "test-oop-extensions", which we detect here, and
 // use to select our configuration.
 if (gTestPath.includes("test-oop-extensions")) {
   SpecialPowers.pushPrefEnv({set: [
     ["dom.ipc.processCount", 1],
--- a/browser/components/migration/tests/unit/test_Edge_db_migration.js
+++ b/browser/components/migration/tests/unit/test_Edge_db_migration.js
@@ -1,13 +1,13 @@
 "use strict";
 
 Cu.import("resource://gre/modules/ctypes.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-let eseBackStage = Cu.import("resource:///modules/ESEDBReader.jsm");
+let eseBackStage = Cu.import("resource:///modules/ESEDBReader.jsm", {});
 let ESE = eseBackStage.ESE;
 let KERNEL = eseBackStage.KERNEL;
 let gLibs = eseBackStage.gLibs;
 let COLUMN_TYPES = eseBackStage.COLUMN_TYPES;
 let declareESEFunction = eseBackStage.declareESEFunction;
 let loadLibraries = eseBackStage.loadLibraries;
 
 let gESEInstanceCounter = 1;
@@ -463,9 +463,8 @@ add_task(function*() {
       Assert.equal(bookmark.title, importParentFolderName, "Only the extra layer of folders isn't in the input we stuck in the DB.");
       Assert.ok([menuParentGuid, toolbarParentGuid].includes(bookmark.itemGuid), "This item should be one of the containers");
     } else {
       Assert.equal(dbItem.URL || null, bookmark.url && bookmark.url.spec, "URL is correct");
       Assert.equal(dbItem.DateUpdated.valueOf(), (new Date(bookmark.dateAdded / 1000)).valueOf(), "Date added is correct");
     }
   }
 });
-
--- a/browser/components/migration/tests/unit/test_automigration.js
+++ b/browser/components/migration/tests/unit/test_automigration.js
@@ -1,21 +1,23 @@
 "use strict";
 
-let AutoMigrateBackstage = Cu.import("resource:///modules/AutoMigrate.jsm"); /* globals AutoMigrate */
+Cu.import("resource:///modules/AutoMigrate.jsm", this);
 
 let gShimmedMigratorKeyPicker = null;
 let gShimmedMigrator = null;
 
 const kUsecPerMin = 60 * 1000000;
 
 // This is really a proxy on MigrationUtils, but if we specify that directly,
 // we get in trouble because the object itself is frozen, and Proxies can't
 // return a different value to an object when directly proxying a frozen
 // object.
+let AutoMigrateBackstage = Cu.import("resource:///modules/AutoMigrate.jsm", {});
+
 AutoMigrateBackstage.MigrationUtils = new Proxy({}, {
   get(target, name) {
     if (name == "getMigratorKeyForDefaultBrowser" && gShimmedMigratorKeyPicker) {
       return gShimmedMigratorKeyPicker;
     }
     if (name == "getMigrator" && gShimmedMigrator) {
       return function() { return gShimmedMigrator };
     }
@@ -603,9 +605,8 @@ add_task(function* checkUndoVisitsState(
   Assert.equal(yield visitsForURL("http://www.mozilla.org/"), 0,
                "0 mozilla.org visits should have persisted (out of 1).");
   Assert.equal(yield visitsForURL("http://www.example.org/"), 2,
                "2 example.org visits should have persisted (out of 4).");
   Assert.equal(yield visitsForURL("http://www.unrelated.org/"), 1,
                "1 unrelated.org visits should have persisted as it's not involved in the import.");
   yield PlacesTestUtils.clearHistory();
 });
-
--- a/browser/components/newtab/PreviewProvider.jsm
+++ b/browser/components/newtab/PreviewProvider.jsm
@@ -5,17 +5,17 @@
 
 this.EXPORTED_SYMBOLS = ["PreviewProvider"];
 
 const {utils: Cu} = Components;
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/PageThumbs.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
-const {OS} = Cu.import("resource://gre/modules/osfile.jsm");
+const {OS} = Cu.import("resource://gre/modules/osfile.jsm", {});
 
 XPCOMUtils.defineLazyModuleGetter(this, "BackgroundPageThumbs",
   "resource://gre/modules/BackgroundPageThumbs.jsm");
 XPCOMUtils.defineLazyServiceGetter(this, "MIMEService",
   "@mozilla.org/mime;1", "nsIMIMEService");
 
 let PreviewProvider = {
   /**
--- a/browser/components/translation/test/unit/test_cld2.js
+++ b/browser/components/translation/test/unit/test_cld2.js
@@ -368,17 +368,18 @@ const kTestPairs = [
   ["fr", "FRENCH", kTeststr_fr_en_Latn, [false, 80, "en", 32]],
 
 // Cross-check the main quadgram table build date
 // Change the expected language each time it is rebuilt
   ["az", "AZERBAIJANI", kTeststr_version]   // 2014.01.31
 ];
 
 Components.utils.import("resource://gre/modules/Timer.jsm");
-let detectorModule = Components.utils.import("resource:///modules/translation/LanguageDetector.jsm");
+let detectorModule = Components.utils.import("resource:///modules/translation/LanguageDetector.jsm", {});
+const LanguageDetector = detectorModule.LanguageDetector;
 
 function check_result(result, langCode, expected) {
   equal(result.language, langCode, "Expected language code");
 
   // Round percentage up to the nearest 5%, since most strings are
   // detected at slightly less than 100%, and we don't want to
   // encode each exact value.
   let percent = result.languages[0].percent;
--- a/browser/experiments/test/xpcshell/test_cacherace.js
+++ b/browser/experiments/test/xpcshell/test_cacherace.js
@@ -42,17 +42,17 @@ add_task(function* test_setup() {
   do_register_cleanup(() => gHttpServer.stop(() => {}));
 
   Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
   Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
   Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
   Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
   Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
 
-  let ExperimentsScope = Cu.import("resource:///modules/experiments/Experiments.jsm");
+  let ExperimentsScope = Cu.import("resource:///modules/experiments/Experiments.jsm", {});
   let Experiments = ExperimentsScope.Experiments;
 
   gPolicy = new Experiments.Policy();
   patchPolicy(gPolicy, {
     updatechannel: () => "nightly",
     delayCacheWrite: (promise) => {
       return new Promise((resolve, reject) => {
         promise.then(
--- a/browser/experiments/test/xpcshell/test_telemetry.js
+++ b/browser/experiments/test/xpcshell/test_telemetry.js
@@ -1,32 +1,32 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 Cu.import("resource://testing-common/httpd.js");
 Cu.import("resource://gre/modules/TelemetryLog.jsm");
-var bsp = Cu.import("resource:///modules/experiments/Experiments.jsm");
+var {TELEMETRY_LOG, Experiments} = Cu.import("resource:///modules/experiments/Experiments.jsm", {});
 
 
 const MANIFEST_HANDLER         = "manifests/handler";
 
 const SEC_IN_ONE_DAY  = 24 * 60 * 60;
 const MS_IN_ONE_DAY   = SEC_IN_ONE_DAY * 1000;
 
 
 var gHttpServer          = null;
 var gHttpRoot            = null;
 var gDataRoot            = null;
 var gPolicy              = null;
 var gManifestObject      = null;
 var gManifestHandlerURI  = null;
 
-const TLOG = bsp.TELEMETRY_LOG;
+const TLOG = TELEMETRY_LOG;
 
 function checkEvent(event, id, data) {
   do_print("Checking message " + id);
   Assert.equal(event[0], id, "id should match");
   Assert.ok(event[1] > 0, "timestamp should be greater than 0");
 
   if (data === undefined) {
    Assert.equal(event.length, 2, "event array should have 2 entries");
--- a/mobile/android/components/FxAccountsPush.js
+++ b/mobile/android/components/FxAccountsPush.js
@@ -8,17 +8,17 @@ const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Messaging.jsm");
 const {
   PushCrypto,
   getCryptoParams,
-} = Cu.import("resource://gre/modules/PushCrypto.jsm");
+} = Cu.import("resource://gre/modules/PushCrypto.jsm", {});
 
 XPCOMUtils.defineLazyServiceGetter(this, "PushService",
   "@mozilla.org/push/Service;1", "nsIPushService");
 XPCOMUtils.defineLazyGetter(this, "_decoder", () => new TextDecoder());
 
 const FXA_PUSH_SCOPE = "chrome://fxa-push";
 const Log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("FxAccountsPush");
 
--- a/services/common/blocklist-clients.js
+++ b/services/common/blocklist-clients.js
@@ -11,24 +11,24 @@ this.EXPORTED_SYMBOLS = ["AddonBlocklist
                          "PinningBlocklistClient",
                          "FILENAME_ADDONS_JSON",
                          "FILENAME_GFX_JSON",
                          "FILENAME_PLUGINS_JSON"];
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
-const { Task } = Cu.import("resource://gre/modules/Task.jsm");
-const { OS } = Cu.import("resource://gre/modules/osfile.jsm");
+const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
+const { OS } = Cu.import("resource://gre/modules/osfile.jsm", {});
 Cu.importGlobalProperties(["fetch"]);
 
-const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js");
-const { KintoHttpClient } = Cu.import("resource://services-common/kinto-http-client.js");
-const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js");
-const { CanonicalJSON } = Components.utils.import("resource://gre/modules/CanonicalJSON.jsm");
+const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js", {});
+const { KintoHttpClient } = Cu.import("resource://services-common/kinto-http-client.js", {});
+const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js", {});
+const { CanonicalJSON } = Components.utils.import("resource://gre/modules/CanonicalJSON.jsm", {});
 
 const PREF_SETTINGS_SERVER                   = "services.settings.server";
 const PREF_BLOCKLIST_BUCKET                  = "services.blocklist.bucket";
 const PREF_BLOCKLIST_ONECRL_COLLECTION       = "services.blocklist.onecrl.collection";
 const PREF_BLOCKLIST_ONECRL_CHECKED_SECONDS  = "services.blocklist.onecrl.checked";
 const PREF_BLOCKLIST_ADDONS_COLLECTION       = "services.blocklist.addons.collection";
 const PREF_BLOCKLIST_ADDONS_CHECKED_SECONDS  = "services.blocklist.addons.checked";
 const PREF_BLOCKLIST_PLUGINS_COLLECTION      = "services.blocklist.plugins.collection";
--- a/services/common/kinto-offline-client.js
+++ b/services/common/kinto-offline-client.js
@@ -58,17 +58,17 @@ function _interopRequireDefault(obj) { r
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/Timer.jsm");
 Cu.importGlobalProperties(["fetch"]);
 const { EventEmitter } = Cu.import("resource://devtools/shared/event-emitter.js", {});
 const { generateUUID } = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
 
 // Use standalone kinto-http module landed in FFx.
-const { KintoHttpClient } = Cu.import("resource://services-common/kinto-http-client.js");
+const { KintoHttpClient } = Cu.import("resource://services-common/kinto-http-client.js", {});
 
 class Kinto extends _KintoBase2.default {
   constructor(options = {}) {
     const events = {};
     EventEmitter.decorate(events);
 
     const defaults = {
       events,
@@ -2441,9 +2441,9 @@ function omitKeys(obj, keys = []) {
     if (keys.indexOf(key) === -1) {
       acc[key] = obj[key];
     }
     return acc;
   }, {});
 }
 
 },{}]},{},[1])(1)
-});
\ No newline at end of file
+});
--- a/services/common/kinto-storage-adapter.js
+++ b/services/common/kinto-storage-adapter.js
@@ -7,19 +7,19 @@
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 const { utils: Cu } = Components;
-const { Sqlite } = Cu.import("resource://gre/modules/Sqlite.jsm");
-const { Task } = Cu.import("resource://gre/modules/Task.jsm");
-const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js");
+const { Sqlite } = Cu.import("resource://gre/modules/Sqlite.jsm", {});
+const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
+const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js", {});
 
 const SQLITE_PATH = "kinto.sqlite";
 
 /**
  * Filter and sort list against provided filters and order.
  *
  * @param  {Object} filters  The filters to apply.
  * @param  {String} order    The order to apply.
--- a/services/common/tests/unit/test_blocklist_certificates.js
+++ b/services/common/tests/unit/test_blocklist_certificates.js
@@ -1,15 +1,15 @@
 const { Constructor: CC } = Components;
 
 Cu.import("resource://testing-common/httpd.js");
 
-const { OneCRLBlocklistClient } = Cu.import("resource://services-common/blocklist-clients.js");
-const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js");
-const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js");
+const { OneCRLBlocklistClient } = Cu.import("resource://services-common/blocklist-clients.js", {});
+const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js", {});
+const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js", {});
 
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
   "nsIBinaryInputStream", "setInputStream");
 
 let server;
 
 // set up what we need to make storage adapters
 const kintoFilename = "kinto.sqlite";
--- a/services/common/tests/unit/test_blocklist_clients.js
+++ b/services/common/tests/unit/test_blocklist_clients.js
@@ -1,21 +1,21 @@
 const { Constructor: CC } = Components;
 
 const KEY_PROFILEDIR = "ProfD";
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://testing-common/httpd.js");
 Cu.import("resource://gre/modules/Timer.jsm");
-const { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm");
-const { OS } = Cu.import("resource://gre/modules/osfile.jsm");
+const { FileUtils } = Cu.import("resource://gre/modules/FileUtils.jsm", {});
+const { OS } = Cu.import("resource://gre/modules/osfile.jsm", {});
 
-const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js");
-const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js");
-const BlocklistClients = Cu.import("resource://services-common/blocklist-clients.js");
+const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js", {});
+const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js", {});
+const BlocklistClients = Cu.import("resource://services-common/blocklist-clients.js", {});
 
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
   "nsIBinaryInputStream", "setInputStream");
 const kintoFilename = "kinto.sqlite";
 
 const gBlocklistClients = [
   {client: BlocklistClients.AddonBlocklistClient, filename: BlocklistClients.FILENAME_ADDONS_JSON, testData: ["i808","i720", "i539"]},
   {client: BlocklistClients.PluginBlocklistClient, filename: BlocklistClients.FILENAME_PLUGINS_JSON, testData: ["p1044","p32","p28"]},
--- a/services/common/tests/unit/test_blocklist_pinning.js
+++ b/services/common/tests/unit/test_blocklist_pinning.js
@@ -1,16 +1,16 @@
 "use strict"
 
 const { Constructor: CC } = Components;
 
 Cu.import("resource://testing-common/httpd.js");
 
-const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js");
-const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js");
+const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js", {});
+const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js", {});
 
 const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
   "nsIBinaryInputStream", "setInputStream");
 
 const PREF_BLOCKLIST_PINNING_COLLECTION = "services.blocklist.pinning.collection";
 const COLLECTION_NAME = "pins";
 const KINTO_STORAGE_PATH    = "kinto.sqlite";
 
@@ -50,17 +50,17 @@ function do_get_kinto_collection(connect
 // Some simple tests to demonstrate that the core preload sync operations work
 // correctly and that simple kinto operations are working as expected.
 add_task(function* test_something(){
   // set the collection name explicitly - since there will be version
   // specific collection names in prefs
   Services.prefs.setCharPref(PREF_BLOCKLIST_PINNING_COLLECTION,
                              COLLECTION_NAME);
 
-  const { PinningPreloadClient } = Cu.import("resource://services-common/blocklist-clients.js");
+  const { PinningPreloadClient } = Cu.import("resource://services-common/blocklist-clients.js", {});
 
   const configPath = "/v1/";
   const recordsPath = "/v1/buckets/pinning/collections/pins/records";
 
   Services.prefs.setCharPref("services.settings.server",
                              `http://localhost:${server.identity.primaryPort}/v1`);
 
   // register a handler
--- a/services/common/tests/unit/test_blocklist_signatures.js
+++ b/services/common/tests/unit/test_blocklist_signatures.js
@@ -1,17 +1,17 @@
 "use strict";
 
 Cu.import("resource://services-common/blocklist-updater.js");
 Cu.import("resource://testing-common/httpd.js");
 
-const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js");
-const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js");
+const { Kinto } = Cu.import("resource://services-common/kinto-offline-client.js", {});
+const { FirefoxAdapter } = Cu.import("resource://services-common/kinto-storage-adapter.js", {});
 const { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {});
-const { OneCRLBlocklistClient } = Cu.import("resource://services-common/blocklist-clients.js");
+const { OneCRLBlocklistClient } = Cu.import("resource://services-common/blocklist-clients.js", {});
 
 let server;
 
 const PREF_BLOCKLIST_BUCKET            = "services.blocklist.bucket";
 const PREF_BLOCKLIST_ENFORCE_SIGNING   = "services.blocklist.signing.enforced";
 const PREF_BLOCKLIST_ONECRL_COLLECTION = "services.blocklist.onecrl.collection";
 const PREF_SETTINGS_SERVER             = "services.settings.server";
 const PREF_SIGNATURE_ROOT              = "security.content.signature.root_hash";
@@ -499,10 +499,8 @@ function run_test() {
   server.start(-1);
 
   run_next_test();
 
   do_register_cleanup(function() {
     server.stop(function() { });
   });
 }
-
-
--- a/services/common/tests/unit/test_blocklist_updater.js
+++ b/services/common/tests/unit/test_blocklist_updater.js
@@ -46,17 +46,17 @@ add_task(function* test_check_maybeSync(
   // set some initial values so we can check these are updated appropriately
   Services.prefs.setIntPref(PREF_LAST_UPDATE, 0);
   Services.prefs.setIntPref(PREF_CLOCK_SKEW_SECONDS, 0);
   Services.prefs.clearUserPref(PREF_LAST_ETAG);
 
 
   let startTime = Date.now();
 
-  let updater = Cu.import("resource://services-common/blocklist-updater.js");
+  let updater = Cu.import("resource://services-common/blocklist-updater.js", {});
 
   let syncPromise = new Promise(function(resolve, reject) {
     // add a test kinto client that will respond to lastModified information
     // for a collection called 'test-collection'
     updater.addTestBlocklistClient("test-collection", {
       bucketName: "blocklists",
       maybeSync(lastModified, serverTime) {
         do_check_eq(lastModified, 1000);
--- a/services/fxaccounts/tests/xpcshell/test_web_channel.js
+++ b/services/fxaccounts/tests/xpcshell/test_web_channel.js
@@ -1,16 +1,16 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 Cu.import("resource://gre/modules/FxAccountsCommon.js");
 const { FxAccountsWebChannel, FxAccountsWebChannelHelpers } =
-    Cu.import("resource://gre/modules/FxAccountsWebChannel.jsm");
+    Cu.import("resource://gre/modules/FxAccountsWebChannel.jsm", {});
 
 const URL_STRING = "https://example.com";
 
 const mockSendingContext = {
   browser: {},
   principal: {},
   eventTarget: {}
 };
--- a/services/sync/tests/unit/test_bookmark_tracker.js
+++ b/services/sync/tests/unit/test_bookmark_tracker.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 Cu.import("resource://gre/modules/PlacesUtils.jsm");
 const {
   // `fetchGuidsWithAnno` isn't exported, but we can still access it here via a
   // backstage pass.
   fetchGuidsWithAnno,
-} = Cu.import("resource://gre/modules/PlacesSyncUtils.jsm");
+} = Cu.import("resource://gre/modules/PlacesSyncUtils.jsm", {});
 Cu.import("resource://gre/modules/PlacesSyncUtils.jsm");
 Cu.import("resource://services-sync/constants.js");
 Cu.import("resource://services-sync/engines/bookmarks.js");
 Cu.import("resource://services-sync/engines.js");
 Cu.import("resource://services-sync/service.js");
 Cu.import("resource://services-sync/util.js");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -9,18 +9,18 @@
 var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 const { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm", {});
 const { AddonWatcher } = Cu.import("resource://gre/modules/AddonWatcher.jsm", {});
 const { PerformanceStats } = Cu.import("resource://gre/modules/PerformanceStats.jsm", {});
 const { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
 const { Task } = Cu.import("resource://gre/modules/Task.jsm", {});
 const { ObjectUtils } = Cu.import("resource://gre/modules/ObjectUtils.jsm", {});
-const { Memory } = Cu.import("resource://gre/modules/Memory.jsm");
-const { DownloadUtils } = Cu.import("resource://gre/modules/DownloadUtils.jsm");
+const { Memory } = Cu.import("resource://gre/modules/Memory.jsm", {});
+const { DownloadUtils } = Cu.import("resource://gre/modules/DownloadUtils.jsm", {});
 
 // about:performance observes notifications on this topic.
 // if a notification is sent, this causes the page to be updated immediately,
 // regardless of whether the page is on pause.
 const TEST_DRIVER_TOPIC = "test-about:performance-test-driver";
 
 // about:performance posts notifications on this topic whenever the page
 // is updated.
--- a/toolkit/components/extensions/ExtensionStorageSync.jsm
+++ b/toolkit/components/extensions/ExtensionStorageSync.jsm
@@ -31,17 +31,17 @@ const FXA_OAUTH_OPTIONS = {
   scope: STORAGE_SYNC_SCOPE,
 };
 // Default is 5sec, which seems a bit aggressive on the open internet
 const KINTO_REQUEST_TIMEOUT = 30000;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 const {
   runSafeSyncWithoutClone,
-} = Cu.import("resource://gre/modules/ExtensionUtils.jsm");
+} = Cu.import("resource://gre/modules/ExtensionUtils.jsm", {});
 
 XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
                                   "resource://gre/modules/AsyncShutdown.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CollectionKeyManager",
                                   "resource://services-sync/record.js");
 XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
                                   "resource://services-common/utils.js");
 XPCOMUtils.defineLazyModuleGetter(this, "CryptoUtils",
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_background_debug_global.html
@@ -14,17 +14,17 @@
 <script type="text/javascript">
 "use strict";
 
 Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm");
 Cu.import("resource://gre/modules/AddonManager.jsm");
 
 const {
   XPIProvider,
-} = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
+} = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
 
 /**
  * This test is asserting that ext-backgroundPage.js successfully sets its
  * debug global in the AddonWrapper provided by XPIProvider.jsm
  *
  * It does _not_ test any functionality in devtools and does not guarantee
  * debugging is actually working correctly end-to-end.
  */
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html
@@ -13,17 +13,17 @@
 <script type="text/javascript">
 "use strict";
 
 const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://testing-common/TestUtils.jsm");
 
-const {GlobalManager} = Cu.import("resource://gre/modules/Extension.jsm");
+const {GlobalManager} = Cu.import("resource://gre/modules/Extension.jsm", {});
 
 /* eslint-disable mozilla/balanced-listeners */
 
 add_task(function* testShutdownCleanup() {
   is(GlobalManager.initialized, false,
      "GlobalManager start as not initialized");
 
   let extension = ExtensionTestUtils.loadExtension({
--- a/toolkit/components/extensions/test/xpcshell/head_native_messaging.js
+++ b/toolkit/components/extensions/test/xpcshell/head_native_messaging.js
@@ -7,17 +7,17 @@
 
 XPCOMUtils.defineLazyModuleGetter(this, "MockRegistry",
                                   "resource://testing-common/MockRegistry.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "OS",
                                   "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
                                   "resource://gre/modules/Timer.jsm");
 
-let {Subprocess, SubprocessImpl} = Cu.import("resource://gre/modules/Subprocess.jsm");
+let {Subprocess, SubprocessImpl} = Cu.import("resource://gre/modules/Subprocess.jsm", {});
 
 
 let tmpDir = FileUtils.getDir("TmpD", ["NativeMessaging"]);
 tmpDir.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
 
 do_register_cleanup(() => {
   tmpDir.remove(true);
 });
--- a/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_experiments.js
@@ -1,17 +1,17 @@
 "use strict";
 
 /* globals browser */
 
 XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
                                   "resource://gre/modules/AddonManager.jsm");
 
 function promiseAddonStartup() {
-  const {Management} = Cu.import("resource://gre/modules/Extension.jsm");
+  const {Management} = Cu.import("resource://gre/modules/Extension.jsm", {});
 
   return new Promise(resolve => {
     let listener = (evt, extension) => {
       Management.off("startup", listener);
       resolve(extension);
     };
 
     Management.on("startup", listener);
@@ -167,9 +167,8 @@ add_task(function* test_experiments_api(
   boringAddon.userDisabled = true;
   yield new Promise(do_execute_soon);
 
   equal(addon.appDisabled, true, "Add-on should be app-disabled after its dependency is removed.");
 
   addon.uninstall();
   boringAddon.uninstall();
 });
-
--- a/toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_context.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_legacy_extension_context.js
@@ -1,16 +1,16 @@
 "use strict";
 
 /* globals browser */
 
 Cu.import("resource://gre/modules/Extension.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
-const {LegacyExtensionContext} = Cu.import("resource://gre/modules/LegacyExtensionsUtils.jsm");
+const {LegacyExtensionContext} = Cu.import("resource://gre/modules/LegacyExtensionsUtils.jsm", {});
 
 /**
  * This test case ensures that LegacyExtensionContext instances:
  *  - expose the expected API object and can join the messaging
  *    of a webextension given its addon id
  *  - the exposed API object can receive a port related to a `runtime.connect`
  *    Port created in the webextension's background page
  *  - the received Port instance can exchange messages with the background page
--- a/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync.js
+++ b/toolkit/components/extensions/test/xpcshell/test_ext_storage_sync.js
@@ -9,17 +9,17 @@ Cu.import("resource://testing-common/htt
 Cu.import("resource://services-common/utils.js");
 Cu.import("resource://gre/modules/ExtensionStorageSync.jsm");
 const {
   CollectionKeyEncryptionRemoteTransformer,
   cryptoCollection,
   idToKey,
   extensionIdToCollectionId,
   keyToId,
-} = Cu.import("resource://gre/modules/ExtensionStorageSync.jsm");
+} = Cu.import("resource://gre/modules/ExtensionStorageSync.jsm", {});
 Cu.import("resource://services-sync/engines/extension-storage.js");
 Cu.import("resource://services-sync/keys.js");
 Cu.import("resource://services-sync/util.js");
 
 /* globals BulkKeyBundle, CommonUtils, EncryptionRemoteTransformer */
 /* globals KeyRingEncryptionRemoteTransformer */
 /* globals Utils */
 
--- a/toolkit/components/extensions/test/xpcshell/test_native_messaging.js
+++ b/toolkit/components/extensions/test/xpcshell/test_native_messaging.js
@@ -2,17 +2,17 @@
 
 /* global OS, HostManifestManager, NativeApp */
 Cu.import("resource://gre/modules/AppConstants.jsm");
 Cu.import("resource://gre/modules/AsyncShutdown.jsm");
 Cu.import("resource://gre/modules/ExtensionCommon.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/Schemas.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-const {Subprocess, SubprocessImpl} = Cu.import("resource://gre/modules/Subprocess.jsm");
+const {Subprocess, SubprocessImpl} = Cu.import("resource://gre/modules/Subprocess.jsm", {});
 Cu.import("resource://gre/modules/NativeMessaging.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
 
 let registry = null;
 if (AppConstants.platform == "win") {
   Cu.import("resource://testing-common/MockRegistry.jsm");
   registry = new MockRegistry();
   do_register_cleanup(() => {
--- a/toolkit/components/passwordmgr/test/unit/test_getFormFields.js
+++ b/toolkit/components/passwordmgr/test/unit/test_getFormFields.js
@@ -3,17 +3,17 @@
  */
 
 "use strict";
 
 // Services.prefs.setBoolPref("signon.debug", true);
 
 Cu.importGlobalProperties(["URL"]);
 
-const LMCBackstagePass = Cu.import("resource://gre/modules/LoginManagerContent.jsm");
+const LMCBackstagePass = Cu.import("resource://gre/modules/LoginManagerContent.jsm", {});
 const { LoginManagerContent, LoginFormFactory } = LMCBackstagePass;
 const TESTCASES = [
   {
     description: "1 password field outside of a <form>",
     document: `<input id="pw1" type=password>`,
     returnedFieldIDs: [null, "pw1", null],
     skipEmptyFields: undefined,
   },
--- a/toolkit/components/passwordmgr/test/unit/test_getPasswordFields.js
+++ b/toolkit/components/passwordmgr/test/unit/test_getPasswordFields.js
@@ -1,15 +1,15 @@
 /*
  * Test for LoginManagerContent._getPasswordFields using LoginFormFactory.
  */
 
 "use strict";
 
-const LMCBackstagePass = Cu.import("resource://gre/modules/LoginManagerContent.jsm");
+const LMCBackstagePass = Cu.import("resource://gre/modules/LoginManagerContent.jsm", {});
 const { LoginManagerContent, LoginFormFactory } = LMCBackstagePass;
 const TESTCASES = [
   {
     description: "Empty document",
     document: ``,
     returnedFieldIDsByFormLike: [],
     skipEmptyFields: undefined,
   },
--- a/toolkit/components/passwordmgr/test/unit/test_getPasswordOrigin.js
+++ b/toolkit/components/passwordmgr/test/unit/test_getPasswordOrigin.js
@@ -1,15 +1,15 @@
 /*
  * Test for LoginUtils._getPasswordOrigin
  */
 
 "use strict";
 
-const LMCBackstagePass = Cu.import("resource://gre/modules/LoginManagerContent.jsm");
+const LMCBackstagePass = Cu.import("resource://gre/modules/LoginManagerContent.jsm", {});
 const TESTCASES = [
   ["javascript:void(0);", null],
   ["javascript:void(0);", "javascript:", true],
   ["chrome://MyAccount", null],
   ["data:text/html,example", null],
   ["http://username:password@example.com:80/foo?bar=baz#fragment", "http://example.com", true],
   ["http://127.0.0.1:80/foo", "http://127.0.0.1"],
   ["http://[::1]:80/foo", "http://[::1]"],
--- a/toolkit/components/places/tests/unit/test_sync_utils.js
+++ b/toolkit/components/places/tests/unit/test_sync_utils.js
@@ -1,15 +1,15 @@
 Cu.import("resource://gre/modules/ObjectUtils.jsm");
 Cu.import("resource://gre/modules/PlacesSyncUtils.jsm");
 const {
   // `fetchGuidsWithAnno` isn't exported, but we can still access it here via a
   // backstage pass.
   fetchGuidsWithAnno,
-} = Cu.import("resource://gre/modules/PlacesSyncUtils.jsm");
+} = Cu.import("resource://gre/modules/PlacesSyncUtils.jsm", {});
 Cu.import("resource://testing-common/httpd.js");
 Cu.importGlobalProperties(["crypto", "URLSearchParams"]);
 
 const DESCRIPTION_ANNO = "bookmarkProperties/description";
 const LOAD_IN_SIDEBAR_ANNO = "bookmarkProperties/loadInSidebar";
 const SYNC_PARENT_ANNO = "sync/parent";
 
 function makeGuid() {
--- a/toolkit/components/telemetry/tests/unit/head.js
+++ b/toolkit/components/telemetry/tests/unit/head.js
@@ -11,16 +11,18 @@ Cu.import("resource://gre/modules/FileUt
 Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
 Cu.import("resource://testing-common/httpd.js", this);
 Cu.import("resource://gre/modules/AppConstants.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "AddonTestUtils",
                                   "resource://testing-common/AddonTestUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "OS",
                                   "resource://gre/modules/osfile.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "TelemetrySend",
+                                  "resource://gre/modules/TelemetrySend.jsm");
 
 const gIsWindows = AppConstants.platform == "win";
 const gIsMac = AppConstants.platform == "macosx";
 const gIsAndroid = AppConstants.platform == "android";
 const gIsGonk = AppConstants.platform == "gonk";
 const gIsLinux = AppConstants.platform == "linux";
 
 const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
@@ -184,17 +186,17 @@ var gAppInfo = null;
 function createAppInfo(ID = "xpcshell@tests.mozilla.org", name = "XPCShell",
                        version = "1.0", platformVersion = "1.0") {
   AddonTestUtils.createAppInfo(ID, name, version, platformVersion);
   gAppInfo = AddonTestUtils.appInfo;
 }
 
 // Fake the timeout functions for the TelemetryScheduler.
 function fakeSchedulerTimer(set, clear) {
-  let session = Cu.import("resource://gre/modules/TelemetrySession.jsm");
+  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
  */
 
@@ -219,41 +221,41 @@ function fakeNow(...args) {
   for (let m of modules) {
     m.Policy.now = () => date;
   }
 
   return new Date(date);
 }
 
 function fakeMonotonicNow(ms) {
-  const m = Cu.import("resource://gre/modules/TelemetrySession.jsm");
+  const m = Cu.import("resource://gre/modules/TelemetrySession.jsm", {});
   m.Policy.monotonicNow = () => ms;
   return ms;
 }
 
 // Fake the timeout functions for TelemetryController sending.
 function fakePingSendTimer(set, clear) {
-  let module = Cu.import("resource://gre/modules/TelemetrySend.jsm");
+  let module = Cu.import("resource://gre/modules/TelemetrySend.jsm", {});
   let obj = Cu.cloneInto({set, clear}, module, {cloneFunctions:true});
   module.Policy.setSchedulerTickTimeout = obj.set;
   module.Policy.clearSchedulerTickTimeout = obj.clear;
 }
 
 function fakeMidnightPingFuzzingDelay(delayMs) {
-  let module = Cu.import("resource://gre/modules/TelemetrySend.jsm");
+  let module = Cu.import("resource://gre/modules/TelemetrySend.jsm", {});
   module.Policy.midnightPingFuzzingDelay = () => delayMs;
 }
 
 function fakeGeneratePingId(func) {
-  let module = Cu.import("resource://gre/modules/TelemetryController.jsm");
+  let module = Cu.import("resource://gre/modules/TelemetryController.jsm", {});
   module.Policy.generatePingId = func;
 }
 
 function fakeCachedClientId(uuid) {
-  let module = Cu.import("resource://gre/modules/TelemetryController.jsm");
+  let module = Cu.import("resource://gre/modules/TelemetryController.jsm", {});
   module.Policy.getCachedClientID = () => uuid;
 }
 
 // Return a date that is |offset| ms in the future from |date|.
 function futureDate(date, offset) {
   return new Date(date.getTime() + offset);
 }
 
--- a/toolkit/components/telemetry/tests/unit/test_PingAPI.js
+++ b/toolkit/components/telemetry/tests/unit/test_PingAPI.js
@@ -18,17 +18,17 @@ XPCOMUtils.defineLazyGetter(this, "gPing
   return OS.Path.join(OS.Constants.Path.profileDir, "datareporting", "archived");
 });
 
 /**
  * Fakes the archive storage quota.
  * @param {Integer} aArchiveQuota The new quota, in bytes.
  */
 function fakeStorageQuota(aArchiveQuota) {
-  let storage = Cu.import("resource://gre/modules/TelemetryStorage.jsm");
+  let storage = Cu.import("resource://gre/modules/TelemetryStorage.jsm", {});
   storage.Policy.getArchiveQuota = () => aArchiveQuota;
 }
 
 /**
  * Lists all the valid archived pings and their metadata, sorted by creation date.
  *
  * @param aFileName {String} The filename.
  * @return {Object[]} A list of objects with the extracted data in the form:
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryReportingPolicy.js
@@ -26,17 +26,17 @@ const PREF_BYPASS_NOTIFICATION = PREF_PO
 const PREF_DATA_SUBMISSION_ENABLED = PREF_POLICY_BRANCH + "dataSubmissionEnabled";
 const PREF_CURRENT_POLICY_VERSION = PREF_POLICY_BRANCH + "currentPolicyVersion";
 const PREF_MINIMUM_POLICY_VERSION = PREF_POLICY_BRANCH + "minimumPolicyVersion";
 const PREF_MINIMUM_CHANNEL_POLICY_VERSION = PREF_MINIMUM_POLICY_VERSION + ".channel-" + TEST_CHANNEL;
 const PREF_ACCEPTED_POLICY_VERSION = PREF_POLICY_BRANCH + "dataSubmissionPolicyAcceptedVersion";
 const PREF_ACCEPTED_POLICY_DATE = PREF_POLICY_BRANCH + "dataSubmissionPolicyNotifiedTime";
 
 function fakeShowPolicyTimeout(set, clear) {
-  let reportingPolicy = Cu.import("resource://gre/modules/TelemetryReportingPolicy.jsm");
+  let reportingPolicy = Cu.import("resource://gre/modules/TelemetryReportingPolicy.jsm", {});
   reportingPolicy.Policy.setShowInfobarTimeout = set;
   reportingPolicy.Policy.clearShowInfobarTimeout = clear;
 }
 
 function fakeResetAcceptedPolicy() {
   Preferences.reset(PREF_ACCEPTED_POLICY_DATE);
   Preferences.reset(PREF_ACCEPTED_POLICY_VERSION);
 }
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySendOldPings.js
@@ -85,17 +85,17 @@ var clearPings = Task.async(function* (a
   }
 });
 
 /**
  * Fakes the pending pings storage quota.
  * @param {Integer} aPendingQuota The new quota, in bytes.
  */
 function fakePendingPingsQuota(aPendingQuota) {
-  let storage = Cu.import("resource://gre/modules/TelemetryStorage.jsm");
+  let storage = Cu.import("resource://gre/modules/TelemetryStorage.jsm", {});
   storage.Policy.getPendingPingsQuota = () => aPendingQuota;
 }
 
 /**
  * Returns a handle for the file that a ping should be
  * stored in locally.
  *
  * @returns path
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -93,23 +93,23 @@ function sendPing() {
     TelemetrySend.setServer("http://localhost:" + PingServer.port);
     return TelemetrySession.testPing();
   }
   TelemetrySend.setServer("http://doesnotexist");
   return TelemetrySession.testPing();
 }
 
 function fakeGenerateUUID(sessionFunc, subsessionFunc) {
-  let session = Cu.import("resource://gre/modules/TelemetrySession.jsm");
+  let session = Cu.import("resource://gre/modules/TelemetrySession.jsm", {});
   session.Policy.generateSessionUUID = sessionFunc;
   session.Policy.generateSubsessionUUID = subsessionFunc;
 }
 
 function fakeIdleNotification(topic) {
-  let session = Cu.import("resource://gre/modules/TelemetrySession.jsm");
+  let session = Cu.import("resource://gre/modules/TelemetrySession.jsm", {});
   return session.TelemetryScheduler.observe(null, topic, null);
 }
 
 function setupTestData() {
 
   Services.startup.interrupted = true;
   Telemetry.registerAddonHistogram(ADDON_NAME, ADDON_HISTOGRAM,
                                    Telemetry.HISTOGRAM_LINEAR,
--- a/toolkit/content/globalOverlay.js
+++ b/toolkit/content/globalOverlay.js
@@ -1,14 +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/. */
 
 function closeWindow(aClose, aPromptFunction) {
-  let { AppConstants } = Components.utils.import("resource://gre/modules/AppConstants.jsm");
+  let { AppConstants } = Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
 
   // Closing the last window doesn't quit the application on OS X.
   if (AppConstants.platform != "macosx") {
     var windowCount = 0;
     var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
                        .getService(Components.interfaces.nsIWindowMediator);
     var e = wm.getEnumerator(null);
 
--- a/toolkit/modules/InlineSpellCheckerContent.jsm
+++ b/toolkit/modules/InlineSpellCheckerContent.jsm
@@ -2,17 +2,18 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
 
-var { SpellCheckHelper } = Cu.import("resource://gre/modules/InlineSpellChecker.jsm");
+var { InlineSpellChecker, SpellCheckHelper } =
+  Cu.import("resource://gre/modules/InlineSpellChecker.jsm", {});
 
 this.EXPORTED_SYMBOLS = [ "InlineSpellCheckerContent" ]
 
 var InlineSpellCheckerContent = {
   _spellChecker: null,
   _manager: null,
 
   initContextMenu(event, editFlags, messageManager) {
--- a/toolkit/modules/SelectParentHelper.jsm
+++ b/toolkit/modules/SelectParentHelper.jsm
@@ -4,17 +4,17 @@
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = [
   "SelectParentHelper"
 ];
 
 const {utils: Cu} = Components;
-const {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm");
+const {AppConstants} = Cu.import("resource://gre/modules/AppConstants.jsm", {});
 
 // Maximum number of rows to display in the select dropdown.
 const MAX_ROWS = 20;
 
 var currentBrowser = null;
 var currentMenulist = null;
 var currentZoom = 1;
 var closedWithEnter = false;
--- a/toolkit/modules/subprocess/test/xpcshell/test_subprocess.js
+++ b/toolkit/modules/subprocess/test/xpcshell/test_subprocess.js
@@ -455,17 +455,17 @@ add_task(function* test_subprocess_inval
   let {exitCode} = yield proc.wait();
 
   equal(exitCode, 0, "Got expected exit code");
 });
 
 
 if (AppConstants.isPlatformAndVersionAtLeast("win", "6")) {
   add_task(function* test_subprocess_inherited_descriptors() {
-    let {ctypes, libc, win32} = Cu.import("resource://gre/modules/subprocess/subprocess_win.jsm");
+    let {ctypes, libc, win32} = Cu.import("resource://gre/modules/subprocess/subprocess_win.jsm", {});
 
     let secAttr = new win32.SECURITY_ATTRIBUTES();
     secAttr.nLength = win32.SECURITY_ATTRIBUTES.size;
     secAttr.bInheritHandle = true;
 
     let handles = win32.createPipe(secAttr, 0);
 
 
@@ -748,17 +748,17 @@ add_task(function* test_bad_executable()
     function(error) {
       return error.errorCode == Subprocess.ERROR_BAD_EXECUTABLE;
     },
     "Subprocess.call should fail for a bad executable");
 });
 
 
 add_task(function* test_cleanup() {
-  let {SubprocessImpl} = Cu.import("resource://gre/modules/Subprocess.jsm");
+  let {SubprocessImpl} = Cu.import("resource://gre/modules/Subprocess.jsm", {});
 
   let worker = SubprocessImpl.Process.getWorker();
 
   let openFiles = yield worker.call("getOpenFiles", []);
   let processes = yield worker.call("getProcesses", []);
 
   equal(openFiles.size, 0, "No remaining open files");
   equal(processes.size, 0, "No remaining processes");
--- a/toolkit/modules/tests/xpcshell/test_CanonicalJSON.js
+++ b/toolkit/modules/tests/xpcshell/test_CanonicalJSON.js
@@ -1,9 +1,9 @@
-const { CanonicalJSON } = Components.utils.import("resource://gre/modules/CanonicalJSON.jsm");
+const { CanonicalJSON } = Components.utils.import("resource://gre/modules/CanonicalJSON.jsm", {});
 
 function stringRepresentation(obj) {
   const clone = JSON.parse(JSON.stringify(obj));
   return JSON.stringify(clone);
 }
 
 add_task(function* test_canonicalJSON_should_preserve_array_order() {
   const input = ['one', 'two', 'three'];
--- a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
+++ b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
@@ -1,25 +1,26 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 var {classes: Cc, interfaces: Ci, results: Cr, utils: Cu, manager: Cm} = Components;
 const URL_HOST = "http://localhost";
 
-var GMPScope = Cu.import("resource://gre/modules/GMPInstallManager.jsm");
+var GMPScope = Cu.import("resource://gre/modules/GMPInstallManager.jsm", {});
+var GMPInstallManager = GMPScope.GMPInstallManager;
+
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://testing-common/httpd.js");
 Cu.import("resource://gre/modules/Promise.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm")
 Cu.import("resource://gre/modules/UpdateUtils.jsm");
 
-var { computeHash } = Cu.import("resource://gre/modules/addons/ProductAddonChecker.jsm");
-var ProductAddonCheckerScope = Cu.import("resource://gre/modules/addons/ProductAddonChecker.jsm");
+var ProductAddonCheckerScope = Cu.import("resource://gre/modules/addons/ProductAddonChecker.jsm", {});
 
 do_get_profile();
 
 function run_test() {
  Cu.import("resource://gre/modules/Preferences.jsm")
   Preferences.set("media.gmp.log.dump", true);
   Preferences.set("media.gmp.log.level", 0);
   run_next_test();
@@ -413,17 +414,17 @@ function* test_checkForAddons_installAdd
   let zipFileName = "test_" + id + "_GMP.zip";
 
   let zipURL = URL_HOST + ":" + testserverPort + "/" + zipFileName;
   do_print("zipURL: " + zipURL);
 
   let data = "e~=0.5772156649";
   let zipFile = createNewZipFile(zipFileName, data);
   let hashFunc = "sha256";
-  let expectedDigest = yield computeHash(hashFunc, zipFile.path);
+  let expectedDigest = yield ProductAddonCheckerScope.computeHash(hashFunc, zipFile.path);
   let fileSize = zipFile.fileSize;
   if (wantInstallReject) {
     fileSize = 1;
   }
 
   let responseXML =
     "<?xml version=\"1.0\"?>" +
     "<updates>" +
--- a/toolkit/modules/tests/xpcshell/test_Promise.js
+++ b/toolkit/modules/tests/xpcshell/test_Promise.js
@@ -82,17 +82,17 @@ var make_promise_test = function(test) {
 
 var tests = [];
 
 // Utility function to observe an failures in a promise
 // This function is useful if the promise itself is
 // not returned.
 var observe_failures = function observe_failures(promise) {
   promise.catch(function onReject(reason) {
-    test.do_throw("Observed failure in test " + test + ": " + reason);
+    do_throw("Observed failure in test: " + reason);
   });
 };
 
 // Test that all observers are notified
 tests.push(make_promise_test(
   function notification(test) {
     // The size of the test
     const SIZE = 10;
--- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
@@ -554,17 +554,17 @@ var AddonTestUtils = {
         // Load the add-ons list as it was after application shutdown
         this.loadAddonsList();
 
         // Clear any crash report annotations
         this.appInfo.annotations = {};
 
         // Force the XPIProvider provider to reload to better
         // simulate real-world usage.
-        let XPIscope = Cu.import("resource://gre/modules/addons/XPIProvider.jsm");
+        let XPIscope = Cu.import("resource://gre/modules/addons/XPIProvider.jsm", {});
         // This would be cleaner if I could get it as the rejection reason from
         // the AddonManagerInternal.shutdown() promise
         let shutdownError = XPIscope.XPIProvider._shutdownError;
 
         AddonManagerPrivate.unregisterProvider(XPIscope.XPIProvider);
         Cu.unload("resource://gre/modules/addons/XPIProvider.jsm");
 
         if (shutdownError)
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 "use strict";
 
 Cu.import("resource://gre/modules/Promise.jsm");
 Cu.import("resource://gre/modules/AppConstants.jsm");
-var GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm");
+var GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm", {});
 
 const TEST_DATE = new Date(2013, 0, 1, 12);
 
 var gManagerWindow;
 var gCategoryUtilities;
 
 var gMockAddons = [];
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_XPIStates.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_XPIStates.js
@@ -95,17 +95,17 @@ function checkChange(XS, aPath, aChange)
   aPath.lastModifiedTime = lastTimestamp;
   do_check_eq(XS.getInstallState(), aChange);
   // Save the pref so we don't detect this change again
   XS.save();
 }
 
 // Get a reference to the XPIState (loaded by startupManager) so we can unit test it.
 function getXS() {
-  let XPI = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
+  let XPI = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
   return XPI.XPIStates;
 }
 
 add_task(function* detect_touches() {
   startupManager();
   let [/* pe */, pd, /* ue */, ud] = yield promiseAddonsByIDs([
          "packed-enabled@tests.mozilla.org",
          "packed-disabled@tests.mozilla.org",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_XPIcancel.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_XPIcancel.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 // Test the cancellable doing/done/cancelAll API in XPIProvider
 
-var scope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
+var scope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
 var XPIProvider = scope.XPIProvider;
 
 function run_test() {
   // Check that cancelling with nothing in progress doesn't blow up
   XPIProvider.cancelAll();
 
   // Check that a basic object gets cancelled
   let getsCancelled = {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_asyncBlocklistLoad.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_asyncBlocklistLoad.js
@@ -4,17 +4,17 @@
 
 function run_test() {
   run_next_test();
 }
 
 add_task(function* () {
   let blocklist = AM_Cc["@mozilla.org/extensions/blocklist;1"].
                   getService().wrappedJSObject;
-  let scope = Components.utils.import("resource://gre/modules/osfile.jsm");
+  let scope = Components.utils.import("resource://gre/modules/osfile.jsm", {});
 
   // sync -> async
   blocklist._loadBlocklist();
   do_check_true(blocklist._isBlocklistLoaded());
   yield blocklist._preloadBlocklist();
   do_check_false(blocklist._isBlocklistPreloaded());
   blocklist._clear();
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-var scope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
+var scope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
 const XPIProvider = scope.XPIProvider;
 const ID = "experiment1@tests.mozilla.org";
 
 var gIsNightly = false;
 
 function run_test() {
   BootstrapMonitor.init();
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-var GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm");
+var GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm", {});
 Cu.import("resource://gre/modules/AppConstants.jsm");
 Cu.import("resource://gre/modules/UpdateUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
   () => Services.strings.createBundle("chrome://global/locale/plugins.properties"));
 
 XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
                                   "resource://gre/modules/FileUtils.jsm");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_no_addons.js
@@ -3,17 +3,17 @@
  */
 
 // Test startup and restart when no add-ons are installed
 // bug 944006
 
 Components.utils.import("resource://gre/modules/Promise.jsm");
 
 // Load XPI Provider to get schema version ID
-var XPIScope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
+var XPIScope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
 const DB_SCHEMA = XPIScope.DB_SCHEMA;
 
 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
 function run_test() {
   // Kick off the task-based tests...
   run_next_test();
 }
@@ -88,9 +88,8 @@ add_task(trigger_db_load);
 add_task(function upgrade_schema_version() {
   shutdownManager();
   Services.prefs.setIntPref("extensions.databaseSchema", 1);
 
   startupManager();
   do_check_eq(Services.prefs.getIntPref("extensions.databaseSchema"), DB_SCHEMA);
   check_empty_state();
 });
-
--- a/toolkit/mozapps/extensions/test/xpcshell/test_pluginchange.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_pluginchange.js
@@ -1,17 +1,17 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 const LIST_UPDATED_TOPIC     = "plugins-list-updated";
 
 // We need to use the same algorithm for generating IDs for plugins
-var { getIDHashForString } = Components.utils.import("resource://gre/modules/addons/PluginProvider.jsm");
-var { MockRegistrar } = Components.utils.import("resource://testing-common/MockRegistrar.jsm");
+var { getIDHashForString } = Components.utils.import("resource://gre/modules/addons/PluginProvider.jsm", {});
+var { MockRegistrar } = Components.utils.import("resource://testing-common/MockRegistrar.jsm", {});
 
 function PluginTag(name, description) {
   this.name = name;
   this.description = description;
 }
 
 PluginTag.prototype = {
   name: null,
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_updatepref.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_updatepref.js
@@ -31,17 +31,17 @@ function verifySignatures() {
   return new Promise(resolve => {
     let observer = (subject, topic, data) => {
       Services.obs.removeObserver(observer, "xpi-signature-changed");
       resolve(JSON.parse(data));
     }
     Services.obs.addObserver(observer, "xpi-signature-changed", false);
 
     do_print("Verifying signatures");
-    let XPIscope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
+    let XPIscope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
     XPIscope.XPIProvider.verifySignatures();
   });
 }
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "4", "4");
 
   // Start and stop the manager to initialise everything in the profile before
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_verify.js
@@ -23,17 +23,17 @@ function verifySignatures() {
   return new Promise(resolve => {
     let observer = (subject, topic, data) => {
       Services.obs.removeObserver(observer, "xpi-signature-changed");
       resolve(JSON.parse(data));
     }
     Services.obs.addObserver(observer, "xpi-signature-changed", false);
 
     do_print("Verifying signatures");
-    let XPIscope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
+    let XPIscope = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm", {});
     XPIscope.XPIProvider.verifySignatures();
   });
 }
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "4", "4");
 
   run_next_test();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_embedded.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_embedded.js
@@ -13,17 +13,17 @@ startupManager();
 // NOTE: the following import needs to be called after the `createAppInfo`
 // or it will fail Extension.jsm internally imports AddonManager.jsm and
 // AddonManager will raise a ReferenceError exception because it tried to
 // access an undefined `Services.appinfo` object.
 const { Management } = Components.utils.import("resource://gre/modules/Extension.jsm", {});
 
 const {
   EmbeddedExtensionManager,
-} = Components.utils.import("resource://gre/modules/LegacyExtensionsUtils.jsm");
+} = Components.utils.import("resource://gre/modules/LegacyExtensionsUtils.jsm", {});
 
 // Wait the startup of the embedded webextension.
 function promiseWebExtensionStartup() {
   return new Promise(resolve => {
     let listener = (event, extension) => {
       Management.off("startup", listener);
       resolve(extension);
     };
--- a/toolkit/xre/test/.eslintrc.js
+++ b/toolkit/xre/test/.eslintrc.js
@@ -1,7 +1,8 @@
 "use strict";
 
 module.exports = {
   "extends": [
-    "../../../testing/mochitest/mochitest.eslintrc.js"
+    "../../../testing/mochitest/mochitest.eslintrc.js",
+    "../../../testing/mochitest/browser.eslintrc.js"
   ]
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-import-into-var-and-global.js
+++ b/tools/lint/eslint/eslint-plugin-mozilla/lib/rules/no-import-into-var-and-global.js
@@ -22,28 +22,39 @@ var helpers = require("../helpers");
 module.exports = function(context) {
 
   // ---------------------------------------------------------------------------
   // Public
   //  --------------------------------------------------------------------------
 
   return {
     "CallExpression": function(node) {
+      // We're looking for forms of `var = ...`. We also know the arguments
+      // should be 1 or 2.
       if (node.callee.type === "MemberExpression" &&
           node.parent.type === "VariableDeclarator" &&
-          node.arguments.length === 2) {
+          node.arguments.length <= 2) {
         let memexp = node.callee;
-        if (((memexp.object.type === "Identifier" &&
-              memexp.object.name === "Cu") ||
-             (memexp.object.type === "MemberExpression" &&
-              memexp.object.object && memexp.object.property &&
-              memexp.object.object.name === "Components" &&
-              memexp.object.property.name === "utils")) &&
+
+        // Is the expression starting with `Cu` or `Components.utils`?
+        let isACu =
+          ((memexp.object.type === "Identifier" &&
+            memexp.object.name === "Cu") ||
+           (memexp.object.type === "MemberExpression" &&
+            memexp.object.object && memexp.object.property &&
+            memexp.object.object.name === "Components" &&
+            memexp.object.property.name === "utils"));
+
+        if (isACu &&
+            // Now check its `Cu.import` (or `Components.utils.import`).
             memexp.property.type === "Identifier" &&
             memexp.property.name === "import" &&
-            node.arguments[1].type === "ThisExpression") {
+            // Finally, we're looking for no additional arguments (i.e. just the
+            // resource uri), or one additional argument which is `this`.
+            (node.arguments.length == 1 ||
+              node.arguments[1].type === "ThisExpression")) {
           context.report(node, "Cu.import imports into variables and into " +
                          "global scope.");
         }
       }
     }
   };
 };
--- a/tools/lint/eslint/eslint-plugin-mozilla/package.json
+++ b/tools/lint/eslint/eslint-plugin-mozilla/package.json
@@ -1,11 +1,11 @@
 {
   "name": "eslint-plugin-mozilla",
-  "version": "0.2.6",
+  "version": "0.2.7",
   "description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
   "keywords": [
     "eslint",
     "eslintplugin",
     "eslint-plugin",
     "mozilla",
     "firefox"
   ],
--- a/tools/lint/eslint/modules.json
+++ b/tools/lint/eslint/modules.json
@@ -10,16 +10,17 @@
   "ajv-4.1.1.js": ["Ajv"],
   "AlertsHelper.jsm": [],
   "AppData.jsm": ["makeFakeAppDir"],
   "AppInfo.jsm": ["newAppInfo", "getAppInfo", "updateAppInfo"],
   "arrays.js": ["inArray", "getSet", "indexOf", "remove", "rindexOf", "compare"],
   "assertions.js": ["Assert", "Expect"],
   "async.js": ["Async"],
   "AsyncSpellCheckTestHelper.jsm": ["onSpellCheck"],
+  "AutoMigrate.jsm": ["AutoMigrate"],
   "Battery.jsm": ["GetBattery", "Battery"],
   "blocklist-clients.js": ["AddonBlocklistClient", "GfxBlocklistClient", "OneCRLBlocklistClient", "PluginBlocklistClient", "FILENAME_ADDONS_JSON", "FILENAME_GFX_JSON", "FILENAME_PLUGINS_JSON"],
   "blocklist-updater.js": ["checkVersions", "addTestBlocklistClient"],
   "bogus_element_type.jsm": [],
   "bookmark_validator.js": ["BookmarkValidator", "BookmarkProblemData"],
   "bookmarks.js": ["BookmarksEngine", "PlacesItem", "Bookmark", "BookmarkFolder", "BookmarkQuery", "Livemark", "BookmarkSeparator"],
   "bookmarks.jsm": ["PlacesItem", "Bookmark", "Separator", "Livemark", "BookmarkFolder", "DumpBookmarks"],
   "BootstrapMonitor.jsm": ["monitor"],