Bug 1431533: Part 5b - Fix ESLint errors left over after rewrite. r=florian
authorKris Maglione <maglione.k@gmail.com>
Thu, 18 Jan 2018 16:27:26 -0800
changeset 455770 d48657228a0b84cf3a37a35227ca3b3d0bd2a017
parent 455769 d4a7c018420e408fbe0a13ffddd2861623fda5a7
child 455771 bb369804a51e7665c0b44d3778681ca132cb1c2c
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1431533
milestone60.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 1431533: Part 5b - Fix ESLint errors left over after rewrite. r=florian MozReview-Commit-ID: 7bVI1iM6hor
browser/base/content/urlbarBindings.xml
browser/components/places/content/menu.xml
browser/components/preferences/in-content/tests/head.js
browser/components/search/content/search.xml
devtools/client/shared/widgets/tooltip/VariableContentHelper.js
dom/media/tests/mochitest/identity/test_fingerprints.html
dom/media/tests/mochitest/identity/test_idpproxy.html
js/xpconnect/tests/mochitest/test_bug772288.html
testing/marionette/accessibility.js
testing/marionette/action.js
testing/marionette/addon.js
testing/marionette/assert.js
testing/marionette/cert.js
testing/marionette/cookie.js
testing/marionette/event.js
testing/marionette/format.js
testing/marionette/l10n.js
testing/marionette/message.js
testing/marionette/packets.js
testing/marionette/proxy.js
testing/marionette/reftest.js
testing/marionette/server.js
testing/marionette/stream-utils.js
testing/marionette/sync.js
testing/marionette/transport.js
testing/talos/talos/talos-powers/content/TalosContentProfiler.js
testing/talos/talos/tests/quit.js
testing/xpcshell/dbg-actors.js
toolkit/components/extensions/test/mochitest/head_unlimitedStorage.js
toolkit/components/payments/content/paymentDialog.js
toolkit/components/payments/test/browser/head.js
toolkit/components/prompts/content/tabprompts.xml
toolkit/components/reader/ReaderWorker.jsm
toolkit/components/satchel/nsFormAutoComplete.js
toolkit/content/widgets/general.xml
toolkit/modules/Promise-backend.js
toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -52,17 +52,17 @@ file, You can obtain one at http://mozil
       </xul:hbox>
       <xul:popupset anonid="popupset"
                     class="autocomplete-result-popupset"/>
       <children includes="toolbarbutton"/>
     </content>
 
     <implementation implements="nsIObserver, nsIDOMEventListener">
       <field name="ExtensionSearchHandler" readonly="true">
