Bug 1514594: Part 3 - Change ChromeUtils.import API.

***
Bug 1514594: Part 3a - Change ChromeUtils.import to return an exports object; not pollute global. r=mccr8

This changes the behavior of ChromeUtils.import() to return an exports object,
rather than a module global, in all cases except when `null` is passed as a
second argument, and changes the default behavior not to pollute the global
scope with the module's exports. Thus, the following code written for the old
model:

  ChromeUtils.import("resource://gre/modules/Services.jsm");

is approximately the same as the following, in the new model:

  var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");

Since the two behaviors are mutually incompatible, this patch will land with a
scripted rewrite to update all existing callers to use the new model rather
than the old.
***
Bug 1514594: Part 3b - Mass rewrite all JS code to use the new ChromeUtils.import API. rs=Gijs

This was done using the followng script:

https://bitbucket.org/kmaglione/m-c-rewrites/src/tip/processors/cu-import-exports.jsm
***
Bug 1514594: Part 3c - Update ESLint plugin for ChromeUtils.import API changes. r=Standard8

Differential Revision: https://phabricator.services.mozilla.com/D16747
***
Bug 1514594: Part 3d - Remove/fix hundreds of duplicate imports from sync tests. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16748
***
Bug 1514594: Part 3e - Remove no-op ChromeUtils.import() calls. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16749
***
Bug 1514594: Part 3f.1 - Cleanup various test corner cases after mass rewrite. r=Gijs
***
Bug 1514594: Part 3f.2 - Cleanup various non-test corner cases after mass rewrite. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D16750

--HG--
extra : rebase_source : 359574ee3064c90f33bf36c2ebe3159a24cc8895
extra : histedit_source : b93c8f42808b1599f9122d7842d2c0b3e656a594%2C64a3a4e3359dc889e2ab2b49461bab9e27fc10a7
This commit is contained in:
Kris Maglione 2019-01-17 10:18:31 -08:00
Родитель 8fd723690b
Коммит e930b89c34
2853 изменённых файлов: 5465 добавлений и 6508 удалений

Просмотреть файл