-        (Components.utils.import("resource://gre/modules/ExtensionSearchHandler.jsm", {})).ExtensionSearchHandler;
+        (ChromeUtils.import("resource://gre/modules/ExtensionSearchHandler.jsm", {})).ExtensionSearchHandler;
       </field>
 
       <constructor><![CDATA[
         this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
                                 .getService(Components.interfaces.nsIPrefService)
                                 .getBranch("browser.urlbar.");
         this._prefs.addObserver("", this);
 
--- a/browser/components/places/content/menu.xml
+++ b/browser/components/places/content/menu.xml
@@ -22,17 +22,17 @@
           <children/>
         </xul:arrowscrollbox>
       </xul:hbox>
     </content>
 
     <implementation>
 
       <field name="AppConstants" readonly="true">
-        (Components.utils.import("resource://gre/modules/AppConstants.jsm", {})).AppConstants;
+        (ChromeUtils.import("resource://gre/modules/AppConstants.jsm", {})).AppConstants;
       </field>
 
       <field name="_indicatorBar">
         document.getAnonymousElementByAttribute(this, "class",
                                                 "menupopup-drop-indicator-bar");
       </field>
 
       <field name="_scrollBox">
--- a/browser/components/preferences/in-content/tests/head.js
+++ b/browser/components/preferences/in-content/tests/head.js
@@ -1,12 +1,12 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-ChromeUtils.import("resource://gre/modules/Promise.jsm");
+ChromeUtils.import("resource://gre/modules/Promise.jsm", this);
 
 const kDefaultWait = 2000;
 
 function is_hidden(aElement) {
   var style = aElement.ownerGlobal.getComputedStyle(aElement);
   if (style.display == "none")
     return true;
   if (style.visibility != "visible")
--- a/browser/components/search/content/search.xml
+++ b/browser/components/search/content/search.xml
@@ -137,17 +137,17 @@
       <field name="_clickClosedPopup">false</field>
       <field name="_stringBundle">document.getAnonymousElementByAttribute(this,
           "anonid", "searchbar-stringbundle");</field>
       <field name="_textboxInitialized">false</field>
       <field name="_textbox">document.getAnonymousElementByAttribute(this,
           "anonid", "searchbar-textbox");</field>
       <field name="_engines">null</field>
       <field name="FormHistory" readonly="true">
-        (Components.utils.import("resource://gre/modules/FormHistory.jsm", {})).FormHistory;
+        (ChromeUtils.import("resource://gre/modules/FormHistory.jsm", {})).FormHistory;
       </field>
 
       <property name="engines" readonly="true">
         <getter><![CDATA[
           if (!this._engines)
             this._engines = Services.search.getVisibleEngines();
           return this._engines;
         ]]></getter>
--- a/devtools/client/shared/widgets/tooltip/VariableContentHelper.js
+++ b/devtools/client/shared/widgets/tooltip/VariableContentHelper.js
@@ -1,17 +1,17 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* 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";
 
-const {XPCOMUtils} = require("resource://gre/modules/XPCOMUtils.jsm");
+const ChromeUtils = require("ChromeUtils");
 
 ChromeUtils.defineModuleGetter(this, "VariablesView",
   "resource://devtools/client/shared/widgets/VariablesView.jsm");
 ChromeUtils.defineModuleGetter(this, "VariablesViewController",
   "resource://devtools/client/shared/widgets/VariablesViewController.jsm");
 
 /**
  * Fill the tooltip with a variables view, inspecting an object via its
--- a/dom/media/tests/mochitest/identity/test_fingerprints.html
+++ b/dom/media/tests/mochitest/identity/test_fingerprints.html
@@ -6,17 +6,17 @@
 </head>
 <body>
   <script class="testbody" type="application/javascript">
 'use strict';
 
 // here we call the identity provider directly
 function getIdentityAssertion(fpArray) {
   var Cu = SpecialPowers.Cu;
-  var rtcid = ChromeUtils.import('resource://gre/modules/media/IdpSandbox.jsm');
+  var rtcid = Cu.import('resource://gre/modules/media/IdpSandbox.jsm');
   var sandbox = new rtcid.IdpSandbox('example.com', 'idp.js', window);
   return sandbox.start()
     .then(idp => SpecialPowers.wrap(idp)
                    .generateAssertion(JSON.stringify({ fingerprint: fpArray }),
                                       'https://example.com'))
     .then(assertion => {
       assertion = SpecialPowers.wrap(assertion);
       var assertionString = btoa(JSON.stringify(assertion));
--- a/dom/media/tests/mochitest/identity/test_idpproxy.html
+++ b/dom/media/tests/mochitest/identity/test_idpproxy.html
@@ -3,17 +3,17 @@
 <meta charset="utf-8" />
 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
 </head>
 <body>
   <script class="testbody" type="application/javascript">
 "use strict";
 var Cu = SpecialPowers.Cu;
-var rtcid = ChromeUtils.import("resource://gre/modules/media/IdpSandbox.jsm");
+var rtcid = Cu.import("resource://gre/modules/media/IdpSandbox.jsm");
 var IdpSandbox = rtcid.IdpSandbox;
 var dummyPayload = JSON.stringify({
   this: 'is',
   a: ['stu', 6],
   obj: null
 });
 
 function test_domain_sandbox() {
--- a/js/xpconnect/tests/mochitest/test_bug772288.html
+++ b/js/xpconnect/tests/mochitest/test_bug772288.html
@@ -21,26 +21,26 @@ https://bugzilla.mozilla.org/show_bug.cg
 /** Test for Bug 772288 **/
 SimpleTest.waitForExplicitFinish();
 
 const Cu = SpecialPowers.Cu;
 
 function doTest() {
     msg = "Services should be imported on window";
     try {
-      ChromeUtils.import("resource://gre/modules/Services.jsm", window);
+      Cu.import("resource://gre/modules/Services.jsm", window);
       ok(Services, msg);
     } catch (ex) {
       ok(false, msg + " : " + ex);
     }
 
     msg = "Services should be imported on myObj";
     try {
       var myObj = {};
-      ChromeUtils.import("resource://gre/modules/Services.jsm", myObj);
+      Cu.import("resource://gre/modules/Services.jsm", myObj);
       ok(myObj.Services, msg);
     } catch (ex) {
       ok(false, msg + " : " + ex);
     }
 
     SimpleTest.finish();
 }
 
--- a/testing/marionette/accessibility.js
+++ b/testing/marionette/accessibility.js
@@ -1,15 +1,15 @@
 /* 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";
 
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+const {classes: Cc, interfaces: Ci} = Components;
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 
 const logger = Log.repository.getLogger("Marionette");
 
 const {ElementNotAccessibleError} =
--- a/testing/marionette/action.js
+++ b/testing/marionette/action.js
@@ -1,17 +1,17 @@
 /* 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/. */
 
 /* eslint no-dupe-keys:off */
 
 "use strict";
 
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+const {classes: Cc, interfaces: Ci} = Components;
 
 ChromeUtils.import("chrome://marionette/content/assert.js");
 const {element} = ChromeUtils.import("chrome://marionette/content/element.js", {});
 const {
   InvalidArgumentError,
   MoveTargetOutOfBoundsError,
   UnsupportedOperationError,
 } = ChromeUtils.import("chrome://marionette/content/error.js", {});
--- a/testing/marionette/addon.js
+++ b/testing/marionette/addon.js
@@ -1,16 +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/. */
 
 "use strict";
 
-const {utils: Cu} = Components;
-
 ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
 ChromeUtils.import("resource://gre/modules/FileUtils.jsm");
 
 const {UnknownError} = ChromeUtils.import("chrome://marionette/content/error.js", {});
 
 this.EXPORTED_SYMBOLS = ["addon"];
 
 /** @namespace */
--- a/testing/marionette/assert.js
+++ b/testing/marionette/assert.js
@@ -1,16 +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/. */
 
 "use strict";
 
-const {utils: Cu} = Components;
-
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const {
   InvalidArgumentError,
   InvalidSessionIDError,
--- a/testing/marionette/cert.js
+++ b/testing/marionette/cert.js
@@ -1,15 +1,15 @@
 /* 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";
 
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+const {classes: Cc, interfaces: Ci} = Components;
 
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 this.EXPORTED_SYMBOLS = ["cert"];
 
 const registrar =
     Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
--- a/testing/marionette/cookie.js
+++ b/testing/marionette/cookie.js
@@ -1,15 +1,15 @@
 /* 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";
 
-const {interfaces: Ci, utils: Cu, results: Cr} = Components;
+const {interfaces: Ci, results: Cr} = Components;
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 ChromeUtils.import("chrome://marionette/content/assert.js");
 const {
   InvalidCookieDomainError,
   UnableToSetCookieError,
 } = ChromeUtils.import("chrome://marionette/content/error.js", {});
--- a/testing/marionette/event.js
+++ b/testing/marionette/event.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /** Provides functionality for creating and sending DOM events. */
 this.event = {};
 
 "use strict";
 /* global content, is */
 
-const {interfaces: Ci, utils: Cu, classes: Cc} = Components;
+const {interfaces: Ci, classes: Cc} = Components;
 
 ChromeUtils.import("chrome://marionette/content/element.js");
 
 const dblclickTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
 
 //  Max interval between two clicks that should result in a dblclick (in ms)
 const DBLCLICK_INTERVAL = 640;
 
--- a/testing/marionette/format.js
+++ b/testing/marionette/format.js
@@ -1,16 +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/. */
 
 "use strict";
 
-const {utils: Cu} = Components;
-
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 
 this.EXPORTED_SYMBOLS = ["pprint", "truncate"];
 
 const log = Log.repository.getLogger("Marionette");
 
 const MAX_STRING_LENGTH = 250;
 
--- a/testing/marionette/l10n.js
+++ b/testing/marionette/l10n.js
@@ -10,18 +10,16 @@
  * The localization (https://mzl.la/2eUMjyF) of UI elements in Gecko
  * based applications is done via entities and properties. For static
  * values entities are used, which are located in .dtd files. Whereby for
  * dynamically updated content the values come from .property files. Both
  * types of elements can be identifed via a unique id, and the translated
  * content retrieved.
  */
 
-const {utils: Cu} = Components;
-
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyServiceGetter(
     this, "domParser", "@mozilla.org/xmlextras/domparser;1", "nsIDOMParser");
 
 const {NoSuchElementError} =
     ChromeUtils.import("chrome://marionette/content/error.js", {});
--- a/testing/marionette/message.js
+++ b/testing/marionette/message.js
@@ -1,16 +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/. */
 
 "use strict";
 
-const {utils: Cu} = Components;
-
 ChromeUtils.import("chrome://marionette/content/assert.js");
 ChromeUtils.import("chrome://marionette/content/error.js");
 const {truncate} = ChromeUtils.import("chrome://marionette/content/format.js", {});
 
 this.EXPORTED_SYMBOLS = [
   "Command",
   "Message",
   "Response",
--- a/testing/marionette/packets.js
+++ b/testing/marionette/packets.js
@@ -19,17 +19,17 @@
  *   * write(stream)
  *     Called when the output stream is ready to write
  *   * get done()
  *     Returns true once the packet is done being read / written
  *   * destroy()
  *     Called to clean up at the end of use
  */
 
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+const {classes: Cc, interfaces: Ci} = Components;
 const {StreamUtils} =
     ChromeUtils.import("chrome://marionette/content/stream-utils.js", {});
 
 const unicodeConverter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
     .createInstance(Ci.nsIScriptableUnicodeConverter);
 unicodeConverter.charset = "UTF-8";
 
 const defer = function() {
--- a/testing/marionette/proxy.js
+++ b/testing/marionette/proxy.js
@@ -1,16 +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/. */
 
 "use strict";
 
-const {utils: Cu} = Components;
-
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 const {
   error,
   WebDriverError,
 } = ChromeUtils.import("chrome://marionette/content/error.js", {});
--- a/testing/marionette/reftest.js
+++ b/testing/marionette/reftest.js
@@ -1,15 +1,15 @@
 /* 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";
 
-const {interfaces: Ci, utils: Cu} = Components;
+const {interfaces: Ci} = Components;
 
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 
 ChromeUtils.import("chrome://marionette/content/assert.js");
 ChromeUtils.import("chrome://marionette/content/capture.js");
 const {InvalidArgumentError} =
     ChromeUtils.import("chrome://marionette/content/error.js", {});
--- a/testing/marionette/server.js
+++ b/testing/marionette/server.js
@@ -1,15 +1,15 @@
 /* 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";
 
-const {Constructor: CC, interfaces: Ci, utils: Cu} = Components;
+const {Constructor: CC, interfaces: Ci} = Components;
 
 const ServerSocket = CC(
     "@mozilla.org/network/server-socket;1",
     "nsIServerSocket",
     "initSpecialConnection");
 
 ChromeUtils.import("resource://gre/modules/Log.jsm");
 ChromeUtils.import("resource://gre/modules/Preferences.jsm");
--- a/testing/marionette/stream-utils.js
+++ b/testing/marionette/stream-utils.js
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const {
   Constructor: CC,
   classes: Cc,
   interfaces: Ci,
-  utils: Cu,
   results: Cr,
 } = Components;
 
 ChromeUtils.import("resource://gre/modules/EventEmitter.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 
 const IOUtil = Cc["@mozilla.org/io-util;1"].getService(Ci.nsIIOUtil);
 const ScriptableInputStream = CC("@mozilla.org/scriptableinputstream;1",
--- a/testing/marionette/sync.js
+++ b/testing/marionette/sync.js
@@ -1,15 +1,15 @@
 /* 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";
 
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+const {classes: Cc, interfaces: Ci} = Components;
 
 const {
   error,
   TimeoutError,
 } = ChromeUtils.import("chrome://marionette/content/error.js", {});
 
 /* exported PollPromise, TimedPromise */
 this.EXPORTED_SYMBOLS = ["PollPromise", "TimedPromise"];
--- a/testing/marionette/transport.js
+++ b/testing/marionette/transport.js
@@ -1,17 +1,17 @@
 /* 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";
 
 /* global Pipe, ScriptableInputStream, uneval */
 
-const {Constructor: CC, classes: Cc, utils: Cu, results: Cr} = Components;
+const {Constructor: CC, classes: Cc, results: Cr} = Components;
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/EventEmitter.jsm");
 const {StreamUtils} =
     ChromeUtils.import("chrome://marionette/content/stream-utils.js", {});
 const {Packet, JSONPacket, BulkPacket} =
     ChromeUtils.import("chrome://marionette/content/packets.js", {});
 
--- a/testing/talos/talos/talos-powers/content/TalosContentProfiler.js
+++ b/testing/talos/talos/talos-powers/content/TalosContentProfiler.js
@@ -32,17 +32,18 @@ var TalosContentProfiler;
   try {
     // Outside of talos, this throws a security exception which no-op this file.
     // (It's not required nor allowed for addons since Firefox 17)
     // It's used inside talos from non-privileged pages (like during tscroll),
     // and it works because talos disables all/most security measures.
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
   } catch (e) {}
 
-  ChromeUtils.import("resource://gre/modules/Services.jsm");
+  /* eslint-disable mozilla/use-chromeutils-import */
+  Components.utils.import("resource://gre/modules/Services.jsm");
 
   /**
    * Emits a TalosContentProfiler prefixed event and then returns a Promise
    * that resolves once a corresponding acknowledgement event is
    * dispatched on our document.
    *
    * @param name
    *        The name of the event that will be TalosContentProfiler prefixed and
--- a/testing/talos/talos/tests/quit.js
+++ b/testing/talos/talos/tests/quit.js
@@ -61,16 +61,17 @@ function canQuitApplication() {
   os.notifyObservers(null, "quit-application-granted");
   return true;
 }
 
 function goQuitApplication(waitForSafeBrowsing) {
   const privs = "UniversalPreferencesRead UniversalPreferencesWrite " +
     "UniversalXPConnect";
 
+  /* eslint-disable mozilla/use-chromeutils-import */
   try {
     netscape.security.PrivilegeManager.enablePrivilege(privs);
   } catch (ex) {
     throw ("goQuitApplication: privilege failure " + ex);
   }
 
   var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
                  .getService(Components.interfaces.nsIXULRuntime);
--- a/testing/xpcshell/dbg-actors.js
+++ b/testing/xpcshell/dbg-actors.js
@@ -1,20 +1,21 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 /* import-globals-from ../../devtools/server/main.js */
+/* eslint "mozilla/use-chromeutils-import": ["error", {allowCu: true}] */
 
 const Cu = Components.utils;
-const { Promise } = ChromeUtils.import("resource://gre/modules/Promise.jsm", {});
-var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm", {});
-const { devtools } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
+const { Promise } = Cu.import("resource://gre/modules/Promise.jsm", {});
+var { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
+const { devtools } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 const { RootActor } = devtools.require("devtools/server/actors/root");
 const { BrowserTabList } = devtools.require("devtools/server/actors/webbrowser");
 
 /**
  * xpcshell-test (XPCST) specific actors.
  *
  */
 
--- a/toolkit/components/extensions/test/mochitest/head_unlimitedStorage.js
+++ b/toolkit/components/extensions/test/mochitest/head_unlimitedStorage.js
@@ -1,16 +1,16 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 "use strict";
 
 /* exported checkSitePermissions */
 
-const {Services, Cu} = SpecialPowers;
-const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm", {});
+const {Services} = SpecialPowers;
+const {NetUtil} = SpecialPowers.Cu.import("resource://gre/modules/NetUtil.jsm", {});
 
 function checkSitePermissions(uuid, expectedPermAction, assertMessage) {
   if (!uuid) {
     throw new Error("checkSitePermissions should not be called with an undefined uuid");
   }
 
   const baseURI = NetUtil.newURI(`moz-extension://${uuid}/`);
   const principal = Services.scriptSecurityManager.createCodebasePrincipal(baseURI, {});
--- a/toolkit/components/payments/content/paymentDialog.js
+++ b/toolkit/components/payments/content/paymentDialog.js
@@ -14,17 +14,18 @@ const paymentSrv = Cc["@mozilla.org/dom/
                      .getService(Ci.nsIPaymentRequestService);
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "profileStorage", () => {
   let profileStorage;
   try {
-    profileStorage = ChromeUtils.import("resource://formautofill/ProfileStorage.jsm", {}).profileStorage;
+    profileStorage = ChromeUtils.import(
+      "resource://formautofill/ProfileStorage.jsm", {}).profileStorage;
     profileStorage.initialize();
   } catch (ex) {
     profileStorage = null;
     Cu.reportError(ex);
   }
 
   return profileStorage;
 });
--- a/toolkit/components/payments/test/browser/head.js
+++ b/toolkit/components/payments/test/browser/head.js
@@ -11,18 +11,20 @@
 
 const BLANK_PAGE_PATH = "/browser/toolkit/components/payments/test/browser/blank_page.html";
 const BLANK_PAGE_URL = "https://example.com" + BLANK_PAGE_PATH;
 
 const paymentSrv = Cc["@mozilla.org/dom/payments/payment-request-service;1"]
                      .getService(Ci.nsIPaymentRequestService);
 const paymentUISrv = Cc["@mozilla.org/dom/payments/payment-ui-service;1"]
                      .getService().wrappedJSObject;
-const {profileStorage} = ChromeUtils.import("resource://formautofill/ProfileStorage.jsm", {});
-const {PaymentTestUtils: PTU} = ChromeUtils.import("resource://testing-common/PaymentTestUtils.jsm", {});
+const {profileStorage} = ChromeUtils.import(
+  "resource://formautofill/ProfileStorage.jsm", {});
+const {PaymentTestUtils: PTU} = ChromeUtils.import(
+  "resource://testing-common/PaymentTestUtils.jsm", {});
 
 function getPaymentRequests() {
   let requestsEnum = paymentSrv.enumerate();
   let requests = [];
   while (requestsEnum.hasMoreElements()) {
     requests.push(requestsEnum.getNext().QueryInterface(Ci.nsIPaymentRequest));
   }
   return requests;
--- a/toolkit/components/prompts/content/tabprompts.xml
+++ b/toolkit/components/prompts/content/tabprompts.xml
@@ -326,17 +326,17 @@
         <handler event="keypress" key="." modifiers="meta"
                  group="system" action="this.onKeyAction('cancel', event);"/>
 #endif
         <handler event="focus" phase="capturing">
             let bnum = this.args.defaultButtonNum || 0;
             let defaultButton = this.ui["button" + bnum];
 
             let { AppConstants } =
-                Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
+                ChromeUtils.import("resource://gre/modules/AppConstants.jsm", {});
             if (AppConstants.platform == "macosx") {
               // On OS X, the default button always stays marked as such (until
               // the entire prompt blurs).
               defaultButton.setAttribute("default", true);
             } else {
               // On other platforms, the default button is only marked as such
               // when no other button has focus. XUL buttons on not-OSX will
               // react to pressing enter as a command, so you can't trigger the
--- a/toolkit/components/reader/ReaderWorker.jsm
+++ b/toolkit/components/reader/ReaderWorker.jsm
@@ -3,15 +3,13 @@
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 /**
  * Interface to a dedicated thread handling readability parsing.
  */
 
-const Cu = Components.utils;
-
 ChromeUtils.import("resource://gre/modules/PromiseWorker.jsm", this);
 
 this.EXPORTED_SYMBOLS = ["ReaderWorker"];
 
 this.ReaderWorker = new BasePromiseWorker("resource://gre/modules/reader/ReaderWorker.js");
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -455,18 +455,18 @@ FormAutoComplete.prototype = {
     let finalComments = historyComments.concat(comments);
 
     // This is ugly: there are two FormAutoCompleteResult classes in the
     // tree, one in a module and one in this file. Datalist results need to
     // use the one defined in the module but the rest of this file assumes
     // that we use the one defined here. To get around that, we explicitly
     // import the module here, out of the way of the other uses of
     // FormAutoCompleteResult.
-    let {FormAutoCompleteResult} = ChromeUtils.import("resource://gre/modules/nsFormAutoCompleteResult.jsm",
-                                                      {});
+    let {FormAutoCompleteResult} = ChromeUtils.import(
+        "resource://gre/modules/nsFormAutoCompleteResult.jsm", {});
     return new FormAutoCompleteResult(datalistResult.searchString,
                                       Ci.nsIAutoCompleteResult.RESULT_SUCCESS,
                                       0,
                                       "",
                                       finalValues,
                                       finalLabels,
                                       finalComments,
                                       historyResult);
--- a/toolkit/content/widgets/general.xml
+++ b/toolkit/content/widgets/general.xml
@@ -145,17 +145,17 @@
   <binding id="windowdragbox">
     <implementation>
       <field name="_dragBindingAlive">true</field>
       <constructor>
         if (!this._draggableStarted) {
           this._draggableStarted = true;
           try {
             let tmp = {};
-            Components.utils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
+            ChromeUtils.import("resource://gre/modules/WindowDraggingUtils.jsm", tmp);
             let draghandle = new tmp.WindowDraggingElement(this);
             draghandle.mouseDownCheck = function() {
               return this._dragBindingAlive;
             };
           } catch (e) {}
         }
       </constructor>
     </implementation>
--- a/toolkit/modules/Promise-backend.js
+++ b/toolkit/modules/Promise-backend.js
@@ -49,18 +49,20 @@ var Cc = this.require ? require("chrome"
 var Ci = this.require ? require("chrome").Ci : Components.interfaces;
 // If we can access Components, then we use it to capture an async
 // parent stack trace; see scheduleWalkerLoop.  However, as it might
 // not be available (see above), users of this must check it first.
 var Components_ = this.require ? require("chrome").components : Components;
 
 // If Cu is defined, use it to lazily define the FinalizationWitnessService.
 if (Cu) {
-  ChromeUtils.import("resource://gre/modules/Services.jsm");
-  ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+  // If we're in a devtools module environment, ChromeUtils won't exist.
+  /* eslint "mozilla/use-chromeutils-import": ["error", {allowCu: true}] */
+  Cu.import("resource://gre/modules/Services.jsm");
+  Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
   XPCOMUtils.defineLazyServiceGetter(this, "FinalizationWitnessService",
                                      "@mozilla.org/toolkit/finalizationwitness;1",
                                      "nsIFinalizationWitnessService");
 
   // For now, we're worried about add-ons using Promises with CPOWs, so we'll
   // permit them in this scope, but this support will go away soon.
   Cu.permitCPOWsInScope(this);
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 "use strict";
 
-ChromeUtils.import("resource://gre/modules/Promise.jsm");
+ChromeUtils.import("resource://gre/modules/Promise.jsm", this);
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 var GMPScope = ChromeUtils.import("resource://gre/modules/addons/GMPProvider.jsm", {});
 
 const TEST_DATE = new Date(2013, 0, 1, 12);
 
 var gManagerWindow;
 var gCategoryUtilities;