@ -6,8 +6,8 @@
var EXPORTED_SYMBOLS = ["AccessFu"];
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Logger, Utils} = ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
ChromeUtils.defineModuleGetter(this, "Rect",
"resource://gre/modules/Geometry.jsm");
@ -51,8 +51,6 @@ var AccessFu = {
}
this._enabled = true;
ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
Services.obs.addObserver(this, "remote-browser-shown");
Services.obs.addObserver(this, "inprocess-browser-shown");
Services.ww.registerNotification(this);

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const AndroidEvents = {
VIEW_CLICKED: 0x01,

Просмотреть файл

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["TraversalRules", "TraversalHelper"]; // jshint ignore:line
ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
const {PrefCache, Utils} = ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
ChromeUtils.defineModuleGetter(this, "Roles", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
ChromeUtils.defineModuleGetter(this, "Filters", // jshint ignore:line

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
/**
* Load the browser with the given url and then invokes the given function.
@ -91,7 +91,7 @@ function reloadButton() {
// //////////////////////////////////////////////////////////////////////////////
// private section
ChromeUtils.import("resource://gre/modules/Services.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var gBrowserContext =
{

Просмотреть файл

@ -87,7 +87,7 @@ const MAX_TRIM_LENGTH = 100;
/**
* Services to determine if e10s is enabled.
*/
ChromeUtils.import("resource://gre/modules/Services.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* nsIAccessibilityService service.

Просмотреть файл

@ -40,7 +40,7 @@ const kFromUserInput = 1;
// //////////////////////////////////////////////////////////////////////////////
// General
ChromeUtils.import("resource://gre/modules/Services.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* Set up this variable to dump events into DOM.

Просмотреть файл

@ -88,7 +88,7 @@
function doTests() {
// Front end stuff sometimes likes to stuff things in the hidden window(s)
// in which case we should repress all accessibles for those.
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
// Try to create an accessible for the hidden window's document.
let doc = Services.appShell.hiddenDOMWindow.document;

Просмотреть файл

@ -110,7 +110,7 @@
function doTests() {
// Front end stuff sometimes likes to stuff things in the hidden window(s)
// in which case we should repress all accessibles for those.
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
// Try to create an accessible for the hidden window's document.
let doc = Services.appShell.hiddenDOMWindow.document;

Просмотреть файл

@ -24,7 +24,7 @@
<script type="application/javascript">
ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
const {InlineSpellChecker} = ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
function spelledTextInvoker(aID) {
this.DOMNode = getNode(aID);

Просмотреть файл

@ -2,8 +2,8 @@
"use strict";
/* global isDeeply, getMainChromeWindow, SimpleTest, SpecialPowers, Logger,
AccessFu, Utils, addMessageListener, currentTabDocument, currentBrowser*/
/* global isDeeply, getMainChromeWindow, SimpleTest, SpecialPowers,
addMessageListener, currentTabDocument, currentBrowser*/
/**
* A global variable holding an array of test functions.
@ -14,8 +14,9 @@ var gTestFuncs = [];
*/
var gIterator;
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var AccessFu;
const {Logger, Utils} = ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
const MovementGranularity = {
CHARACTER: 1,
@ -143,7 +144,7 @@ var AccessFuTest = {
Logger.logLevel = Logger.DEBUG;
// Start AccessFu and put it in stand-by.
ChromeUtils.import("resource://gre/modules/accessibility/AccessFu.jsm");
({AccessFu} = ChromeUtils.import("resource://gre/modules/accessibility/AccessFu.jsm"));
var prefs = [["accessibility.accessfu.notify_output", 1]];
prefs.push.apply(prefs, aAdditionalPrefs);
@ -213,7 +214,8 @@ class AccessFuContentTestRunner {
async setupMessageManager(aMessageManager) {
function contentScript() {
ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
// eslint-disable-next-line no-shadow
const {Logger, Utils} = ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
Logger.logLevel = "DEBUG";
Utils.inTest = true;

Просмотреть файл

@ -1,6 +1,6 @@
const PREF_UTTERANCE_ORDER = "accessibility.accessfu.utterance";
ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
const {PivotContext} = ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
ChromeUtils.import("resource://gre/modules/accessibility/OutputGenerator.jsm", this);
/**

Просмотреть файл

@ -21,7 +21,7 @@
<script type="application/javascript" src="../layout.js"></script>
<script type="application/javascript">
ChromeUtils.import("resource://gre/modules/accessibility/Traversal.jsm");
const {TraversalRules} = ChromeUtils.import("resource://gre/modules/accessibility/Traversal.jsm");
var gBrowserWnd = null;
var gQueue = null;

Просмотреть файл

@ -21,7 +21,7 @@
<script type="application/javascript" src="../layout.js"></script>
<script type="application/javascript">
ChromeUtils.import("resource://gre/modules/accessibility/Traversal.jsm");
const {TraversalHelper} = ChromeUtils.import("resource://gre/modules/accessibility/Traversal.jsm");
var vc;

Просмотреть файл

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["AboutReaderChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.defineModuleGetter(this, "AboutReader",
"resource://gre/modules/AboutReader.jsm");

Просмотреть файл

@ -3,11 +3,11 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var EXPORTED_SYMBOLS = ["BlockedSiteChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.defineModuleGetter(this, "Utils",
"resource://gre/modules/sessionstore/Utils.jsm");

Просмотреть файл

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["BrowserTabChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.defineModuleGetter(this, "E10SUtils",
"resource://gre/modules/E10SUtils.jsm");

Просмотреть файл

@ -5,8 +5,8 @@
var EXPORTED_SYMBOLS = ["ClickHandlerChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");

Просмотреть файл

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["ContentSearchChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
class ContentSearchChild extends ActorChild {
handleEvent(event) {

Просмотреть файл

@ -8,10 +8,10 @@
var EXPORTED_SYMBOLS = ["ContextMenuChild"];
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);

Просмотреть файл

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["DOMFullscreenChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
class DOMFullscreenChild extends ActorChild {
receiveMessage(aMessage) {

Просмотреть файл

@ -10,9 +10,9 @@
var EXPORTED_SYMBOLS = ["FormSubmitChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {BrowserUtils} = ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
class FormSubmitChild extends ActorChild {
constructor(dispatcher) {

Просмотреть файл

@ -4,7 +4,7 @@
var EXPORTED_SYMBOLS = ["LightWeightThemeInstallChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
class LightWeightThemeInstallChild extends ActorChild {
handleEvent(event) {

Просмотреть файл

@ -6,8 +6,8 @@
var EXPORTED_SYMBOLS = ["LightweightThemeChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* LightweightThemeChild forwards theme data to in-content pages.

Просмотреть файл

@ -6,8 +6,8 @@
const EXPORTED_SYMBOLS = ["LinkHandlerChild"];
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.defineModuleGetter(this, "FaviconLoader",
"resource:///modules/FaviconLoader.jsm");

Просмотреть файл

@ -5,9 +5,9 @@
var EXPORTED_SYMBOLS = ["NetErrorChild"];
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");

Просмотреть файл

@ -6,8 +6,8 @@
var EXPORTED_SYMBOLS = ["OfflineAppsChild"];
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
class OfflineAppsChild extends ActorChild {
constructor(dispatcher) {

Просмотреть файл

@ -4,10 +4,10 @@
var EXPORTED_SYMBOLS = ["PageInfoChild"];
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",

Просмотреть файл

@ -2,11 +2,11 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var EXPORTED_SYMBOLS = ["PageStyleChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
class PageStyleChild extends ActorChild {
getViewer(content) {

Просмотреть файл

@ -6,11 +6,11 @@
var EXPORTED_SYMBOLS = ["PluginChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {BrowserUtils} = ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.defineModuleGetter(this, "ContextMenuChild",
"resource:///actors/ContextMenuChild.jsm");

Просмотреть файл

@ -5,8 +5,8 @@
var EXPORTED_SYMBOLS = ["SearchTelemetryChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const SHARED_DATA_KEY = "SearchTelemetry:ProviderInfo";

Просмотреть файл

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["URIFixupChild"];
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
class URIFixupChild extends ActorChild {
observe(subject) {

Просмотреть файл

@ -6,10 +6,10 @@
var EXPORTED_SYMBOLS = ["WebRTCChild"];
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {ActorChild} = ChromeUtils.import("resource://gre/modules/ActorChild.jsm");
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "MediaManagerService",
"@mozilla.org/mediaManagerService;1",
"nsIMediaManagerService");

Просмотреть файл

@ -7,9 +7,10 @@
/* import-globals-from aboutDialog.js */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "DownloadUtils",
"resource://gre/modules/DownloadUtils.jsm");
ChromeUtils.defineModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");

Просмотреть файл

@ -7,8 +7,8 @@
/* import-globals-from aboutDialog-appUpdater.js */
// Services = object with smart getters for common XPCOM services
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
async function init(aEvent) {
if (aEvent.target != document)

Просмотреть файл

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* eslint-env mozilla/frame-script */
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var AboutRestartRequired = {
/* Only do autofocus if we're the toplevel frame; otherwise we

Просмотреть файл

@ -10,7 +10,7 @@
*/
var tabPreviews = {
get aspectRatio() {
let { PageThumbUtils } = ChromeUtils.import("resource://gre/modules/PageThumbUtils.jsm", {});
let { PageThumbUtils } = ChromeUtils.import("resource://gre/modules/PageThumbUtils.jsm");
let [ width, height ] = PageThumbUtils.getThumbnailSize(window);
delete this.aspectRatio;
return this.aspectRatio = height / width;

Просмотреть файл

@ -14,7 +14,7 @@ var gDataNotificationInfoBar = {
_DATA_REPORTING_NOTIFICATION: "data-reporting",
get _log() {
let { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm", {});
let { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
delete this._log;
return this._log = Log.repository.getLoggerWithMessagePrefix(
"Toolkit.Telemetry", "DataNotificationInfoBar::");

Просмотреть файл

@ -82,7 +82,7 @@ var gPluginHandler = {
// Callback for user clicking on the link in a click-to-play plugin
// (where the plugin has an update)
async openPluginUpdatePage(pluginTag) {
let { Blocklist } = ChromeUtils.import("resource://gre/modules/Blocklist.jsm", {});
let { Blocklist } = ChromeUtils.import("resource://gre/modules/Blocklist.jsm");
let url = await Blocklist.getPluginBlockURL(pluginTag);
openTrustedLinkIn(url, "tab");
},

Просмотреть файл

@ -5,7 +5,7 @@
// This file is loaded into the browser window scope.
/* eslint-env mozilla/browser-window */
ChromeUtils.import("resource://services-sync/UIState.jsm");
const {UIState} = ChromeUtils.import("resource://services-sync/UIState.jsm");
ChromeUtils.defineModuleGetter(this, "FxAccounts",
"resource://gre/modules/FxAccounts.jsm");

Просмотреть файл

@ -3,9 +3,9 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/NotificationDB.jsm");
// lazy module getters
@ -179,7 +179,7 @@ XPCOMUtils.defineLazyGetter(this, "gTabBrowserBundle", () => {
XPCOMUtils.defineLazyGetter(this, "gCustomizeMode", () => {
let { CustomizeMode } =
ChromeUtils.import("resource:///modules/CustomizeMode.jsm", {});
ChromeUtils.import("resource:///modules/CustomizeMode.jsm");
return new CustomizeMode(window);
});
@ -220,21 +220,21 @@ XPCOMUtils.defineLazyGetter(this, "gNotificationBox", () => {
XPCOMUtils.defineLazyGetter(this, "InlineSpellCheckerUI", () => {
let { InlineSpellChecker } =
ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm", {});
ChromeUtils.import("resource://gre/modules/InlineSpellChecker.jsm");
return new InlineSpellChecker();
});
XPCOMUtils.defineLazyGetter(this, "PageMenuParent", () => {
// eslint-disable-next-line no-shadow
let { PageMenuParent } =
ChromeUtils.import("resource://gre/modules/PageMenu.jsm", {});
ChromeUtils.import("resource://gre/modules/PageMenu.jsm");
return new PageMenuParent();
});
XPCOMUtils.defineLazyGetter(this, "PopupNotifications", () => {
// eslint-disable-next-line no-shadow
let { PopupNotifications } =
ChromeUtils.import("resource://gre/modules/PopupNotifications.jsm", {});
ChromeUtils.import("resource://gre/modules/PopupNotifications.jsm");
try {
// Hide all notifications while the URL is being edited and the address bar
// has focus, including the virtual focus in the results popup.
@ -264,7 +264,7 @@ XPCOMUtils.defineLazyGetter(this, "Win7Features", () => {
if (WINTASKBAR_CONTRACTID in Cc &&
Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available) {
let { AeroPeek } =
ChromeUtils.import("resource:///modules/WindowsPreviewPerTab.jsm", {});
ChromeUtils.import("resource:///modules/WindowsPreviewPerTab.jsm");
return {
onOpenWindow() {
AeroPeek.onOpenWindow(window);
@ -1414,7 +1414,7 @@ var gBrowserInit = {
_delayedStartup() {
let { TelemetryTimestamps } =
ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm", {});
ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm");
TelemetryTimestamps.add("delayedStartupStarted");
this._cancelDelayedStartup();

Просмотреть файл

@ -4,7 +4,7 @@
/* eslint-env mozilla/frame-script */
ChromeUtils.import("resource://gre/modules/Services.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var RefreshBlocker = {
PREF: "accessibility.blockautorefresh",

Просмотреть файл

@ -9,7 +9,7 @@
/* eslint-env mozilla/frame-script */
/* eslint no-unused-vars: ["error", {args: "none"}] */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
// TabChildGlobal
var global = this;

Просмотреть файл

@ -16,7 +16,7 @@
xmlns="http://www.w3.org/1999/xhtml"
#endif
>
Components.utils.import("resource://gre/modules/Services.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("chrome://browser/content/browser.js", this);
Services.scriptloader.loadSubScript("chrome://browser/content/browser-places.js", this);

Просмотреть файл

@ -4,10 +4,10 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
var {PrivateBrowsingUtils} = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var {BrowserUtils} = ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
SpellCheckHelper: "resource://gre/modules/InlineSpellChecker.jsm",

Просмотреть файл

@ -2,8 +2,6 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
/* import-globals-from ../../../../toolkit/content/globalOverlay.js */
/* import-globals-from ../../../../toolkit/content/contentAreaUtils.js */
/* import-globals-from ../../../../toolkit/content/treeUtils.js */

Просмотреть файл

@ -4,8 +4,7 @@
/* import-globals-from pageInfo.js */
ChromeUtils.import("resource:///modules/SitePermissions.jsm");
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
const {SitePermissions} = ChromeUtils.import("resource:///modules/SitePermissions.jsm");
var gPermURI;
var gPermPrincipal;

Просмотреть файл

@ -3,9 +3,8 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.import("resource:///modules/SiteDataManager.jsm");
ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
const {SiteDataManager} = ChromeUtils.import("resource:///modules/SiteDataManager.jsm");
const {DownloadUtils} = ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
/* import-globals-from pageInfo.js */

Просмотреть файл

@ -3,11 +3,11 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const appStartup = Services.startup;
ChromeUtils.import("resource://gre/modules/ResetProfile.jsm");
const {ResetProfile} = ChromeUtils.import("resource://gre/modules/ResetProfile.jsm");
var defaultToReset = false;

Просмотреть файл

@ -5,7 +5,8 @@
/* import-globals-from ../../../toolkit/content/preferencesBindings.js */
var {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm", {});
var {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
Preferences.addAll([
{ id: "privacy.cpd.history", type: "bool" },

Просмотреть файл

@ -7,15 +7,14 @@
/* eslint-env mozilla/frame-script */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "E10SUtils",
"resource://gre/modules/E10SUtils.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.import("resource://gre/modules/ActorManagerChild.jsm");
var {ActorManagerChild} = ChromeUtils.import("resource://gre/modules/ActorManagerChild.jsm");
ActorManagerChild.attach(this, "browsers");
@ -25,7 +24,7 @@ var global = this;
// Keep a reference to the translation content handler to avoid it it being GC'ed.
var trHandler = null;
if (Services.prefs.getBoolPref("browser.translation.detectLanguage")) {
ChromeUtils.import("resource:///modules/translation/TranslationContentHandler.jsm");
var {TranslationContentHandler} = ChromeUtils.import("resource:///modules/translation/TranslationContentHandler.jsm");
trHandler = new TranslationContentHandler(global, docShell);
}

Просмотреть файл

@ -10,7 +10,7 @@ const GOOD_PAGE_2 = "https://example.org/";
const BAD_CERT = "https://expired.example.com/";
const UNKNOWN_ISSUER = "https://self-signed.example.com ";
const BAD_STS_CERT = "https://badchain.include-subdomains.pinning.example.com:443";
const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm");
const PREF_NEW_CERT_ERRORS = "browser.security.newcerterrorpage.enabled";
add_task(async function checkReturnToAboutHome() {

Просмотреть файл

@ -3,9 +3,6 @@
"use strict";
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
add_task(async function() {
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:support" }, async function(browser) {
let keyGoogleStatus = await ContentTask.spawn(browser, null, async function() {

Просмотреть файл

@ -1,7 +1,7 @@
"use strict";
const {PlacesTestUtils} =
ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm", {});
ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm");
let notificationURL = "http://example.org/browser/browser/base/content/test/alerts/file_dom_notifications.html";
let oldShowFavicons;

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
var {BrowserWindowTracker} = ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
ChromeUtils.defineModuleGetter(this, "CaptivePortalWatcher",
"resource:///modules/CaptivePortalWatcher.jsm");

Просмотреть файл

@ -12,7 +12,7 @@
<iframe type="content" id="frame1"/>
<iframe type="content" id="frame2" onload="doTest()"/>
<script type="application/javascript"><![CDATA[
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
SimpleTest.waitForExplicitFinish();

Просмотреть файл

@ -12,7 +12,7 @@
<iframe type="content" id="frame1"/>
<iframe type="content" id="frame2" onload="doTest()"/>
<script type="application/javascript"><![CDATA[
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
SimpleTest.waitForExplicitFinish();

Просмотреть файл

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");

Просмотреть файл

@ -2,7 +2,7 @@ function hideSelectPopup(selectPopup, mode = "enter", win = window) {
let browser = win.gBrowser.selectedBrowser;
let selectClosedPromise = ContentTask.spawn(browser, null, async function() {
let {SelectContentHelper} =
ChromeUtils.import("resource://gre/actors/SelectChild.jsm", {});
ChromeUtils.import("resource://gre/actors/SelectChild.jsm", null);
return ContentTaskUtils.waitForCondition(() => !SelectContentHelper.open);
});

Просмотреть файл

@ -1,6 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
var {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
function test() {
var file = new File([new Blob(["test"], {type: "text/plain"})], "test-name");

Просмотреть файл

@ -8,7 +8,7 @@
const PREF_LWTHEME_USED_THEMES = "lightweightThemes.usedThemes";
const COMPACT_LIGHT_ID = "firefox-compact-light@mozilla.org";
const COMPACT_DARK_ID = "firefox-compact-dark@mozilla.org";
const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm");
registerCleanupFunction(() => {
// Set preferences back to their original values

Просмотреть файл

@ -9,8 +9,7 @@ const TEST_ENGINE_2_BASENAME = "searchSuggestionEngine2.xml";
const TEST_MSG = "ContentSearchUIControllerTest";
let {SearchTestUtils} = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm", {});
let {SearchTestUtils} = ChromeUtils.import("resource://testing-common/SearchTestUtils.jsm");
SearchTestUtils.init(Assert, registerCleanupFunction);
@ -633,7 +632,7 @@ var gDidInitialSetUp = false;
function setUp(aNoEngine) {
return (async function() {
if (!gDidInitialSetUp) {
ChromeUtils.import("resource:///modules/ContentSearch.jsm");
var {ContentSearch} = ChromeUtils.import("resource:///modules/ContentSearch.jsm");
let originalOnMessageSearch = ContentSearch._onMessageSearch;
let originalOnMessageManageEngines = ContentSearch._onMessageManageEngines;
ContentSearch._onMessageSearch = () => {};

Просмотреть файл

@ -20,14 +20,14 @@ const TEST_POLICY_VERSION = 37;
function fakeShowPolicyTimeout(set, clear) {
let reportingPolicy =
ChromeUtils.import("resource://gre/modules/TelemetryReportingPolicy.jsm", {}).Policy;
ChromeUtils.import("resource://gre/modules/TelemetryReportingPolicy.jsm", null).Policy;
reportingPolicy.setShowInfobarTimeout = set;
reportingPolicy.clearShowInfobarTimeout = clear;
}
function sendSessionRestoredNotification() {
let reportingPolicyImpl =
ChromeUtils.import("resource://gre/modules/TelemetryReportingPolicy.jsm", {}).TelemetryReportingPolicyImpl;
ChromeUtils.import("resource://gre/modules/TelemetryReportingPolicy.jsm", null).TelemetryReportingPolicyImpl;
reportingPolicyImpl.observe(null, "sessionstore-windows-restored", null);
}

Просмотреть файл

@ -1,6 +1,4 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const PREF_DISABLE_OPEN_NEW_WINDOW = "browser.link.open_newwindow.disabled_in_fullscreen";
const PREF_BLOCK_TOPLEVEL_DATA = "security.data_uri.block_toplevel_data_uri_navigations";

Просмотреть файл

@ -18,7 +18,7 @@ registerCleanupFunction(function() {
// offline cache events.
//
function contentTask() {
ChromeUtils.import("resource://gre/modules/Timer.jsm");
const {clearInterval, setInterval} = ChromeUtils.import("resource://gre/modules/Timer.jsm");
let resolve;
let promise = new Promise(r => { resolve = r; });

Просмотреть файл

@ -17,7 +17,7 @@ add_task(async function test_setup() {
Services.search.defaultEngine = engine;
// Move New Window button to nav bar, to make it possible to drag and drop.
let {CustomizableUI} = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
let {CustomizableUI} = ChromeUtils.import("resource:///modules/CustomizableUI.jsm");
let origPlacement = CustomizableUI.getPlacementOfWidget("new-window-button");
if (!origPlacement || origPlacement.area != CustomizableUI.AREA_NAVBAR) {
CustomizableUI.addWidgetToArea("new-window-button",

Просмотреть файл

@ -15,7 +15,7 @@ registerCleanupFunction(function() {
Services.perms.removeFromPrincipal(principal, "offline-app");
Services.prefs.clearUserPref("offline-apps.quota.warn");
Services.prefs.clearUserPref("offline-apps.allow_by_default");
let {OfflineAppCacheHelper} = ChromeUtils.import("resource://gre/modules/offlineAppCache.jsm", {});
let {OfflineAppCacheHelper} = ChromeUtils.import("resource://gre/modules/offlineAppCache.jsm");
OfflineAppCacheHelper.clear();
});

Просмотреть файл

@ -2,7 +2,7 @@
* 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/. */
var {WebChannel} = ChromeUtils.import("resource://gre/modules/WebChannel.jsm", {});
var {WebChannel} = ChromeUtils.import("resource://gre/modules/WebChannel.jsm");
const TEST_URL_TAIL = "example.com/browser/browser/base/content/test/general/test_remoteTroubleshoot.html";
const TEST_URI_GOOD = Services.io.newURI("https://" + TEST_URL_TAIL);

Просмотреть файл

@ -2,8 +2,6 @@
* 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/. */
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
function makeInputStream(aString) {
let stream = Cc["@mozilla.org/io/string-input-stream;1"]
.createInstance(Ci.nsIStringInputStream);

Просмотреть файл

@ -3,7 +3,7 @@
/* eslint-env mozilla/frame-script */
const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm");
const DUMMY = "http://example.com/browser/browser/base/content/test/general/dummy_page.html";

Просмотреть файл

@ -1,6 +1,6 @@
"use strict";
const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm");
add_task(async function() {
let uri = "http://example.com/browser/browser/base/content/test/general/dummy_page.html";

Просмотреть файл

@ -5,7 +5,7 @@
const OPEN_LOCATION_PREF = "browser.link.open_newwindow";
const NON_REMOTE_PAGE = "about:welcomeback";
ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
const {PrivateBrowsingUtils} = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
requestLongerTimeout(2);

Просмотреть файл

@ -2,7 +2,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");

Просмотреть файл

@ -290,8 +290,7 @@ async function test_contextmenu(selector, menuItems, options = {}) {
info("Waiting for spell check");
await ContentTask.spawn(gBrowser.selectedBrowser, selector, async function(contentSelector) {
let {onSpellCheck} =
ChromeUtils.import("resource://testing-common/AsyncSpellCheckTestHelper.jsm",
{});
ChromeUtils.import("resource://testing-common/AsyncSpellCheckTestHelper.jsm");
let element = content.document.querySelector(contentSelector);
await new Promise(resolve => onSpellCheck(element, resolve));
info("Spell check running");

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");

Просмотреть файл

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const {PlacesTestUtils} = ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm", null);
const {PlacesTestUtils} = ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm");
function promisePageActionPanelOpen() {
let dwu = window.windowUtils;

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource:///modules/SitePermissions.jsm");
const {SitePermissions} = ChromeUtils.import("resource:///modules/SitePermissions.jsm");
const TEST_ORIGIN = "https://example.com";

Просмотреть файл

@ -1,5 +1,3 @@
ChromeUtils.import("resource:///modules/SitePermissions.jsm");
ChromeUtils.defineModuleGetter(this, "SiteDataTestUtils",
"resource://testing-common/SiteDataTestUtils.jsm");
ChromeUtils.defineModuleGetter(this, "DownloadUtils",

Просмотреть файл

@ -132,7 +132,7 @@ add_task(async function() {
/* eslint-env mozilla/frame-script */
const Cm = Components.manager;
Cm.QueryInterface(Ci.nsIServiceManager);
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
let collectStacks = AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG;
let components = {};
for (let component of Cu.loadedComponents) {

Просмотреть файл

@ -3,7 +3,7 @@
"use strict";
ChromeUtils.import("resource://gre/modules/E10SUtils.jsm");
const {E10SUtils} = ChromeUtils.import("resource://gre/modules/E10SUtils.jsm");
const ORIGIN = "https://example.com";
const PERMISSIONS_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "permissions.html";

Просмотреть файл

@ -8,7 +8,7 @@ const ORIGIN = "https://example.com";
const PERMISSIONS_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "permissions.html";
// Ignore promise rejection caused by clicking Deny button.
const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm", {});
const { PromiseTestUtils } = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm");
PromiseTestUtils.whitelistRejectionsGlobally(/The request is not allowed/);
const EXPIRE_TIME_MS = 100;

Просмотреть файл

@ -4,8 +4,7 @@ const kBlocklistServiceUUID = "{66354bc9-7ed1-4692-ae1d-8da97d6b205e}";
const kBlocklistServiceContractID = "@mozilla.org/extensions/blocklist;1";
const kBlocklistServiceFactory = Cm.getClassObject(Cc[kBlocklistServiceContractID], Ci.nsIFactory);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Timer.jsm");
const {setTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm");
SimpleTest.requestFlakyTimeout("Need to simulate blocklist calls actually taking non-0 time to return");

Просмотреть файл

@ -6,7 +6,7 @@ var gTestBrowser = null;
const testURL1 = gTestRoot + "browser_clearplugindata.html";
const testURL2 = gTestRoot + "browser_clearplugindata_noage.html";
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm", {});
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
const pluginHostIface = Ci.nsIPluginHost;
var pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);

Просмотреть файл

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
/**
* With e10s, plugins must run in their own process. This means we have

Просмотреть файл

@ -6,8 +6,6 @@ var gTestBrowser = null;
var gNextTest = null;
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
ChromeUtils.import("resource://gre/modules/Services.jsm");
var gPrivateWindow = null;
var gPrivateBrowser = null;

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");

Просмотреть файл

@ -4,8 +4,7 @@ const kBlocklistServiceUUID = "{66354bc9-7ed1-4692-ae1d-8da97d6b205e}";
const kBlocklistServiceContractID = "@mozilla.org/extensions/blocklist;1";
const kBlocklistServiceFactory = Cm.getClassObject(Cc[kBlocklistServiceContractID], Ci.nsIFactory);
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Timer.jsm");
const {setTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm");
SimpleTest.requestFlakyTimeout("Need to simulate blocklist calls actually taking non-0 time to return");

Просмотреть файл

@ -8,7 +8,7 @@ var gTestBrowser = null;
const testURL1 = gTestRoot + "browser_clearplugindata.html";
const testURL2 = gTestRoot + "browser_clearplugindata_noage.html";
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm", {});
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
const pluginHostIface = Ci.nsIPluginHost;
var pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);

Просмотреть файл

@ -3,7 +3,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
/**
* With e10s, plugins must run in their own process. This means we have

Просмотреть файл

@ -8,8 +8,6 @@ var gTestBrowser = null;
var gNextTest = null;
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
ChromeUtils.import("resource://gre/modules/Services.jsm");
var gPrivateWindow = null;
var gPrivateBrowser = null;

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");

Просмотреть файл

@ -4,8 +4,7 @@
* 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/. */
ChromeUtils.import("resource:///modules/SitePermissions.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const {SitePermissions} = ChromeUtils.import("resource:///modules/SitePermissions.jsm");
const baseURL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
const URL = baseURL + "popup_blocker2.html";

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserTestUtils",
"resource://testing-common/BrowserTestUtils.jsm");

Просмотреть файл

@ -4,12 +4,12 @@ var EXPORTED_SYMBOLS = [
"SiteDataTestUtils",
];
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://testing-common/ContentTask.jsm");
ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {ContentTask} = ChromeUtils.import("resource://testing-common/ContentTask.jsm");
const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm", {});
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "swm",
"@mozilla.org/serviceworkers/manager;1",

Просмотреть файл

@ -1,6 +1,5 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm", {});
const {SiteDataTestUtils} = ChromeUtils.import("resource://testing-common/SiteDataTestUtils.jsm", {});
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
const {SiteDataTestUtils} = ChromeUtils.import("resource://testing-common/SiteDataTestUtils.jsm");
function checkDataForAboutURL() {
return new Promise(resolve => {

Просмотреть файл

@ -1,9 +1,8 @@
// Bug 380852 - Delete permission manager entries in Clear Recent History
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm", {});
const {SiteDataTestUtils} = ChromeUtils.import("resource://testing-common/SiteDataTestUtils.jsm", {});
const {PromiseTestUtils} = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm", {});
const {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
const {SiteDataTestUtils} = ChromeUtils.import("resource://testing-common/SiteDataTestUtils.jsm");
const {PromiseTestUtils} = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "sas",
"@mozilla.org/storage/activity-service;1",

Просмотреть файл

@ -1,7 +1,7 @@
requestLongerTimeout(2);
const {PlacesTestUtils} =
ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm", {});
ChromeUtils.import("resource://testing-common/PlacesTestUtils.jsm");
// Bug 453440 - Test the timespan-based logic of the sanitizer code
var now_mSec = Date.now();

Просмотреть файл

@ -17,7 +17,6 @@
* browser/base/content/test/sanitize/browser_sanitize-timespans.js.
*/
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "Timer",
"resource://gre/modules/Timer.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesTestUtils",

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
Downloads: "resource://gre/modules/Downloads.jsm",

Просмотреть файл

@ -113,7 +113,7 @@ add_task(async function() {
};
let oldProxyType = Services.prefs.getIntPref("network.proxy.type");
Services.prefs.setIntPref("network.proxy.type", Ci.nsIProtocolProxyService.PROXYCONFIG_SYSTEM);
let { MockRegistrar } = ChromeUtils.import("resource://testing-common/MockRegistrar.jsm", {});
let { MockRegistrar } = ChromeUtils.import("resource://testing-common/MockRegistrar.jsm");
let mockProxy = MockRegistrar.register("@mozilla.org/system-proxy-settings;1",
systemProxySettings);
// Register cleanup to undo the configuration changes we've made.

Просмотреть файл

@ -1,4 +1,4 @@
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
/**
* Returns a Promise that resolves once a new tab has been opened in

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше