Skip to content

Instantly share code, notes, and snippets.

@kmaglione

kmaglione/stdin.diff Secret

Created Jan 16, 2019
Embed
What would you like to do?
This file has been truncated, but you can view the full file.
# HG changeset patch
# User Kris Maglione <maglione.k@gmail.com>
# Date 1547261659 28800
# Fri Jan 11 18:54:19 2019 -0800
# Node ID 9d7c2cc68a13da93797b1b3822969bc5a4059570
# Parent 81c25e753faedf9b7547a320109a86211ef416a8
Bug 1514594: Part 3b - Mass rewrite all JS code to use the new ChromeUtils.import API. r=Gijs
This was done using the followng script:
https://bitbucket.org/kmaglione/m-c-rewrites/src/tip/processors/cu-import-exports.jsm
diff --git accessible/jsat/AccessFu.jsm accessible/jsat/AccessFu.jsm
--- accessible/jsat/AccessFu.jsm
+++ accessible/jsat/AccessFu.jsm
@@ -1,18 +1,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 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");
const GECKOVIEW_MESSAGE = {
ACTIVATE: "GeckoView:AccessibilityActivate",
BY_GRANULARITY: "GeckoView:AccessibilityByGranularity",
CLIPBOARD: "GeckoView:AccessibilityClipboard",
CURSOR_TO_FOCUSED: "GeckoView:AccessibilityCursorToFocused",
@@ -46,17 +46,17 @@ var AccessFu = {
* Start AccessFu mode.
*/
enable: function enable() {
if (this._enabled) {
return;
}
this._enabled = true;
- ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
+ const {Logger, Utils} = 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);
for (let win of Services.wm.getEnumerator(null)) {
this._attachWindow(win);
}
diff --git accessible/jsat/Constants.jsm accessible/jsat/Constants.jsm
--- accessible/jsat/Constants.jsm
+++ accessible/jsat/Constants.jsm
@@ -1,9 +1,9 @@
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const AndroidEvents = {
VIEW_CLICKED: 0x01,
VIEW_LONG_CLICKED: 0x02,
VIEW_SELECTED: 0x04,
VIEW_FOCUSED: 0x08,
VIEW_TEXT_CHANGED: 0x10,
WINDOW_STATE_CHANGED: 0x20,
diff --git accessible/jsat/Traversal.jsm accessible/jsat/Traversal.jsm
--- accessible/jsat/Traversal.jsm
+++ accessible/jsat/Traversal.jsm
@@ -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";
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
"resource://gre/modules/accessibility/Constants.jsm");
ChromeUtils.defineModuleGetter(this, "States", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
ChromeUtils.defineModuleGetter(this, "Prefilters", // jshint ignore:line
"resource://gre/modules/accessibility/Constants.jsm");
diff --git accessible/tests/mochitest/browser.js accessible/tests/mochitest/browser.js
--- accessible/tests/mochitest/browser.js
+++ accessible/tests/mochitest/browser.js
@@ -1,9 +1,9 @@
-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.
*/
function openBrowserWindow(aFunc, aURL, aRect) {
gBrowserContext.testFunc = aFunc;
gBrowserContext.startURL = aURL;
gBrowserContext.browserRect = aRect;
@@ -86,17 +86,17 @@ function urlbarInput() {
*/
function reloadButton() {
return browserWindow().document.getElementById("urlbar-reload-button");
}
// //////////////////////////////////////////////////////////////////////////////
// private section
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var gBrowserContext =
{
browserWnd: null,
testFunc: null,
startURL: "",
};
diff --git accessible/tests/mochitest/common.js accessible/tests/mochitest/common.js
--- accessible/tests/mochitest/common.js
+++ accessible/tests/mochitest/common.js
@@ -82,17 +82,17 @@ const kDiscBulletText = kDiscBulletChar
const kCircleBulletText = String.fromCharCode(0x25e6) + " ";
const kSquareBulletText = String.fromCharCode(0x25fe) + " ";
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.
*/
var gAccService = Cc["@mozilla.org/accessibilityService;1"].
getService(nsIAccessibilityService);
/**
diff --git accessible/tests/mochitest/events.js accessible/tests/mochitest/events.js
--- accessible/tests/mochitest/events.js
+++ accessible/tests/mochitest/events.js
@@ -35,17 +35,17 @@ const EVENT_TEXT_VALUE_CHANGE = nsIAcces
const EVENT_VIRTUALCURSOR_CHANGED = nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED;
const kNotFromUserInput = 0;
const kFromUserInput = 1;
// //////////////////////////////////////////////////////////////////////////////
// General
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
/**
* Set up this variable to dump events into DOM.
*/
var gA11yEventDumpID = "";
/**
* Set up this variable to dump event processing into console.
diff --git accessible/tests/mochitest/events/docload/test_docload_root.html accessible/tests/mochitest/events/docload/test_docload_root.html
--- accessible/tests/mochitest/events/docload/test_docload_root.html
+++ accessible/tests/mochitest/events/docload/test_docload_root.html
@@ -83,17 +83,17 @@
}
// //////////////////////////////////////////////////////////////////////////
// Do tests
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;
let hiddenDocAcc = gAccService.getAccessibleFor(doc);
ok(!hiddenDocAcc, "hiddenDOMWindow should not have an accessible.");
// Try to create an accessible for the private hidden window's doc.
let privateDoc = Services.appShell.hiddenPrivateDOMWindow.document;
diff --git accessible/tests/mochitest/events/docload/test_docload_shutdown.html accessible/tests/mochitest/events/docload/test_docload_shutdown.html
--- accessible/tests/mochitest/events/docload/test_docload_shutdown.html
+++ accessible/tests/mochitest/events/docload/test_docload_shutdown.html
@@ -105,17 +105,17 @@
}
// //////////////////////////////////////////////////////////////////////////
// Do tests
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;
let hiddenDocAcc = gAccService.getAccessibleFor(doc);
ok(!hiddenDocAcc, "hiddenDOMWindow should not have an accessible.");
// Try to create an accessible for the private hidden window's doc.
diff --git accessible/tests/mochitest/events/test_textattrchange.html accessible/tests/mochitest/events/test_textattrchange.html
--- accessible/tests/mochitest/events/test_textattrchange.html
+++ accessible/tests/mochitest/events/test_textattrchange.html
@@ -19,17 +19,17 @@
src="../states.js"></script>
<script type="application/javascript"
src="../events.js"></script>
<script type="application/javascript"
src="../attributes.js"></script>
<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);
this.eventSeq = [
new invokerChecker(EVENT_TEXT_ATTRIBUTE_CHANGED, this.DOMNode),
];
diff --git accessible/tests/mochitest/jsat/jsatcommon.js accessible/tests/mochitest/jsat/jsatcommon.js
--- accessible/tests/mochitest/jsat/jsatcommon.js
+++ accessible/tests/mochitest/jsat/jsatcommon.js
@@ -9,18 +9,18 @@
* A global variable holding an array of test functions.
*/
var gTestFuncs = [];
/**
* A global Iterator for the array of test functions.
*/
var gIterator;
-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");
const MovementGranularity = {
CHARACTER: 1,
WORD: 2,
LINE: 4,
PARAGRAPH: 8,
};
@@ -138,17 +138,17 @@ var AccessFuTest = {
yield testFunc;
}
})();
Logger.useConsoleService = true;
Logger.logLevel = Logger.DEBUG;
// Start AccessFu and put it in stand-by.
- ChromeUtils.import("resource://gre/modules/accessibility/AccessFu.jsm");
+ const {AccessFu} = ChromeUtils.import("resource://gre/modules/accessibility/AccessFu.jsm");
var prefs = [["accessibility.accessfu.notify_output", 1]];
prefs.push.apply(prefs, aAdditionalPrefs);
SpecialPowers.pushPrefEnv({ "set": prefs }, function() {
if (AccessFuTest._waitForExplicitFinish) {
// Run all test functions asynchronously.
AccessFuTest.nextTest();
@@ -208,17 +208,17 @@ class AccessFuContentTestRunner {
isFocused(aExpected) {
var doc = currentTabDocument();
SimpleTest.is(doc.activeElement, doc.querySelector(aExpected),
"Correct element is focused: " + aExpected);
}
async setupMessageManager(aMessageManager) {
function contentScript() {
- ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
+ const {Logger, Utils} = ChromeUtils.import("resource://gre/modules/accessibility/Utils.jsm");
Logger.logLevel = "DEBUG";
Utils.inTest = true;
addMessageListener("AccessFuTest:Focus", aMessage => {
var elem = content.document.querySelector(aMessage.data.selector);
if (elem) {
elem.focus();
}
diff --git accessible/tests/mochitest/jsat/output.js accessible/tests/mochitest/jsat/output.js
--- accessible/tests/mochitest/jsat/output.js
+++ accessible/tests/mochitest/jsat/output.js
@@ -1,11 +1,11 @@
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);
/**
* Test context output generation.
*
* @param expected {Array} expected output.
* @param aAccOrElmOrID identifier to get an accessible to test.
* @param aOldAccOrElmOrID optional identifier to get an accessible relative to
diff --git accessible/tests/mochitest/jsat/test_traversal.html accessible/tests/mochitest/jsat/test_traversal.html
--- accessible/tests/mochitest/jsat/test_traversal.html
+++ accessible/tests/mochitest/jsat/test_traversal.html
@@ -16,17 +16,17 @@
<script type="application/javascript" src="../browser.js"></script>
<script type="application/javascript" src="../events.js"></script>
<script type="application/javascript" src="../role.js"></script>
<script type="application/javascript" src="../states.js"></script>
<script type="application/javascript" src="../pivot.js"></script>
<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;
function doTest() {
var doc = currentTabDocument();
var docAcc = getAccessible(doc, [nsIAccessibleDocument]);
gQueue = new eventQueue();
diff --git accessible/tests/mochitest/jsat/test_traversal_helper.html accessible/tests/mochitest/jsat/test_traversal_helper.html
--- accessible/tests/mochitest/jsat/test_traversal_helper.html
+++ accessible/tests/mochitest/jsat/test_traversal_helper.html
@@ -16,17 +16,17 @@
<script type="application/javascript" src="../browser.js"></script>
<script type="application/javascript" src="../events.js"></script>
<script type="application/javascript" src="../role.js"></script>
<script type="application/javascript" src="../states.js"></script>
<script type="application/javascript" src="../pivot.js"></script>
<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;
function accessibleIs(aAccessible, aExpected, aMessage) {
if (!aAccessible && aAccessible == aExpected) {
ok(true, "Accessible is null. " + aMessage);
} else {
ok(aAccessible.DOMNode.id == aExpected || aAccessible.name == aExpected,
diff --git browser/actors/AboutReaderChild.jsm browser/actors/AboutReaderChild.jsm
--- browser/actors/AboutReaderChild.jsm
+++ browser/actors/AboutReaderChild.jsm
@@ -1,17 +1,17 @@
/* vim: set ts=2 sw=2 sts=2 et 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";
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");
ChromeUtils.defineModuleGetter(this, "ReaderMode",
"resource://gre/modules/ReaderMode.jsm");
ChromeUtils.defineModuleGetter(this, "Readerable",
"resource://gre/modules/Readerable.jsm");
diff --git browser/actors/BlockedSiteChild.jsm browser/actors/BlockedSiteChild.jsm
--- browser/actors/BlockedSiteChild.jsm
+++ browser/actors/BlockedSiteChild.jsm
@@ -1,18 +1,18 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
-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");
ChromeUtils.defineModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
function getSiteBlockedErrorDetails(docShell) {
let blockedInfo = {};
diff --git browser/actors/BrowserTabChild.jsm browser/actors/BrowserTabChild.jsm
--- browser/actors/BrowserTabChild.jsm
+++ browser/actors/BrowserTabChild.jsm
@@ -1,17 +1,17 @@
/* vim: set ts=2 sw=2 sts=2 et 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";
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");
class BrowserTabChild extends ActorChild {
handleEvent(event) {
switch (event.type) {
case "DOMWindowCreated":
diff --git browser/actors/ClickHandlerChild.jsm browser/actors/ClickHandlerChild.jsm
--- browser/actors/ClickHandlerChild.jsm
+++ browser/actors/ClickHandlerChild.jsm
@@ -1,17 +1,17 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
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");
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
ChromeUtils.defineModuleGetter(this, "WebNavigationFrames",
"resource://gre/modules/WebNavigationFrames.jsm");
diff --git browser/actors/ContentSearchChild.jsm browser/actors/ContentSearchChild.jsm
--- browser/actors/ContentSearchChild.jsm
+++ browser/actors/ContentSearchChild.jsm
@@ -1,17 +1,17 @@
/* vim: set ts=2 sw=2 sts=2 et 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";
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) {
this._sendMsg(event.detail.type, event.detail.data);
}
receiveMessage(msg) {
this._fireEvent(msg.data.type, msg.data.data);
diff --git browser/actors/ContextMenuChild.jsm browser/actors/ContextMenuChild.jsm
--- browser/actors/ContextMenuChild.jsm
+++ browser/actors/ContextMenuChild.jsm
@@ -3,20 +3,20 @@
/* 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 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"]);
XPCOMUtils.defineLazyModuleGetters(this, {
E10SUtils: "resource://gre/modules/E10SUtils.jsm",
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
findAllCssSelectors: "resource://gre/modules/css-selector.js",
SpellCheckHelper: "resource://gre/modules/InlineSpellChecker.jsm",
diff --git browser/actors/DOMFullscreenChild.jsm browser/actors/DOMFullscreenChild.jsm
--- browser/actors/DOMFullscreenChild.jsm
+++ browser/actors/DOMFullscreenChild.jsm
@@ -1,17 +1,17 @@
/* vim: set ts=2 sw=2 sts=2 et 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";
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) {
let windowUtils = this.content && this.content.windowUtils;
switch (aMessage.name) {
case "DOMFullscreen:Entered": {
this._lastTransactionId = windowUtils.lastTransactionId;
if (!windowUtils.handleFullscreenRequests() &&
diff --git browser/actors/FormSubmitChild.jsm browser/actors/FormSubmitChild.jsm
--- browser/actors/FormSubmitChild.jsm
+++ browser/actors/FormSubmitChild.jsm
@@ -5,19 +5,19 @@
/*
* Handles the validation callback from nsIFormFillController and
* the display of the help panel on invalid elements.
*/
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) {
super(dispatcher);
this._validationMessage = "";
this._element = null;
diff --git browser/actors/LightWeightThemeInstallChild.jsm browser/actors/LightWeightThemeInstallChild.jsm
--- browser/actors/LightWeightThemeInstallChild.jsm
+++ browser/actors/LightWeightThemeInstallChild.jsm
@@ -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/. */
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) {
let {mm} = this;
switch (event.type) {
case "InstallBrowserTheme": {
mm.sendAsyncMessage("LightWeightThemeWebInstaller:Install", {
baseURI: event.target.baseURI,
diff --git browser/actors/LightweightThemeChild.jsm browser/actors/LightweightThemeChild.jsm
--- browser/actors/LightweightThemeChild.jsm
+++ browser/actors/LightweightThemeChild.jsm
@@ -1,18 +1,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 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.
* It is both instantiated by the traditional Actor mechanism,
* and also manually within the sidebar JS global (which has no message manager)
*/
class LightweightThemeChild extends ActorChild {
constructor(dispatcher) {
diff --git browser/actors/LinkHandlerChild.jsm browser/actors/LinkHandlerChild.jsm
--- browser/actors/LinkHandlerChild.jsm
+++ browser/actors/LinkHandlerChild.jsm
@@ -1,18 +1,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";
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");
class LinkHandlerChild extends ActorChild {
constructor(dispatcher) {
super(dispatcher);
diff --git browser/actors/NetErrorChild.jsm browser/actors/NetErrorChild.jsm
--- browser/actors/NetErrorChild.jsm
+++ browser/actors/NetErrorChild.jsm
@@ -1,18 +1,18 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
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");
ChromeUtils.defineModuleGetter(this, "WebNavigationFrames",
"resource://gre/modules/WebNavigationFrames.jsm");
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);
diff --git browser/actors/OfflineAppsChild.jsm browser/actors/OfflineAppsChild.jsm
--- browser/actors/OfflineAppsChild.jsm
+++ browser/actors/OfflineAppsChild.jsm
@@ -1,18 +1,18 @@
/* vim: set ts=2 sw=2 sts=2 et tw=80: */
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
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) {
super(dispatcher);
this._docId = 0;
this._docIdMap = new Map();
diff --git browser/actors/PageInfoChild.jsm browser/actors/PageInfoChild.jsm
--- browser/actors/PageInfoChild.jsm
+++ browser/actors/PageInfoChild.jsm
@@ -1,18 +1,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/. */
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",
setTimeout: "resource://gre/modules/Timer.jsm",
});
class PageInfoChild extends ActorChild {
/* nsIMessageListener */
diff --git browser/actors/PageStyleChild.jsm browser/actors/PageStyleChild.jsm
--- browser/actors/PageStyleChild.jsm
+++ browser/actors/PageStyleChild.jsm
@@ -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/. */
-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) {
return content.docShell.contentViewer;
}
sendStyleSheetInfo(mm) {
let content = mm.content;
diff --git browser/actors/PluginChild.jsm browser/actors/PluginChild.jsm
--- browser/actors/PluginChild.jsm
+++ browser/actors/PluginChild.jsm
@@ -1,21 +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";
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");
XPCOMUtils.defineLazyGetter(this, "gNavigatorBundle", function() {
const url = "chrome://browser/locale/browser.properties";
return Services.strings.createBundle(url);
});
diff --git browser/actors/SearchTelemetryChild.jsm browser/actors/SearchTelemetryChild.jsm
--- browser/actors/SearchTelemetryChild.jsm
+++ browser/actors/SearchTelemetryChild.jsm
@@ -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";
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";
/**
* SearchProviders looks after keeping track of the search provider information
* received from the main process.
*
* It is separate to SearchTelemetryChild so that it is not constructed for each
diff --git browser/actors/URIFixupChild.jsm browser/actors/URIFixupChild.jsm
--- browser/actors/URIFixupChild.jsm
+++ browser/actors/URIFixupChild.jsm
@@ -1,17 +1,17 @@
/* vim: set ts=2 sw=2 sts=2 et 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";
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) {
let fixupInfo = subject.QueryInterface(Ci.nsIURIFixupInfo);
if (!fixupInfo.consumer) {
return;
}
diff --git browser/actors/WebRTCChild.jsm browser/actors/WebRTCChild.jsm
--- browser/actors/WebRTCChild.jsm
+++ browser/actors/WebRTCChild.jsm
@@ -1,20 +1,20 @@
/* 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 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");
const kBrowserURL = AppConstants.BROWSER_CHROME_URL;
class WebRTCChild extends ActorChild {
// Called only for 'unload' to remove pending gUM prompts in reloaded frames.
diff --git browser/base/content/aboutDialog-appUpdater.js browser/base/content/aboutDialog-appUpdater.js
--- browser/base/content/aboutDialog-appUpdater.js
+++ browser/base/content/aboutDialog-appUpdater.js
@@ -2,18 +2,18 @@
* 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/. */
// Note: this file is included in aboutDialog.xul and preferences/advanced.xul
// if MOZ_UPDATER is defined.
/* 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");
+var {DownloadUtils} = ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm");
ChromeUtils.defineModuleGetter(this, "UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm");
const PREF_APP_UPDATE_CANCELATIONS_OSX = "app.update.cancelations.osx";
const PREF_APP_UPDATE_ELEVATE_NEVER = "app.update.elevate.never";
var gAppUpdater;
diff --git browser/base/content/aboutDialog.js browser/base/content/aboutDialog.js
--- browser/base/content/aboutDialog.js
+++ browser/base/content/aboutDialog.js
@@ -2,18 +2,18 @@
* 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 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)
return;
var distroId = Services.prefs.getCharPref("distribution.id", "");
if (distroId) {
var distroString = distroId;
diff --git browser/base/content/aboutRestartRequired.js browser/base/content/aboutRestartRequired.js
--- browser/base/content/aboutRestartRequired.js
+++ browser/base/content/aboutRestartRequired.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/. */
/* 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
don't want to call attention to ourselves! The key part is
that autofocus happens on insertion into the tree, so we
can remove the button, add @autofocus, and reinsert the
button.
*/
diff --git browser/base/content/browser-ctrlTab.js browser/base/content/browser-ctrlTab.js
--- browser/base/content/browser-ctrlTab.js
+++ browser/base/content/browser-ctrlTab.js
@@ -5,17 +5,17 @@
// This file is loaded into the browser window scope.
/* eslint-env mozilla/browser-window */
/**
* Tab previews utility, produces thumbnails
*/
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;
},
get: function tabPreviews_get(aTab) {
let uri = aTab.linkedBrowser.currentURI.spec;
diff --git browser/base/content/browser-data-submission-info-bar.js browser/base/content/browser-data-submission-info-bar.js
--- browser/base/content/browser-data-submission-info-bar.js
+++ browser/base/content/browser-data-submission-info-bar.js
@@ -9,17 +9,17 @@ var gDataNotificationInfoBar = {
_OBSERVERS: [
"datareporting:notify-data-policy:request",
"datareporting:notify-data-policy:close",
],
_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::");
},
init() {
window.addEventListener("unload", () => {
for (let o of this._OBSERVERS) {
diff --git browser/base/content/browser-plugins.js browser/base/content/browser-plugins.js
--- browser/base/content/browser-plugins.js
+++ browser/base/content/browser-plugins.js
@@ -77,17 +77,17 @@ var gPluginHandler = {
// Callback for user clicking on a disabled plugin
managePlugins() {
BrowserOpenAddonsMgr("addons://list/plugin");
},
// 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");
},
submitReport: function submitReport(runID, keyVals, submitURLOptIn) {
if (!AppConstants.MOZ_CRASHREPORTER) {
return;
}
diff --git browser/base/content/browser-sync.js browser/base/content/browser-sync.js
--- browser/base/content/browser-sync.js
+++ browser/base/content/browser-sync.js
@@ -1,16 +1,16 @@
/* 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/. */
// 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");
ChromeUtils.defineModuleGetter(this, "EnsureFxAccountsWebChannel",
"resource://gre/modules/FxAccountsWebChannel.jsm");
ChromeUtils.defineModuleGetter(this, "Weave",
"resource://services-sync/main.js");
diff --git browser/base/content/browser.js browser/base/content/browser.js
--- browser/base/content/browser.js
+++ browser/base/content/browser.js
@@ -1,16 +1,16 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
* 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/. */
-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
XPCOMUtils.defineLazyModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
BrowserUsageTelemetry: "resource:///modules/BrowserUsageTelemetry.jsm",
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
@@ -170,17 +170,17 @@ XPCOMUtils.defineLazyGetter(this, "gBrow
});
XPCOMUtils.defineLazyGetter(this, "gTabBrowserBundle", () => {
return Services.strings.createBundle("chrome://browser/locale/tabbrowser.properties");
});
XPCOMUtils.defineLazyGetter(this, "gCustomizeMode", () => {
let { CustomizeMode } =
- ChromeUtils.import("resource:///modules/CustomizeMode.jsm", {});
+ ChromeUtils.import("resource:///modules/CustomizeMode.jsm");
return new CustomizeMode(window);
});
XPCOMUtils.defineLazyGetter(this, "gNavToolbox", () => {
return document.getElementById("navigator-toolbox");
});
XPCOMUtils.defineLazyGetter(this, "gURLBar", () => {
@@ -219,31 +219,31 @@ XPCOMUtils.defineLazyGetter(this, "gNoti
element.classList.add("global-notificationbox");
element.setAttribute("notificationside", "bottom");
document.getElementById("browser-bottombox").appendChild(element);
});
});
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.
// We also have to hide notifications explicitly when the window is
// minimized because of the effects of the "noautohide" attribute on Linux.
// This can be removed once bug 545265 and bug 1320361 are fixed.
let shouldSuppress = () => {
return window.windowState == window.STATE_MINIMIZED ||
@@ -263,17 +263,17 @@ XPCOMUtils.defineLazyGetter(this, "Popup
XPCOMUtils.defineLazyGetter(this, "Win7Features", () => {
if (AppConstants.platform != "win")
return null;
const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
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);
this.handledOpening = true;
},
onCloseWindow() {
if (this.handledOpening) {
AeroPeek.onCloseWindow(window);
@@ -1411,17 +1411,17 @@ var gBrowserInit = {
_cancelDelayedStartup() {
window.removeEventListener("MozAfterPaint", this._boundDelayedStartup);
this._boundDelayedStartup = null;
},
_delayedStartup() {
let { TelemetryTimestamps } =
- ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm", {});
+ ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm");
TelemetryTimestamps.add("delayedStartupStarted");
this._cancelDelayedStartup();
// We need to set the OfflineApps message listeners up before we
// load homepages, which might need them.
OfflineApps.init();
@@ -1537,17 +1537,17 @@ var gBrowserInit = {
window.addEventListener("mousemove", MousePosTracker);
window.addEventListener("dragover", MousePosTracker);
gNavToolbox.addEventListener("customizationstarting", CustomizationHandler);
gNavToolbox.addEventListener("customizationending", CustomizationHandler);
if (AppConstants.platform == "linux") {
let { WindowDraggingElement } =
- ChromeUtils.import("resource://gre/modules/WindowDraggingUtils.jsm", {});
+ ChromeUtils.import("resource://gre/modules/WindowDraggingUtils.jsm");
new WindowDraggingElement(document.getElementById("titlebar"));
}
SessionStore.promiseInitialized.then(() => {
// Bail out if the window has been closed in the meantime.
if (window.closed) {
return;
}
diff --git browser/base/content/content-refreshblocker.js browser/base/content/content-refreshblocker.js
--- browser/base/content/content-refreshblocker.js
+++ browser/base/content/content-refreshblocker.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/. */
/* eslint-env mozilla/frame-script */
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var RefreshBlocker = {
PREF: "accessibility.blockautorefresh",
// Bug 1247100 - When a refresh is caused by an HTTP header,
// onRefreshAttempted will be fired before onLocationChange.
// When a refresh is caused by a <meta> tag in the document,
// onRefreshAttempted will be fired after onLocationChange.
diff --git browser/base/content/content.js browser/base/content/content.js
--- browser/base/content/content.js
+++ browser/base/content/content.js
@@ -4,17 +4,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* This content script should work in any browser or iframe and should not
* depend on the frame being contained in tabbrowser. */
/* 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;
XPCOMUtils.defineLazyModuleGetters(this, {
ContentMetaHandler: "resource:///modules/ContentMetaHandler.jsm",
LoginFormFactory: "resource://gre/modules/LoginManagerContent.jsm",
InsecurePasswordUtils: "resource://gre/modules/InsecurePasswordUtils.jsm",
diff --git browser/base/content/nsContextMenu.js browser/base/content/nsContextMenu.js
--- browser/base/content/nsContextMenu.js
+++ browser/base/content/nsContextMenu.js
@@ -1,18 +1,18 @@
/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 sw=2 sts=2 et 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/. */
-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",
LoginHelper: "resource://gre/modules/LoginHelper.jsm",
LoginManagerContextMenu: "resource://gre/modules/LoginManagerContextMenu.jsm",
WebNavigationFrames: "resource://gre/modules/WebNavigationFrames.jsm",
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
DevToolsShim: "chrome://devtools-startup/content/DevToolsShim.jsm",
diff --git browser/base/content/pageinfo/pageInfo.js browser/base/content/pageinfo/pageInfo.js
--- browser/base/content/pageinfo/pageInfo.js
+++ browser/base/content/pageinfo/pageInfo.js
@@ -1,13 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = 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 */
/* import-globals-from ../utilityOverlay.js */
/* import-globals-from permissions.js */
/* import-globals-from security.js */
diff --git browser/base/content/pageinfo/permissions.js browser/base/content/pageinfo/permissions.js
--- browser/base/content/pageinfo/permissions.js
+++ browser/base/content/pageinfo/permissions.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/. */
/* import-globals-from pageInfo.js */
-ChromeUtils.import("resource:///modules/SitePermissions.jsm");
+const {SitePermissions} = ChromeUtils.import("resource:///modules/SitePermissions.jsm");
ChromeUtils.import("resource://gre/modules/BrowserUtils.jsm");
var gPermURI;
var gPermPrincipal;
var gUsageRequest;
// Array of permissionIDs sorted alphabetically by label.
var gPermissions = SitePermissions.listPermissions()
diff --git browser/base/content/pageinfo/security.js browser/base/content/pageinfo/security.js
--- browser/base/content/pageinfo/security.js
+++ browser/base/content/pageinfo/security.js
@@ -1,16 +1,16 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
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 */
ChromeUtils.defineModuleGetter(this, "LoginHelper",
"resource://gre/modules/LoginHelper.jsm");
ChromeUtils.defineModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
diff --git browser/base/content/safeMode.js browser/base/content/safeMode.js
--- browser/base/content/safeMode.js
+++ browser/base/content/safeMode.js
@@ -1,18 +1,18 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* 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/. */
-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;
function restartApp() {
appStartup.quit(appStartup.eForceQuit | appStartup.eRestart);
}
function resetProfile() {
diff --git browser/base/content/sanitizeDialog.js browser/base/content/sanitizeDialog.js
--- browser/base/content/sanitizeDialog.js
+++ browser/base/content/sanitizeDialog.js
@@ -1,16 +1,16 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* import-globals-from ../../../toolkit/content/preferencesBindings.js */
-var {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm", {});
+var {Sanitizer} = ChromeUtils.import("resource:///modules/Sanitizer.jsm");
Preferences.addAll([
{ id: "privacy.cpd.history", type: "bool" },
{ id: "privacy.cpd.formdata", type: "bool" },
{ id: "privacy.cpd.downloads", type: "bool", disabled: true },
{ id: "privacy.cpd.cookies", type: "bool" },
{ id: "privacy.cpd.cache", type: "bool" },
{ id: "privacy.cpd.sessions", type: "bool" },
diff --git browser/base/content/tab-content.js browser/base/content/tab-content.js
--- browser/base/content/tab-content.js
+++ browser/base/content/tab-content.js
@@ -3,34 +3,34 @@
* 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/. */
/* This content script contains code that requires a tab browser. */
/* 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");
// TabChildGlobal
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);
}
var WebBrowserChrome = {
onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab) {
return BrowserUtils.onBeforeLinkTraversal(originalTarget, linkURI, linkNode, isAppTab);
},
diff --git browser/base/content/test/about/browser_aboutCertError.js browser/base/content/test/about/browser_aboutCertError.js
--- browser/base/content/test/about/browser_aboutCertError.js
+++ browser/base/content/test/about/browser_aboutCertError.js
@@ -5,17 +5,17 @@
// This is testing the aboutCertError page (Bug 1207107).
const GOOD_PAGE = "https://example.com/";
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() {
info("Loading a bad cert page directly and making sure 'return to previous page' goes to about:home");
for (let useFrame of [false, true]) {
let tab = await openErrorPage(BAD_CERT, useFrame);
let browser = tab.linkedBrowser;
diff --git browser/base/content/test/about/head.js browser/base/content/test/about/head.js
--- browser/base/content/test/about/head.js
+++ browser/base/content/test/about/head.js
@@ -116,17 +116,17 @@ function promiseTabLoadEvent(tab, url) {
* However, the browser UI will behave differently for loads stopped directly from
* the progress listener (effectively in the middle of a call to loadURI) and so there
* are cases where you may want to avoid stopping the load directly from within the
* progress listener callback.
* @return promise
*/
function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrowser, aStopFromProgressListener = true) {
function content_script(contentStopFromProgressListener) {
- ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
let wp = docShell.QueryInterface(Ci.nsIWebProgress);
function stopContent(now, uri) {
if (now) {
/* Hammer time. */
content.stop();
/* Let the parent know we're done. */
diff --git browser/base/content/test/alerts/browser_notification_close.js browser/base/content/test/alerts/browser_notification_close.js
--- browser/base/content/test/alerts/browser_notification_close.js
+++ browser/base/content/test/alerts/browser_notification_close.js
@@ -1,12 +1,12 @@
"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;
add_task(async function test_notificationClose() {
let notificationURI = makeURI(notificationURL);
await addNotificationPermission(notificationURL);
diff --git browser/base/content/test/captivePortal/head.js browser/base/content/test/captivePortal/head.js
--- browser/base/content/test/captivePortal/head.js
+++ browser/base/content/test/captivePortal/head.js
@@ -1,9 +1,9 @@
-ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
+var {BrowserWindowTracker} = ChromeUtils.import("resource:///modules/BrowserWindowTracker.jsm");
ChromeUtils.defineModuleGetter(this, "CaptivePortalWatcher",
"resource:///modules/CaptivePortalWatcher.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "cps",
"@mozilla.org/network/captive-portal-service;1",
"nsICaptivePortalService");
diff --git browser/base/content/test/chrome/test_aboutCrashed.xul browser/base/content/test/chrome/test_aboutCrashed.xul
--- browser/base/content/test/chrome/test_aboutCrashed.xul
+++ browser/base/content/test/chrome/test_aboutCrashed.xul
@@ -7,17 +7,17 @@
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<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();
// Load error pages do not fire "load" events, so let's use a progressListener.
function waitForErrorPage(frame) {
return new Promise(resolve => {
let progressListener = {
diff --git browser/base/content/test/chrome/test_aboutRestartRequired.xul browser/base/content/test/chrome/test_aboutRestartRequired.xul
--- browser/base/content/test/chrome/test_aboutRestartRequired.xul
+++ browser/base/content/test/chrome/test_aboutRestartRequired.xul
@@ -7,17 +7,17 @@
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<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();
// Load error pages do not fire "load" events, so let's use a progressListener.
function waitForErrorPage(frame) {
return new Promise(resolve => {
let progressListener = {
onLocationChange: function(aWebProgress, aRequest, aLocation, aFlags) {
diff --git browser/base/content/test/favicons/head.js browser/base/content/test/favicons/head.js
--- browser/base/content/test/favicons/head.js
+++ browser/base/content/test/favicons/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/XPCOMUtils.jsm");
+var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
// Clear the network cache between every test to make sure we get a stable state
Services.cache2.clear();
function waitForFaviconMessage(isTabIcon = undefined, expectedURL = undefined) {
diff --git browser/base/content/test/forms/head.js browser/base/content/test/forms/head.js
--- browser/base/content/test/forms/head.js
+++ browser/base/content/test/forms/head.js
@@ -1,13 +1,13 @@
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);
});
if (mode == "escape") {
EventUtils.synthesizeKey("KEY_Escape", {}, win);
} else if (mode == "enter") {
EventUtils.synthesizeKey("KEY_Enter", {}, win);
} else if (mode == "click") {
diff --git browser/base/content/test/general/browser_blob-channelname.js browser/base/content/test/general/browser_blob-channelname.js
--- browser/base/content/test/general/browser_blob-channelname.js
+++ browser/base/content/test/general/browser_blob-channelname.js
@@ -1,11 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
-ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
+const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
function test() {
var file = new File([new Blob(["test"], {type: "text/plain"})], "test-name");
var url = URL.createObjectURL(file);
var channel = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
is(channel.contentDispositionFilename, "test-name", "filename matches");
}
diff --git browser/base/content/test/general/browser_compacttheme.js browser/base/content/test/general/browser_compacttheme.js
--- browser/base/content/test/general/browser_compacttheme.js
+++ browser/base/content/test/general/browser_compacttheme.js
@@ -3,17 +3,17 @@
* A special stylesheet should be added to the browser.xul document
* when the firefox-compact-light and firefox-compact-dark lightweight
* themes are applied.
*/
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
LightweightThemeManager.currentTheme = null;
Services.prefs.clearUserPref(PREF_LWTHEME_USED_THEMES);
});
function tick() {
diff --git browser/base/content/test/general/browser_contentSearchUI.js browser/base/content/test/general/browser_contentSearchUI.js
--- browser/base/content/test/general/browser_contentSearchUI.js
+++ browser/base/content/test/general/browser_contentSearchUI.js
@@ -4,18 +4,17 @@
const TEST_PAGE_BASENAME = "contentSearchUI.html";
const TEST_CONTENT_SCRIPT_BASENAME = "contentSearchUI.js";
const TEST_ENGINE_PREFIX = "browser_searchSuggestionEngine";
const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
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);
requestLongerTimeout(2);
add_task(async function emptyInput() {
await setUp();
@@ -628,17 +627,17 @@ add_task(async function settings() {
await msg("reset");
});
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 = () => {};
ContentSearch._onMessageManageEngines = () => {};
registerCleanupFunction(() => {
ContentSearch._onMessageSearch = originalOnMessageSearch;
ContentSearch._onMessageManageEngines = originalOnMessageManageEngines;
});
diff --git browser/base/content/test/general/browser_fullscreen-window-open.js browser/base/content/test/general/browser_fullscreen-window-open.js
--- browser/base/content/test/general/browser_fullscreen-window-open.js
+++ browser/base/content/test/general/browser_fullscreen-window-open.js
@@ -1,11 +1,11 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = 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";
const isOSX = (Services.appinfo.OS === "Darwin");
const TEST_FILE = "file_fullscreen-window-open.html";
const gHttpTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/",
"http://127.0.0.1:8888/");
diff --git browser/base/content/test/general/browser_gZipOfflineChild.js browser/base/content/test/general/browser_gZipOfflineChild.js
--- browser/base/content/test/general/browser_gZipOfflineChild.js
+++ browser/base/content/test/general/browser_gZipOfflineChild.js
@@ -13,17 +13,17 @@ registerCleanupFunction(function() {
Services.prefs.clearUserPref("offline-apps.allow_by_default");
});
//
// Handle "message" events which are posted from the iframe upon
// 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; });
var cacheCount = 0;
var intervalID = 0;
function handleMessageEvents(event) {
diff --git browser/base/content/test/general/browser_newWindowDrop.js browser/base/content/test/general/browser_newWindowDrop.js
--- browser/base/content/test/general/browser_newWindowDrop.js
+++ browser/base/content/test/general/browser_newWindowDrop.js
@@ -12,17 +12,17 @@ add_task(async function test_setup() {
// Stop search-engine loads from hitting the network
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = Services.search.defaultEngine;
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",
CustomizableUI.AREA_NAVBAR,
0);
CustomizableUI.ensureWidgetPlacedInWindow("new-window-button", window);
registerCleanupFunction(function() {
CustomizableUI.removeWidgetFromArea("new-window-button");
diff --git browser/base/content/test/general/browser_offlineQuotaNotification.js browser/base/content/test/general/browser_offlineQuotaNotification.js
--- browser/base/content/test/general/browser_offlineQuotaNotification.js
+++ browser/base/content/test/general/browser_offlineQuotaNotification.js
@@ -10,17 +10,17 @@ const URL = "http://mochi.test:8888/brow
registerCleanupFunction(function() {
// Clean up after ourself
let uri = Services.io.newURI(URL);
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
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();
});
// Same as the other one, but for in-content preferences
function checkInContentPreferences(win) {
let doc = win.document;
let sel = doc.getElementById("categories").selectedItems[0].id;
is(gBrowser.currentURI.spec, "about:preferences#privacy", "about:preferences loaded");
diff --git browser/base/content/test/general/browser_remoteTroubleshoot.js browser/base/content/test/general/browser_remoteTroubleshoot.js
--- browser/base/content/test/general/browser_remoteTroubleshoot.js
+++ browser/base/content/test/general/browser_remoteTroubleshoot.js
@@ -1,13 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-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);
const TEST_URI_BAD = Services.io.newURI("http://" + TEST_URL_TAIL);
const TEST_URI_GOOD_OBJECT = Services.io.newURI("https://" + TEST_URL_TAIL + "?object");
// Creates a one-shot web-channel for the test data to be sent back from the test page.
function promiseChannelResponse(channelID, originOrPermission) {
diff --git browser/base/content/test/general/browser_restore_isAppTab.js browser/base/content/test/general/browser_restore_isAppTab.js
--- browser/base/content/test/general/browser_restore_isAppTab.js
+++ browser/base/content/test/general/browser_restore_isAppTab.js
@@ -1,14 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* 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";
function frameScript() {
addMessageListener("Test:GetIsAppTab", function() {
sendAsyncMessage("Test:IsAppTab", { isAppTab: docShell.isAppTab });
});
}
diff --git browser/base/content/test/general/browser_tab_detach_restore.js browser/base/content/test/general/browser_tab_detach_restore.js
--- browser/base/content/test/general/browser_tab_detach_restore.js
+++ browser/base/content/test/general/browser_tab_detach_restore.js
@@ -1,11 +1,11 @@
"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";
// Clear out the closed windows set to start
while (SessionStore.getClosedWindowCount() > 0)
SessionStore.forgetClosedWindow(0);
diff --git browser/base/content/test/general/browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js browser/base/content/test/general/browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js
--- browser/base/content/test/general/browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js
+++ browser/base/content/test/general/browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
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);
function frame_script() {
content.document.body.innerHTML = `
<a href="http://example.com/" target="_blank" rel="opener" id="testAnchor">Open a window</a>
`;
diff --git browser/base/content/test/general/browser_web_channel.js browser/base/content/test/general/browser_web_channel.js
--- browser/base/content/test/general/browser_web_channel.js
+++ browser/base/content/test/general/browser_web_channel.js
@@ -1,13 +1,13 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");
const HTTP_PATH = "http://example.com";
const HTTP_ENDPOINT = "/browser/browser/base/content/test/general/browser_web_channel.html";
const HTTP_MISMATCH_PATH = "http://example.org";
const HTTP_IFRAME_PATH = "http://mochi.test:8888";
const HTTP_REDIRECTED_IFRAME_PATH = "http://example.org";
diff --git browser/base/content/test/general/contextmenu_common.js browser/base/content/test/general/contextmenu_common.js
--- browser/base/content/test/general/contextmenu_common.js
+++ browser/base/content/test/general/contextmenu_common.js
@@ -285,18 +285,17 @@ async function test_contextmenu(selector
await options.preCheckContextMenuFn();
info("Completed preCheckContextMenuFn");
}
if (options.waitForSpellCheck) {
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");
});
}
let awaitPopupShown = BrowserTestUtils.waitForEvent(contextMenu, "popupshown");
await BrowserTestUtils.synthesizeMouse(selector, options.offsetX || 0, options.offsetY || 0, {
diff --git browser/base/content/test/metaTags/head.js browser/base/content/test/metaTags/head.js
--- browser/base/content/test/metaTags/head.js
+++ browser/base/content/test/metaTags/head.js
@@ -1,9 +1,9 @@
-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");
ChromeUtils.defineModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
/**
* Wait for url's page info (non-null description and preview url) to be set.
diff --git browser/base/content/test/pageinfo/browser_pageinfo_permissions.js browser/base/content/test/pageinfo/browser_pageinfo_permissions.js
--- browser/base/content/test/pageinfo/browser_pageinfo_permissions.js
+++ browser/base/content/test/pageinfo/browser_pageinfo_permissions.js
@@ -1,9 +1,9 @@
-ChromeUtils.import("resource:///modules/SitePermissions.jsm");
+const {SitePermissions} = ChromeUtils.import("resource:///modules/SitePermissions.jsm");
const TEST_ORIGIN = "https://example.com";
async function testPermissions(defaultPermission) {
await BrowserTestUtils.withNewTab(TEST_ORIGIN, async function(browser) {
let pageInfo = BrowserPageInfo(TEST_ORIGIN, "permTab");
await BrowserTestUtils.waitForEvent(pageInfo, "load");
diff --git browser/base/content/test/performance/browser_startup_content.js browser/base/content/test/performance/browser_startup_content.js
--- browser/base/content/test/performance/browser_startup_content.js
+++ browser/base/content/test/performance/browser_startup_content.js
@@ -99,17 +99,17 @@ add_task(async function() {
let mm = gBrowser.selectedBrowser.messageManager;
let promise = BrowserTestUtils.waitForMessage(mm, "Test:LoadedScripts");
// Load a custom frame script to avoid using ContentTask which loads Task.jsm
mm.loadFrameScript("data:text/javascript,(" + 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) {
/* Keep only the file name for components, as the path is an absolute file
URL rather than a resource:// URL like for modules. */
components[component.replace(/.*\//, "")] =
collectStacks ? Cu.getComponentLoadStack(component) : "";
}
diff --git browser/base/content/test/permissions/browser_temporary_permissions.js browser/base/content/test/permissions/browser_temporary_permissions.js
--- browser/base/content/test/permissions/browser_temporary_permissions.js
+++ browser/base/content/test/permissions/browser_temporary_permissions.js
@@ -1,14 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"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";
const SUBFRAME_PAGE = getRootDirectory(gTestPath).replace("chrome://mochitests/content", ORIGIN) + "temporary_permissions_subframe.html";
// Test that setting temp permissions triggers a change in the identity block.
add_task(async function testTempPermissionChangeEvents() {
let uri = NetUtil.newURI(ORIGIN);
diff --git browser/base/content/test/permissions/browser_temporary_permissions_expiry.js browser/base/content/test/permissions/browser_temporary_permissions_expiry.js
--- browser/base/content/test/permissions/browser_temporary_permissions_expiry.js
+++ browser/base/content/test/permissions/browser_temporary_permissions_expiry.js
@@ -3,17 +3,17 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
"use strict";
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;
const TIMEOUT_MS = 500;
// Test that temporary permissions can be re-requested after they expired
// and that the identity block is updated accordingly.
add_task(async function testTempPermissionRequestAfterExpiry() {
diff --git browser/base/content/test/plugins/blocklist_proxy.js browser/base/content/test/plugins/blocklist_proxy.js
--- browser/base/content/test/plugins/blocklist_proxy.js
+++ browser/base/content/test/plugins/blocklist_proxy.js
@@ -1,16 +1,16 @@
var Cm = Components.manager;
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");
/*
* A lightweight blocklist proxy for the testing purposes.
*/
var BlocklistProxy = {
_uuid: null,
diff --git browser/base/content/test/plugins/browser_clearplugindata.js browser/base/content/test/plugins/browser_clearplugindata.js
--- browser/base/content/test/plugins/browser_clearplugindata.js
+++ browser/base/content/test/plugins/browser_clearplugindata.js
@@ -1,17 +1,17 @@
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
var gTestBrowser = null;
// Test clearing plugin data using Sanitizer.jsm.
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);
pluginHost.QueryInterface(pluginHostIface);
var pluginTag = getTestPlugin();
function stored(needles) {
diff --git browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
--- browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.js
+++ browser/base/content/test/plugins/browser_pluginCrashReportNonDeterminism.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/PromiseUtils.jsm");
+const {PromiseUtils} = ChromeUtils.import("resource://gre/modules/PromiseUtils.jsm");
/**
* With e10s, plugins must run in their own process. This means we have
* three processes at a minimum when we're running a plugin:
*
* 1) The main browser, or "chrome" process
* 2) The content process hosting the plugin instance
* 3) The plugin process
diff --git browser/base/content/test/plugins/browser_private_clicktoplay.js browser/base/content/test/plugins/browser_private_clicktoplay.js
--- browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -1,17 +1,17 @@
var rootDir = getRootDirectory(gTestPath);
const gTestRoot = rootDir;
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gTestBrowser = null;
var gNextTest = null;
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var gPrivateWindow = null;
var gPrivateBrowser = null;
function finishTest() {
clearAllPluginPermissions();
gBrowser.removeCurrentTab();
if (gPrivateWindow) {
diff --git browser/base/content/test/plugins/head.js browser/base/content/test/plugins/head.js
--- browser/base/content/test/plugins/head.js
+++ browser/base/content/test/plugins/head.js
@@ -1,9 +1,9 @@
-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");
ChromeUtils.defineModuleGetter(this, "PromiseUtils",
"resource://gre/modules/PromiseUtils.jsm");
// Various tests in this directory may define gTestBrowser, to use as the
// default browser under test in some of the functions below.
diff --git browser/base/content/test/plugins/xbl/blocklist_proxy.js browser/base/content/test/plugins/xbl/blocklist_proxy.js
--- browser/base/content/test/plugins/xbl/blocklist_proxy.js
+++ browser/base/content/test/plugins/xbl/blocklist_proxy.js
@@ -1,16 +1,16 @@
var Cm = Components.manager;
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");
/*
* A lightweight blocklist proxy for the testing purposes.
*/
var BlocklistProxy = {
_uuid: null,
diff --git browser/base/content/test/plugins/xbl/browser_clearplugindata.js browser/base/content/test/plugins/xbl/browser_clearplugindata.js
--- browser/base/content/test/plugins/xbl/browser_clearplugindata.js
+++ browser/base/content/test/plugins/xbl/browser_clearplugindata.js
@@ -3,17 +3,17 @@
var gTestRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
var gTestBrowser = null;
// Test clearing plugin data using Sanitizer.jsm.
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);
pluginHost.QueryInterface(pluginHostIface);
var pluginTag = getTestPlugin();
function stored(needles) {
diff --git browser/base/content/test/plugins/xbl/browser_pluginCrashReportNonDeterminism.js browser/base/content/test/plugins/xbl/browser_pluginCrashReportNonDeterminism.js
--- browser/base/content/test/plugins/xbl/browser_pluginCrashReportNonDeterminism.js
+++ browser/base/content/test/plugins/xbl/browser_pluginCrashReportNonDeterminism.js
@@ -1,14 +1,14 @@
/* import-globals-from ../head.js */
/* 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
* three processes at a minimum when we're running a plugin:
*
* 1) The main browser, or "chrome" process
* 2) The content process hosting the plugin instance
* 3) The plugin process
diff --git browser/base/content/test/plugins/xbl/browser_private_clicktoplay.js browser/base/content/test/plugins/xbl/browser_private_clicktoplay.js
--- browser/base/content/test/plugins/xbl/browser_private_clicktoplay.js
+++ browser/base/content/test/plugins/xbl/browser_private_clicktoplay.js
@@ -3,17 +3,17 @@
var rootDir = getRootDirectory(gTestPath);
const gTestRoot = rootDir;
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
var gTestBrowser = null;
var gNextTest = null;
var gPluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var gPrivateWindow = null;
var gPrivateBrowser = null;
function finishTest() {
clearAllPluginPermissions();
gBrowser.removeCurrentTab();
if (gPrivateWindow) {
diff --git browser/base/content/test/popupNotifications/head.js browser/base/content/test/popupNotifications/head.js
--- browser/base/content/test/popupNotifications/head.js
+++ browser/base/content/test/popupNotifications/head.js
@@ -1,9 +1,9 @@
-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");
/**
* Called after opening a new window or switching windows, this will wait until
* we are sure that an attempt to display a notification will not fail.
*/
diff --git browser/base/content/test/popups/browser_popup_blocker_identity_block.js browser/base/content/test/popups/browser_popup_blocker_identity_block.js
--- browser/base/content/test/popups/browser_popup_blocker_identity_block.js
+++ browser/base/content/test/popups/browser_popup_blocker_identity_block.js
@@ -1,16 +1,16 @@
"use strict";
/* 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/. */
-ChromeUtils.import("resource:///modules/SitePermissions.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {SitePermissions} = ChromeUtils.import("resource:///modules/SitePermissions.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const baseURL = getRootDirectory(gTestPath).replace("chrome://mochitests/content", "http://example.com");
const URL = baseURL + "popup_blocker2.html";
const URI = Services.io.newURI(URL);
function openIdentityPopup() {
let promise = BrowserTestUtils.waitForEvent(gIdentityHandler._identityPopup, "popupshown");
gIdentityHandler._identityBox.click();
diff --git browser/base/content/test/referrer/head.js browser/base/content/test/referrer/head.js
--- browser/base/content/test/referrer/head.js
+++ browser/base/content/test/referrer/head.js
@@ -1,9 +1,9 @@
-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");
ChromeUtils.defineModuleGetter(this, "ContentTask",
"resource://testing-common/ContentTask.jsm");
const REFERRER_URL_BASE = "/browser/browser/base/content/test/referrer/";
const REFERRER_POLICYSERVER_URL =
diff --git browser/base/content/test/sanitize/SiteDataTestUtils.jsm browser/base/content/test/sanitize/SiteDataTestUtils.jsm
--- browser/base/content/test/sanitize/SiteDataTestUtils.jsm
+++ browser/base/content/test/sanitize/SiteDataTestUtils.jsm
@@ -1,20 +1,20 @@
"use strict";
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",
"nsIServiceWorkerManager");
/**
* This module assists with tasks around testing functionality that shows
* or clears site data.
diff --git browser/base/content/test/sanitize/browser_cookiePermission.js browser/base/content/test/sanitize/browser_cookiePermission.js
--- browser/base/content/test/sanitize/browser_cookiePermission.js
+++ browser/base/content/test/sanitize/browser_cookiePermission.js
@@ -1,11 +1,11 @@
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 => {
let data = true;
let uri = Services.io.newURI("about:newtab");
let principal =
Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
let request = indexedDB.openForPrincipal(principal, "TestDatabase", 1);
diff --git browser/base/content/test/sanitize/browser_sanitize-offlineData.js browser/base/content/test/sanitize/browser_sanitize-offlineData.js
--- browser/base/content/test/sanitize/browser_sanitize-offlineData.js
+++ browser/base/content/test/sanitize/browser_sanitize-offlineData.js
@@ -1,14 +1,14 @@
// 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 {XPCOMUtils} = 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");
XPCOMUtils.defineLazyServiceGetter(this, "sas",
"@mozilla.org/storage/activity-service;1",
"nsIStorageActivityService");
XPCOMUtils.defineLazyServiceGetter(this, "swm",
"@mozilla.org/serviceworkers/manager;1",
"nsIServiceWorkerManager");
diff --git browser/base/content/test/sanitize/browser_sanitize-timespans.js browser/base/content/test/sanitize/browser_sanitize-timespans.js
--- browser/base/content/test/sanitize/browser_sanitize-timespans.js
+++ browser/base/content/test/sanitize/browser_sanitize-timespans.js
@@ -1,12 +1,12 @@
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();
var now_uSec = now_mSec * 1000;
const kMsecPerMin = 60 * 1000;
const kUsecPerMin = 60 * 1000000;
diff --git browser/base/content/test/sanitize/head.js browser/base/content/test/sanitize/head.js
--- browser/base/content/test/sanitize/head.js
+++ browser/base/content/test/sanitize/head.js
@@ -1,9 +1,9 @@
-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",
FormHistory: "resource://gre/modules/FormHistory.jsm",
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
});
diff --git browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js
--- browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js
+++ browser/base/content/test/siteIdentity/browser_secure_transport_insecure_scheme.js
@@ -108,17 +108,17 @@ add_task(async function() {
mainThreadOnly: true,
PACURI: null,
getProxyForURI: (aSpec, aScheme, aHost, aPort) => {
return `HTTPS localhost:${server.port}`;
},
};
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.
registerCleanupFunction(() => {
certOverrideService.clearValidityOverride("localhost", server.port);
Services.prefs.setIntPref("network.proxy.type", oldProxyType);
MockRegistrar.unregister(mockProxy);
server.close();
diff --git browser/base/content/test/siteIdentity/head.js browser/base/content/test/siteIdentity/head.js
--- browser/base/content/test/siteIdentity/head.js
+++ browser/base/content/test/siteIdentity/head.js
@@ -1,9 +1,9 @@
-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
* a xul:tabbrowser.
*
* @param aTabBrowser
* The xul:tabbrowser to monitor for a new tab.
* @return {Promise}
diff --git browser/base/content/test/static/head.js browser/base/content/test/static/head.js
--- browser/base/content/test/static/head.js
+++ browser/base/content/test/static/head.js
@@ -3,18 +3,18 @@
"use strict";
/* Shorthand constructors to construct an nsI(Local)File and zip reader: */
const LocalFile = new Components.Constructor("@mozilla.org/file/local;1", Ci.nsIFile, "initWithPath");
const ZipReader = new Components.Constructor("@mozilla.org/libjar/zip-reader;1", "nsIZipReader", "open");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/osfile.jsm");
+var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var {OS, require} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
/**
* Returns a promise that is resolved with a list of files that have one of the
* extensions passed, represented by their nsIURI objects, which exist inside
* the directory passed.
*
* @param dir the directory which to scan for files (nsIFile)
diff --git browser/base/content/test/sync/browser_fxa_badge.js browser/base/content/test/sync/browser_fxa_badge.js
--- browser/base/content/test/sync/browser_fxa_badge.js
+++ browser/base/content/test/sync/browser_fxa_badge.js
@@ -1,14 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
-ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
+const {AppMenuNotifications} = ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
add_task(async function test_unconfigured_no_badge() {
const oldUIState = UIState.get;
UIState.get = () => ({
status: UIState.STATUS_NOT_CONFIGURED,
});
Services.obs.notifyObservers(null, UIState.ON_UPDATE);
diff --git browser/base/content/test/sync/browser_fxa_web_channel.js browser/base/content/test/sync/browser_fxa_web_channel.js
--- browser/base/content/test/sync/browser_fxa_web_channel.js
+++ browser/base/content/test/sync/browser_fxa_web_channel.js
@@ -7,17 +7,17 @@ XPCOMUtils.defineLazyGetter(this, "FxAcc
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js", {});
});
ChromeUtils.defineModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");
// FxAccountsWebChannel isn't explicitly exported by FxAccountsWebChannel.jsm
// but we can get it here via a backstage pass.
-var {FxAccountsWebChannel} = ChromeUtils.import("resource://gre/modules/FxAccountsWebChannel.jsm", {});
+var {FxAccountsWebChannel} = ChromeUtils.import("resource://gre/modules/FxAccountsWebChannel.jsm", null);
const TEST_HTTP_PATH = "http://example.com";
const TEST_BASE_URL = TEST_HTTP_PATH + "/browser/browser/base/content/test/sync/browser_fxa_web_channel.html";
const TEST_CHANNEL_ID = "account_updates_test";
var gTests = [
{
desc: "FxA Web Channel - should receive message about profile changes",
diff --git browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js
--- browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js
+++ browser/base/content/test/tabcrashed/browser_autoSubmitRequest.js
@@ -1,15 +1,15 @@
"use strict";
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
const AUTOSUBMIT_PREF = "browser.crashReports.unsubmittedCheck.autoSubmit2";
const {TabStateFlusher} =
- ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
+ ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm");
// On debug builds, crashing tabs results in much thinking, which
// slows down the test and results in intermittent test timeouts,
// so we'll pump up the expected timeout for this test.
requestLongerTimeout(2);
/**
* Tests that if the user is not configured to autosubmit
diff --git browser/base/content/test/tabs/browser_abandonment_telemetry.js browser/base/content/test/tabs/browser_abandonment_telemetry.js
--- browser/base/content/test/tabs/browser_abandonment_telemetry.js
+++ browser/base/content/test/tabs/browser_abandonment_telemetry.js
@@ -1,11 +1,11 @@
"use strict";
-const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
+const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm");
// Keep this in sync with the order in Histograms.json for
// BUSY_TAB_ABANDONED
const CATEGORIES = [
"stop",
"back",
"forward",
"historyNavigation",
diff --git browser/base/content/test/tabs/browser_bug_1387976_restore_lazy_tab_browser_muted_state.js browser/base/content/test/tabs/browser_bug_1387976_restore_lazy_tab_browser_muted_state.js
--- browser/base/content/test/tabs/browser_bug_1387976_restore_lazy_tab_browser_muted_state.js
+++ browser/base/content/test/tabs/browser_bug_1387976_restore_lazy_tab_browser_muted_state.js
@@ -1,14 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
-const { TabState } = ChromeUtils.import("resource:///modules/sessionstore/TabState.jsm", {});
+const { TabState } = ChromeUtils.import("resource:///modules/sessionstore/TabState.jsm");
/**
* Simulate a restart of a tab by removing it, then add a lazy tab
* which is restored with the tabData of the removed tab.
*
* @param tab
* The tab to restart.
* @return {Object} the restored lazy tab
diff --git browser/base/content/test/tabs/browser_newwindow_tabstrip_overflow.js browser/base/content/test/tabs/browser_newwindow_tabstrip_overflow.js
--- browser/base/content/test/tabs/browser_newwindow_tabstrip_overflow.js
+++ browser/base/content/test/tabs/browser_newwindow_tabstrip_overflow.js
@@ -1,13 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
+const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm");
registerCleanupFunction(() => {
LightweightThemeManager.currentTheme = null;
Services.prefs.clearUserPref("lightweightThemes.usedThemes");
});
add_task(async function withoutLWT() {
let win = await BrowserTestUtils.openNewBrowserWindow();
ok(!win.gBrowser.tabContainer.hasAttribute("overflow"), "tab container not overflowing");
diff --git browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js
--- browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js
+++ browser/base/content/test/trackingUI/browser_trackingUI_report_breakage.js
@@ -6,19 +6,19 @@
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/trackingPage.html";
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/trackingUI/benignPage.html";
const COOKIE_PAGE = "http://not-tracking.example.com/browser/browser/base/content/test/trackingUI/cookiePage.html";
const TP_PREF = "privacy.trackingprotection.enabled";
const PREF_REPORT_BREAKAGE_ENABLED = "browser.contentblocking.reportBreakage.enabled";
const PREF_REPORT_BREAKAGE_URL = "browser.contentblocking.reportBreakage.url";
-let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js", {});
-let {CommonUtils} = ChromeUtils.import("resource://services-common/utils.js", {});
-let {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm", {});
+let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js");
+let {CommonUtils} = ChromeUtils.import("resource://services-common/utils.js");
+let {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
add_task(async function setup() {
await UrlClassifierTestUtils.addTestTrackers();
let oldCanRecord = Services.telemetry.canRecordExtended;
Services.telemetry.canRecordExtended = true;
registerCleanupFunction(() => {
diff --git browser/base/content/test/trackingUI/head.js browser/base/content/test/trackingUI/head.js
--- browser/base/content/test/trackingUI/head.js
+++ browser/base/content/test/trackingUI/head.js
@@ -1,9 +1,9 @@
-var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
+var {UrlClassifierTestUtils} = ChromeUtils.import("resource://testing-common/UrlClassifierTestUtils.jsm");
/**
* Waits for a load (or custom) event to finish in a given tab. If provided
* load an uri into the tab.
*
* @param tab
* The tab to load into.
* @param [optional] url
diff --git browser/base/content/test/urlbar/Panel.jsm browser/base/content/test/urlbar/Panel.jsm
--- browser/base/content/test/urlbar/Panel.jsm
+++ browser/base/content/test/urlbar/Panel.jsm
@@ -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/. */
var EXPORTED_SYMBOLS = [
"Panel",
];
-ChromeUtils.import("resource://gre/modules/Timer.jsm");
+const {clearInterval, setInterval, setTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm");
var Panel = function(panelElt, iframeURL) {
this.p = panelElt;
this.iframeURL = iframeURL;
this._initPanel();
this.urlbar.addEventListener("keydown", this);
this.urlbar.addEventListener("input", this);
this._emitQueue = [];
diff --git browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
--- browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
+++ browser/base/content/test/urlbar/browser_urlbarAboutHomeLoading.js
@@ -1,12 +1,12 @@
"use strict";
-const {SessionSaver} = ChromeUtils.import("resource:///modules/sessionstore/SessionSaver.jsm", {});
-const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm", {});
+const {SessionSaver} = ChromeUtils.import("resource:///modules/sessionstore/SessionSaver.jsm");
+const {TabStateFlusher} = ChromeUtils.import("resource:///modules/sessionstore/TabStateFlusher.jsm");
/**
* Test what happens if loading a URL that should clear the
* location bar after a parent process URL.
*/
add_task(async function clearURLBarAfterParentProcessURL() {
let tab = await new Promise(resolve => {
gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, "about:preferences");
diff --git browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
--- browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
+++ browser/base/content/test/urlbar/browser_urlbar_search_no_speculative_connect_with_client_cert.js
@@ -3,17 +3,17 @@
* 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";
// Tests that we don't speculatively connect when user certificates are installed
const { MockRegistrar } =
- ChromeUtils.import("resource://testing-common/MockRegistrar.jsm", {});
+ ChromeUtils.import("resource://testing-common/MockRegistrar.jsm");
const certService = Cc["@mozilla.org/security/local-cert-service;1"]
.getService(Ci.nsILocalCertService);
const certOverrideService = Cc["@mozilla.org/security/certoverride;1"]
.getService(Ci.nsICertOverrideService);
const host = "localhost";
let uri;
diff --git browser/base/content/test/urlbar/head.js browser/base/content/test/urlbar/head.js
--- browser/base/content/test/urlbar/head.js
+++ browser/base/content/test/urlbar/head.js
@@ -1,11 +1,11 @@
/* eslint-env mozilla/frame-script */
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
HttpServer: "resource://testing-common/httpd.js",
PlacesUtils: "resource://gre/modules/PlacesUtils.jsm",
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.jsm",
Preferences: "resource://gre/modules/Preferences.jsm",
SearchTestUtils: "resource://testing-common/SearchTestUtils.jsm",
UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.jsm",
@@ -26,17 +26,17 @@ SearchTestUtils.init(Assert, registerCle
* However, the browser UI will behave differently for loads stopped directly from
* the progress listener (effectively in the middle of a call to loadURI) and so there
* are cases where you may want to avoid stopping the load directly from within the
* progress listener callback.
* @return promise
*/
function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrowser, aStopFromProgressListener = true) {
function content_script(contentStopFromProgressListener) {
- ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+ const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
let wp = docShell.QueryInterface(Ci.nsIWebProgress);
function stopContent(now, uri) {
if (now) {
/* Hammer time. */
content.stop();
/* Let the parent know we're done. */
diff --git browser/base/content/test/webextensions/browser_extension_sideloading.js browser/base/content/test/webextensions/browser_extension_sideloading.js
--- browser/base/content/test/webextensions/browser_extension_sideloading.js
+++ browser/base/content/test/webextensions/browser_extension_sideloading.js
@@ -1,12 +1,12 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
-const {AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm", {});
+const {AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
-const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm", {});
+const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
AddonTestUtils.initMochitest(this);
async function createWebExtension(details) {
let options = {
manifest: {
applications: {gecko: {id: details.id}},
diff --git browser/base/content/test/webextensions/browser_extension_update_background.js browser/base/content/test/webextensions/browser_extension_update_background.js
--- browser/base/content/test/webextensions/browser_extension_update_background.js
+++ browser/base/content/test/webextensions/browser_extension_update_background.js
@@ -1,11 +1,11 @@
-const {AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm", {});
+const {AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
-const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm", {});
+const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
AddonTestUtils.initMochitest(this);
const ID = "update2@tests.mozilla.org";
const ID_ICON = "update_icon2@tests.mozilla.org";
const ID_PERMS = "update_perms@tests.mozilla.org";
const ID_LEGACY = "legacy_update@tests.mozilla.org";
const FAKE_INSTALL_TELEMETRY_SOURCE = "fake-install-source";
diff --git browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js
--- browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js
+++ browser/base/content/test/webextensions/browser_extension_update_background_noprompt.js
@@ -1,9 +1,9 @@
-const {AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm", {});
+const {AddonManagerPrivate} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
const ID_PERMS = "update_perms@tests.mozilla.org";
const ID_ORIGINS = "update_origins@tests.mozilla.org";
function getBadgeStatus() {
let menuButton = document.getElementById("PanelUI-menu-button");
return menuButton.getAttribute("badge-status");
}
diff --git browser/base/content/test/webextensions/head.js browser/base/content/test/webextensions/head.js
--- browser/base/content/test/webextensions/head.js
+++ browser/base/content/test/webextensions/head.js
@@ -1,17 +1,17 @@
ChromeUtils.defineModuleGetter(this, "AddonTestUtils", "resource://testing-common/AddonTestUtils.jsm");
const BASE = getRootDirectory(gTestPath)
.replace("chrome://mochitests/content/", "https://example.com/");
-ChromeUtils.import("resource:///modules/ExtensionsUI.jsm");
+var {ExtensionsUI} = ChromeUtils.import("resource:///modules/ExtensionsUI.jsm");
XPCOMUtils.defineLazyGetter(this, "Management", () => {
// eslint-disable-next-line no-shadow
- const {Management} = ChromeUtils.import("resource://gre/modules/Extension.jsm", {});
+ const {Management} = ChromeUtils.import("resource://gre/modules/Extension.jsm", null);
return Management;
});
ChromeUtils.import("resource://testing-common/CustomizableUITestUtils.jsm", this);
let gCUITestUtils = new CustomizableUITestUtils(window);
/**
* Wait for the given PopupNotification to display
@@ -35,17 +35,17 @@ function promisePopupNotificationShown(n
resolve(PopupNotifications.panel.firstElementChild);
}
PopupNotifications.panel.addEventListener("popupshown", popupshown);
});
}
function promiseAppMenuNotificationShown(id) {
- ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
+ const {AppMenuNotifications} = ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
return new Promise(resolve => {
function popupshown() {
let notification = AppMenuNotifications.activeNotification;
if (!notification) { return; }
is(notification.id, id, `${id} notification shown`);
ok(PanelUI.isNotificationPanelOpen, "notification panel open");
diff --git browser/base/content/test/webrtc/browser_webrtc_hooks.js browser/base/content/test/webrtc/browser_webrtc_hooks.js
--- browser/base/content/test/webrtc/browser_webrtc_hooks.js
+++ browser/base/content/test/webrtc/browser_webrtc_hooks.js
@@ -1,13 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-ChromeUtils.import("resource:///modules/webrtcUI.jsm");
+const {webrtcUI} = ChromeUtils.import("resource:///modules/webrtcUI.jsm");
const ORIGIN = "https://example.com";
async function tryPeerConnection(browser, expectedError = null) {
let errtype = await ContentTask.spawn(browser, null, async function() {
let pc = new content.RTCPeerConnection();
try {
await pc.createOffer({offerToReceiveAudio: true});
diff --git browser/base/content/test/webrtc/get_user_media_content_script.js browser/base/content/test/webrtc/get_user_media_content_script.js
--- browser/base/content/test/webrtc/get_user_media_content_script.js
+++ browser/base/content/test/webrtc/get_user_media_content_script.js
@@ -1,15 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/* eslint-env mozilla/frame-script */
-ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "MediaManagerService",
"@mozilla.org/mediaManagerService;1",
"nsIMediaManagerService");
const kObservedTopics = [
"getUserMedia:response:allow",
"getUserMedia:revoke",
"getUserMedia:response:deny",
diff --git browser/base/content/test/webrtc/head.js browser/base/content/test/webrtc/head.js
--- browser/base/content/test/webrtc/head.js
+++ browser/base/content/test/webrtc/head.js
@@ -1,10 +1,10 @@
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource:///modules/SitePermissions.jsm");
+var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+var {SitePermissions} = ChromeUtils.import("resource:///modules/SitePermissions.jsm");
const PREF_PERMISSION_FAKE = "media.navigator.permission.fake";
const PREF_AUDIO_LOOPBACK = "media.audio_loopback_dev";
const PREF_VIDEO_LOOPBACK = "media.video_loopback_dev";
const PREF_FAKE_STREAMS = "media.navigator.streams.fake";
const PREF_FOCUS_SOURCE = "media.getusermedia.window.focus_source.enabled";
const CONTENT_SCRIPT_HELPER = getRootDirectory(gTestPath) + "get_user_media_content_script.js";
diff --git browser/base/content/utilityOverlay.js browser/base/content/utilityOverlay.js
--- browser/base/content/utilityOverlay.js
+++ browser/base/content/utilityOverlay.js
@@ -1,17 +1,17 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
* 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/. */
// Services = object with smart getters for common XPCOM services
-ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+var {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
ShellService: "resource:///modules/ShellService.jsm",
diff --git browser/base/content/webext-panels.js browser/base/content/webext-panels.js
--- browser/base/content/webext-panels.js
+++ browser/base/content/webext-panels.js
@@ -5,18 +5,18 @@
// Via webext-panels.xul
/* import-globals-from browser.js */
/* import-globals-from nsContextMenu.js */
ChromeUtils.defineModuleGetter(this, "ExtensionParent",
"resource://gre/modules/ExtensionParent.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {ExtensionUtils} = ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
var {
promiseEvent,
} = ExtensionUtils;
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
function getBrowser(panel) {
diff --git browser/base/content/webrtcIndicator.js browser/base/content/webrtcIndicator.js
--- browser/base/content/webrtcIndicator.js
+++ browser/base/content/webrtcIndicator.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/. */
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource:///modules/webrtcUI.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {webrtcUI} = ChromeUtils.import("resource:///modules/webrtcUI.jsm");
const BUNDLE_URL = "chrome://browser/locale/webrtcIndicator.properties";
var gStringBundle;
function init(event) {
gStringBundle = Services.strings.createBundle(BUNDLE_URL);
let brand = Services.strings.createBundle("chrome://branding/locale/brand.properties");
diff --git browser/components/about/AboutPrivateBrowsingHandler.jsm browser/components/about/AboutPrivateBrowsingHandler.jsm
--- browser/components/about/AboutPrivateBrowsingHandler.jsm
+++ browser/components/about/AboutPrivateBrowsingHandler.jsm
@@ -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";
var EXPORTED_SYMBOLS = ["AboutPrivateBrowsingHandler"];
-ChromeUtils.import("resource://gre/modules/remotepagemanager/RemotePageManagerParent.jsm");
+const {RemotePages} = ChromeUtils.import("resource://gre/modules/remotepagemanager/RemotePageManagerParent.jsm");
var AboutPrivateBrowsingHandler = {
_topics: [
"DontShowIntroPanelAgain",
"OpenPrivateWindow",
],
init() {
diff --git browser/components/about/test/unit/test_getURIFlags.js browser/components/about/test/unit/test_getURIFlags.js
--- browser/components/about/test/unit/test_getURIFlags.js
+++ browser/components/about/test/unit/test_getURIFlags.js
@@ -1,9 +1,9 @@
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const contract = "@mozilla.org/network/protocol/about;1?what=newtab";
const am = Cc[contract].getService(Ci.nsIAboutModule);
const uri = Services.io.newURI("about:newtab");
function run_test() {
test_AS_enabled_flags();
}
diff --git browser/components/aboutconfig/content/aboutconfig.js browser/components/aboutconfig/content/aboutconfig.js
--- browser/components/aboutconfig/content/aboutconfig.js
+++ browser/components/aboutconfig/content/aboutconfig.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/. */
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/Preferences.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
let gDefaultBranch = Services.prefs.getDefaultBranch("");
let gPrefArray;
let gPrefInEdit = null;
class PrefRow {
constructor(name) {
this.name = name;
diff --git browser/components/attribution/AttributionCode.jsm browser/components/attribution/AttributionCode.jsm
--- browser/components/attribution/AttributionCode.jsm
+++ browser/components/attribution/AttributionCode.jsm
@@ -1,16 +1,16 @@
/* 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 EXPORTED_SYMBOLS = ["AttributionCode"];
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
ChromeUtils.defineModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(this, "Services",
"resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyGlobalGetters(this, ["URL"]);
diff --git browser/components/attribution/test/xpcshell/test_AttributionCode.js browser/components/attribution/test/xpcshell/test_AttributionCode.js
--- browser/components/attribution/test/xpcshell/test_AttributionCode.js
+++ browser/components/attribution/test/xpcshell/test_AttributionCode.js
@@ -1,17 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
"use strict";
-ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-ChromeUtils.import("resource:///modules/AttributionCode.jsm");
-ChromeUtils.import("resource://gre/modules/osfile.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+const {AttributionCode} = ChromeUtils.import("resource:///modules/AttributionCode.jsm");
+const {OS} = ChromeUtils.import("resource://gre/modules/osfile.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
let validAttrCodes = [
{code: "source%3Dgoogle.com%26medium%3Dorganic%26campaign%3D(not%20set)%26content%3D(not%20set)",
parsed: {"source": "google.com", "medium": "organic",
"campaign": "(not%20set)", "content": "(not%20set)"}},
{code: "source%3Dgoogle.com%26medium%3Dorganic%26campaign%3D%26content%3D",
parsed: {"source": "google.com", "medium": "organic"}},
{code: "source%3Dgoogle.com%26medium%3Dorganic%26campaign%3D(not%20set)",
diff --git browser/components/attribution/test/xpcshell/test_attribution.js browser/components/attribution/test/xpcshell/test_attribution.js
--- browser/components/attribution/test/xpcshell/test_attribution.js
+++ browser/components/attribution/test/xpcshell/test_attribution.js
@@ -1,16 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
"use strict";
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource:///modules/AttributionCode.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {AttributionCode} = ChromeUtils.import("resource:///modules/AttributionCode.jsm");
add_task(async function test_attribution() {
let appPath = Services.dirsvc.get("GreD", Ci.nsIFile).parent.parent.path;
let attributionSvc = Cc["@mozilla.org/mac-attribution;1"]
.getService(Ci.nsIMacAttributionService);
attributionSvc.setReferrerUrl(appPath, "", true);
let referrer = attributionSvc.getReferrerUrl(appPath);
diff --git browser/components/contextualidentity/test/browser/browser_count_and_remove.js browser/components/contextualidentity/test/browser/browser_count_and_remove.js
--- browser/components/contextualidentity/test/browser/browser_count_and_remove.js
+++ browser/components/contextualidentity/test/browser/browser_count_and_remove.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/ContextualIdentityService.jsm");
+const {ContextualIdentityService} = ChromeUtils.import("resource://gre/modules/ContextualIdentityService.jsm");
function openTabInUserContext(userContextId) {
let tab = BrowserTestUtils.addTab(gBrowser, "about:blank", {userContextId});
gBrowser.selectedTab = tab;
}
add_task(async function setup() {
// make sure userContext is enabled.
diff --git browser/components/contextualidentity/test/browser/browser_favicon.js browser/components/contextualidentity/test/browser/browser_favicon.js
--- browser/components/contextualidentity/test/browser/browser_favicon.js
+++ browser/components/contextualidentity/test/browser/browser_favicon.js
@@ -1,14 +1,14 @@
/*
* Bug 1270678 - A test case to test does the favicon obey originAttributes.
*/
-ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
-ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
-let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js", {});
+const {PlacesUtils} = ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
+const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
+let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js");
const USER_CONTEXTS = [
"default",
"personal",
"work",
];
let gHttpServer = null;
diff --git browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
--- browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
+++ browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
@@ -1,17 +1,17 @@
/*
* Bug 1238183 - Test cases for forgetAboutSite with userContextId.
*/
const CC = Components.Constructor;
-let {ForgetAboutSite} = ChromeUtils.import("resource://gre/modules/ForgetAboutSite.jsm", {});
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js", {});
+let {ForgetAboutSite} = ChromeUtils.import("resource://gre/modules/ForgetAboutSite.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js");
const USER_CONTEXTS = [
"default",
"personal",
];
const TEST_HOST = "example.com";
const TEST_URL = "http://" + TEST_HOST + "/browser/browser/components/contextualidentity/test/browser/";
const COOKIE_NAME = "userContextId";
diff --git browser/components/contextualidentity/test/browser/browser_imageCache.js browser/components/contextualidentity/test/browser/browser_imageCache.js
--- browser/components/contextualidentity/test/browser/browser_imageCache.js
+++ browser/components/contextualidentity/test/browser/browser_imageCache.js
@@ -1,9 +1,9 @@
-let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js", {});
+let {HttpServer} = ChromeUtils.import("resource://testing-common/httpd.js");
const NUM_USER_CONTEXTS = 3;
let gHits = 0;
let server = new HttpServer();
server.registerPathHandler("/image.png", imageHandler);
server.registerPathHandler("/file.html", fileHandler);
diff --git browser/components/customizableui/CustomizableUI.jsm browser/components/customizableui/CustomizableUI.jsm
--- browser/components/customizableui/CustomizableUI.jsm
+++ browser/components/customizableui/CustomizableUI.jsm
@@ -1,19 +1,19 @@
/* 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 EXPORTED_SYMBOLS = ["CustomizableUI"];
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.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 {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
SearchWidgetTracker: "resource:///modules/SearchWidgetTracker.jsm",
CustomizableWidgets: "resource:///modules/CustomizableWidgets.jsm",
DeferredTask: "resource://gre/modules/DeferredTask.jsm",
PanelMultiView: "resource:///modules/PanelMultiView.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
diff --git browser/components/customizableui/CustomizableWidgets.jsm browser/components/customizableui/CustomizableWidgets.jsm
--- browser/components/customizableui/CustomizableWidgets.jsm
+++ browser/components/customizableui/CustomizableWidgets.jsm
@@ -1,20 +1,20 @@
/* 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 EXPORTED_SYMBOLS = ["CustomizableWidgets"];
-ChromeUtils.import("resource:///modules/CustomizableUI.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+const {CustomizableUI} = ChromeUtils.import("resource:///modules/CustomizableUI.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
PanelView: "resource:///modules/PanelMultiView.jsm",
RecentlyClosedTabsAndWindowsMenuUtils: "resource:///modules/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm",
ShortcutUtils: "resource://gre/modules/ShortcutUtils.jsm",
CharsetMenu: "resource://gre/modules/CharsetMenu.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
Sanitizer: "resource:///modules/Sanitizer.jsm",
diff --git browser/components/customizableui/CustomizeMode.jsm browser/components/customizableui/CustomizeMode.jsm
--- browser/components/customizableui/CustomizeMode.jsm
+++ browser/components/customizableui/CustomizeMode.jsm
@@ -16,20 +16,20 @@ const kKeepBroadcastAttributes = "keepbr
const kPanelItemContextMenu = "customizationPanelItemContextMenu";
const kPaletteItemContextMenu = "customizationPaletteItemContextMenu";
const kDownloadAutohideCheckboxId = "downloads-button-autohide-checkbox";
const kDownloadAutohidePanelId = "downloads-button-autohide-panel";
const kDownloadAutoHidePref = "browser.download.autohideButton";
-ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource:///modules/CustomizableUI.jsm");
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {CustomizableUI} = ChromeUtils.import("resource:///modules/CustomizableUI.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
XPCOMUtils.defineLazyGlobalGetters(this, ["CSS"]);
ChromeUtils.defineModuleGetter(this, "DragPositionManager",
"resource:///modules/DragPositionManager.jsm");
ChromeUtils.defineModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
ChromeUtils.defineModuleGetter(this, "LightweightThemeManager",
diff --git browser/components/customizableui/PanelMultiView.jsm browser/components/customizableui/PanelMultiView.jsm
--- browser/components/customizableui/PanelMultiView.jsm
+++ browser/components/customizableui/PanelMultiView.jsm
@@ -99,18 +99,18 @@
"use strict";
var EXPORTED_SYMBOLS = [
"PanelMultiView",
"PanelView",
];
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
XPCOMUtils.defineLazyGetter(this, "gBundle", function() {
return Services.strings.createBundle(
"chrome://browser/locale/browser.properties");
});
diff --git browser/components/customizableui/ScrollbarSampler.jsm browser/components/customizableui/ScrollbarSampler.jsm
--- browser/components/customizableui/ScrollbarSampler.jsm
+++ browser/components/customizableui/ScrollbarSampler.jsm
@@ -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";
var EXPORTED_SYMBOLS = ["ScrollbarSampler"];
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var gSystemScrollbarWidth = null;
var ScrollbarSampler = {
getSystemScrollbarWidth() {
if (gSystemScrollbarWidth !== null) {
return Promise.resolve(gSystemScrollbarWidth);
}
diff --git browser/components/customizableui/SearchWidgetTracker.jsm browser/components/customizableui/SearchWidgetTracker.jsm
--- browser/components/customizableui/SearchWidgetTracker.jsm
+++ browser/components/customizableui/SearchWidgetTracker.jsm
@@ -5,17 +5,17 @@
/*
* Keeps the "browser.search.widget.inNavBar" preference synchronized.
*/
"use strict";
var EXPORTED_SYMBOLS = ["SearchWidgetTracker"];
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
const WIDGET_ID = "search-container";
const PREF_NAME = "browser.search.widget.inNavBar";
const SearchWidgetTracker = {
diff --git browser/components/customizableui/test/CustomizableUITestUtils.jsm browser/components/customizableui/test/CustomizableUITestUtils.jsm
--- browser/components/customizableui/test/CustomizableUITestUtils.jsm
+++ browser/components/customizableui/test/CustomizableUITestUtils.jsm
@@ -5,19 +5,19 @@
/**
* Shared functions generally available for tests involving PanelMultiView and
* the CustomizableUI elements in the browser window.
*/
var EXPORTED_SYMBOLS = ["CustomizableUITestUtils"];
-ChromeUtils.import("resource://testing-common/Assert.jsm");
-ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
-ChromeUtils.import("resource://testing-common/TestUtils.jsm");
+const {Assert} = ChromeUtils.import("resource://testing-common/Assert.jsm");
+const {BrowserTestUtils} = ChromeUtils.import("resource://testing-common/BrowserTestUtils.jsm");
+const {TestUtils} = ChromeUtils.import("resource://testing-common/TestUtils.jsm");
ChromeUtils.defineModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
class CustomizableUITestUtils {
/**
* Constructs an instance that operates with the specified browser window.
*/
diff --git browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js
--- browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js
+++ browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js
@@ -2,17 +2,17 @@
* 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 DEFAULT_THEME_ID = "default-theme@mozilla.org";
const LIGHT_THEME_ID = "firefox-compact-light@mozilla.org";
const DARK_THEME_ID = "firefox-compact-dark@mozilla.org";
-const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
+const {LightweightThemeManager} = ChromeUtils.import("resource://gre/modules/LightweightThemeManager.jsm");
add_task(async function() {
Services.prefs.clearUserPref("lightweightThemes.usedThemes");
Services.prefs.clearUserPref("lightweightThemes.recommendedThemes");
await startCustomizing();
// Check restore defaults button is disabled.
ok(document.getElementById("customization-reset-button").disabled,
diff --git browser/components/customizableui/test/browser_1042100_default_placements_update.js browser/components/customizableui/test/browser_1042100_default_placements_update.js
--- browser/components/customizableui/test/browser_1042100_default_placements_update.js
+++ browser/components/customizableui/test/browser_1042100_default_placements_update.js
@@ -5,17 +5,17 @@
// NB: This uses some ugly hacks to get into the CUI module from elsewhere...
// don't try this at home, kids.
function test() {
// Customize something to make sure stuff changed:
CustomizableUI.addWidgetToArea("save-page-button", CustomizableUI.AREA_NAVBAR);
// Check what version we're on:
- let CustomizableUIBSPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
+ let CustomizableUIBSPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", null);
let oldState = CustomizableUIBSPass.gSavedState;
registerCleanupFunction(() => CustomizableUIBSPass.gSavedState = oldState );
is(CustomizableUIBSPass.gFuturePlacements.size, 0,
"All future placements should be dealt with by now.");
let {CustomizableUIInternal, gFuturePlacements, gPalette} = CustomizableUIBSPass;
diff --git browser/components/customizableui/test/browser_1096763_seen_widgets_post_reset.js browser/components/customizableui/test/browser_1096763_seen_widgets_post_reset.js
--- browser/components/customizableui/test/browser_1096763_seen_widgets_post_reset.js
+++ browser/components/customizableui/test/browser_1096763_seen_widgets_post_reset.js
@@ -5,17 +5,17 @@ const BUTTONID = "test-seenwidget-post-r
add_task(async function() {
CustomizableUI.createWidget({
id: BUTTONID,
label: "Test widget seen post reset",
defaultArea: CustomizableUI.AREA_NAVBAR,
});
const kPrefCustomizationState = "browser.uiCustomization.state";
- let bsPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
+ let bsPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", null);
ok(bsPass.gSeenWidgets.has(BUTTONID), "Widget should be seen after createWidget is called.");
CustomizableUI.reset();
ok(bsPass.gSeenWidgets.has(BUTTONID), "Widget should still be seen after reset.");
CustomizableUI.addWidgetToArea(BUTTONID, CustomizableUI.AREA_NAVBAR);
gCustomizeMode.removeFromArea(document.getElementById(BUTTONID));
let hasUserValue = Services.prefs.prefHasUserValue(kPrefCustomizationState);
ok(hasUserValue, "Pref should be set right now.");
if (hasUserValue) {
diff --git browser/components/customizableui/test/browser_1161838_inserted_new_default_buttons.js browser/components/customizableui/test/browser_1161838_inserted_new_default_buttons.js
--- browser/components/customizableui/test/browser_1161838_inserted_new_default_buttons.js
+++ browser/components/customizableui/test/browser_1161838_inserted_new_default_buttons.js
@@ -1,17 +1,17 @@
"use strict";
// NB: This uses some ugly hacks to get into the CUI module from elsewhere...
// don't try this at home, kids.
function test() {
// Customize something to make sure stuff changed:
CustomizableUI.addWidgetToArea("save-page-button", CustomizableUI.AREA_NAVBAR);
- let CustomizableUIBSPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
+ let CustomizableUIBSPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", null);
is(CustomizableUIBSPass.gFuturePlacements.size, 0,
"All future placements should be dealt with by now.");
let {CustomizableUIInternal, gFuturePlacements, gPalette} = CustomizableUIBSPass;
// Force us to have a saved state:
CustomizableUIInternal.saveState();
diff --git browser/components/customizableui/test/browser_989338_saved_placements_not_resaved.js browser/components/customizableui/test/browser_989338_saved_placements_not_resaved.js
--- browser/components/customizableui/test/browser_989338_saved_placements_not_resaved.js
+++ browser/components/customizableui/test/browser_989338_saved_placements_not_resaved.js
@@ -5,17 +5,17 @@
"use strict";
const BUTTONID = "test-widget-saved-earlier";
const AREAID = "test-area-saved-earlier";
var hadSavedState;
function test() {
// Hack our way into the module to fake a saved state that isn't there...
- let backstagePass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
+ let backstagePass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", null);
hadSavedState = backstagePass.gSavedState != null;
if (!hadSavedState) {
backstagePass.gSavedState = {placements: {}};
}
backstagePass.gSavedState.placements[AREAID] = [BUTTONID];
// Put bogus stuff in the saved state for the nav-bar, so as to check the current placements
// override this one...
backstagePass.gSavedState.placements[CustomizableUI.AREA_NAVBAR] = ["bogus-navbar-item"];
@@ -36,17 +36,17 @@ function test() {
ok(savedNavbar, "Should have saved nav-bar contents");
if (savedNavbar) {
placementArraysEqual(CustomizableUI.AREA_NAVBAR, newSavedState.placements[CustomizableUI.AREA_NAVBAR],
CustomizableUI.getWidgetIdsInArea(CustomizableUI.AREA_NAVBAR));
}
}
registerCleanupFunction(function() {
- let backstagePass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
+ let backstagePass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", null);
if (!hadSavedState) {
backstagePass.gSavedState = null;
} else {
let savedPlacements = backstagePass.gSavedState.placements;
delete savedPlacements[AREAID];
let realNavBarPlacements = CustomizableUI.getWidgetIdsInArea(CustomizableUI.AREA_NAVBAR);
savedPlacements[CustomizableUI.AREA_NAVBAR] = realNavBarPlacements;
}
diff --git browser/components/customizableui/test/browser_PanelMultiView.js browser/components/customizableui/test/browser_PanelMultiView.js
--- browser/components/customizableui/test/browser_PanelMultiView.js
+++ browser/components/customizableui/test/browser_PanelMultiView.js
@@ -2,17 +2,17 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Unit tests for the PanelMultiView module.
*/
-ChromeUtils.import("resource:///modules/PanelMultiView.jsm");
+const {PanelMultiView} = ChromeUtils.import("resource:///modules/PanelMultiView.jsm");
const PANELS_COUNT = 2;
let gPanelAnchors = [];
let gPanels = [];
let gPanelMultiViews = [];
const PANELVIEWS_COUNT = 4;
let gPanelViews = [];
diff --git browser/components/customizableui/test/browser_PanelMultiView_focus.js browser/components/customizableui/test/browser_PanelMultiView_focus.js
--- browser/components/customizableui/test/browser_PanelMultiView_focus.js
+++ browser/components/customizableui/test/browser_PanelMultiView_focus.js
@@ -2,17 +2,17 @@
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
/**
* Test the focus behavior when opening PanelViews.
*/
-ChromeUtils.import("resource:///modules/PanelMultiView.jsm");
+const {PanelMultiView} = ChromeUtils.import("resource:///modules/PanelMultiView.jsm");
let gAnchor;
let gPanel;
let gMainView;
let gMainButton;
add_task(async function setup() {
let navBar = document.getElementById("nav-bar");
diff --git browser/components/customizableui/test/browser_currentset_post_reset.js browser/components/customizableui/test/browser_currentset_post_reset.js
--- browser/components/customizableui/test/browser_currentset_post_reset.js
+++ browser/components/customizableui/test/browser_currentset_post_reset.js
@@ -1,15 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
function checkSpacers() {
- let bsPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
+ let bsPass = ChromeUtils.import("resource:///modules/CustomizableUI.jsm", null);
let navbarWidgets = CustomizableUI.getWidgetIdsInArea("nav-bar");
let currentSetWidgets = bsPass.CustomizableUIInternal._getCurrentWidgetsInContainer(document.getElementById("nav-bar"));
navbarWidgets = navbarWidgets.filter(w => CustomizableUI.isSpecialWidget(w));
currentSetWidgets = currentSetWidgets.filter(w => CustomizableUI.isSpecialWidget(w));
Assert.deepEqual(navbarWidgets, currentSetWidgets, "Should have the same 'special' widgets in currentset and placements");
}
/**
diff --git browser/components/customizableui/test/browser_panelUINotifications.js browser/components/customizableui/test/browser_panelUINotifications.js
--- browser/components/customizableui/test/browser_panelUINotifications.js
+++ browser/components/customizableui/test/browser_panelUINotifications.js
@@ -1,11 +1,11 @@
"use strict";
-ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
+const {AppMenuNotifications} = ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
/**
* Tests that when we click on the main call-to-action of the doorhanger, the provided
* action is called, and the doorhanger removed.
*/
add_task(async function testMainActionCalled() {
let options = {
gBrowser: window.gBrowser,
diff --git browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js
--- browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js
+++ browser/components/customizableui/test/browser_panelUINotifications_fullscreen.js
@@ -1,11 +1,11 @@
"use strict";
-ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
+const {AppMenuNotifications} = ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
add_task(async function testFullscreen() {
let doc = document;
is(PanelUI.notificationPanel.state, "closed", "update-manual doorhanger is closed.");
let mainActionCalled = false;
let mainAction = {
callback: () => { mainActionCalled = true; },
diff --git browser/components/customizableui/test/browser_panelUINotifications_fullscreen_noAutoHideToolbar.js browser/components/customizableui/test/browser_panelUINotifications_fullscreen_noAutoHideToolbar.js
--- browser/components/customizableui/test/browser_panelUINotifications_fullscreen_noAutoHideToolbar.js
+++ browser/components/customizableui/test/browser_panelUINotifications_fullscreen_noAutoHideToolbar.js
@@ -1,17 +1,17 @@
"use strict";
// This test tends to trigger a race in the fullscreen time telemetry,
// where the fullscreen enter and fullscreen exit events (which use the
// same histogram ID) overlap. That causes TelemetryStopwatch to log an
// error.
SimpleTest.ignoreAllUncaughtExceptions(true);
-ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
+const {AppMenuNotifications} = ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
function waitForDocshellActivated() {
return ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
// Setting docshell activated/deactivated will trigger visibility state
// changes to relevant state ("visible" or "hidden"). AFAIK, there is no
// such event notifying docshell is being activated, so I use
// "visibilitychange" event rather than polling the docShell.isActive.
await ContentTaskUtils.waitForEvent(content.document, "visibilitychange",
diff --git browser/components/customizableui/test/browser_panelUINotifications_multiWindow.js browser/components/customizableui/test/browser_panelUINotifications_multiWindow.js
--- browser/components/customizableui/test/browser_panelUINotifications_multiWindow.js
+++ browser/components/customizableui/test/browser_panelUINotifications_multiWindow.js
@@ -1,11 +1,11 @@
"use strict";
-ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
+const {AppMenuNotifications} = ChromeUtils.import("resource://gre/modules/AppMenuNotifications.jsm");
/**
* Tests that when we try to show a notification in a background window, it
* does not display until the window comes back into the foreground. However,
* it should display a badge.
*/
add_task(async function testDoesNotShowDoorhangerForBackgroundWindow() {
let options = {
diff --git browser/components/customizableui/test/browser_panel_keyboard_navigation.js browser/components/customizableui/test/browser_panel_keyboard_navigation.js
--- browser/components/customizableui/test/browser_panel_keyboard_navigation.js
+++ browser/components/customizableui/test/browser_panel_keyboard_navigation.js
@@ -1,15 +1,15 @@
"use strict";
/**
* Test keyboard navigation in the app menu panel.
*/
-const {PanelView} = ChromeUtils.import("resource:///modules/PanelMultiView.jsm", {});
+const {PanelView} = ChromeUtils.import("resource:///modules/PanelMultiView.jsm", null);
const kHelpButtonId = "appMenu-help-button";
function getEnabledNavigableElementsForView(panelView) {
return Array.from(panelView.querySelectorAll(
"button,toolbarbutton,menulist,.text-link"
)).filter(element => {
let bounds = element.getBoundingClientRect();
return !element.disabled && (bounds.width > 0 && bounds.height > 0);
diff --git browser/components/customizableui/test/browser_remote_tabs_button.js browser/components/customizableui/test/browser_remote_tabs_button.js
--- browser/components/customizableui/test/browser_remote_tabs_button.js
+++ browser/components/customizableui/test/browser_remote_tabs_button.js
@@ -2,17 +2,17 @@
* 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";
let syncService = {};
ChromeUtils.import("resource://services-sync/service.js", syncService);
const service = syncService.Service;
-const {UIState} = ChromeUtils.import("resource://services-sync/UIState.jsm", {});
+const {UIState} = ChromeUtils.import("resource://services-sync/UIState.jsm");
let getState;
let originalSync;
let syncWasCalled = false;
// TODO: This test should probably be re-written, we don't really test much here.
add_task(async function testSyncRemoteTabsButtonFunctionality() {
info("Test the Sync Remote Tabs button in the panel");
diff --git browser/components/customizableui/test/browser_synced_tabs_menu.js browser/components/customizableui/test/browser_synced_tabs_menu.js
--- browser/components/customizableui/test/browser_synced_tabs_menu.js
+++ browser/components/customizableui/test/browser_synced_tabs_menu.js
@@ -1,19 +1,19 @@
/* 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";
requestLongerTimeout(2);
-ChromeUtils.import("resource://gre/modules/FxAccounts.jsm");
-let {SyncedTabs} = ChromeUtils.import("resource://services-sync/SyncedTabs.jsm", {});
-let {UIState} = ChromeUtils.import("resource://services-sync/UIState.jsm", {});
+const {FxAccounts} = ChromeUtils.import("resource://gre/modules/FxAccounts.jsm");
+let {SyncedTabs} = ChromeUtils.import("resource://services-sync/SyncedTabs.jsm");
+let {UIState} = ChromeUtils.import("resource://services-sync/UIState.jsm");
ChromeUtils.defineModuleGetter(this, "UITour", "resource:///modules/UITour.jsm");
// These are available on the widget implementation, but it seems impossible
// to grab that impl at runtime.
const DECKINDEX_TABS = 0;
const DECKINDEX_TABSDISABLED = 1;
const DECKINDEX_FETCHING = 2;
diff --git browser/components/distribution.js browser/components/distribution.js
--- browser/components/distribution.js
+++ browser/components/distribution.js
@@ -5,18 +5,18 @@
var EXPORTED_SYMBOLS = [ "DistributionCustomizer" ];
const DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC =
"distribution-customization-complete";
const PREF_CACHED_FILE_EXISTENCE = "distribution.iniFile.exists.value";
const PREF_CACHED_FILE_APPVERSION = "distribution.iniFile.exists.appversion";
-ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
ChromeUtils.defineModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
function DistributionCustomizer() {
}
diff --git browser/components/downloads/DownloadsCommon.jsm browser/components/downloads/DownloadsCommon.jsm
--- browser/components/downloads/DownloadsCommon.jsm
+++ browser/components/downloads/DownloadsCommon.jsm
@@ -27,18 +27,18 @@ var EXPORTED_SYMBOLS = [
* DownloadsIndicatorData
* This object registers itself with DownloadsData as a view, and transforms the
* notifications it receives into overall status data, that is then broadcast to
* the registered download status indicators.
*/
// Globals
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
-ChromeUtils.import("resource://gre/modules/Services.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
NetUtil: "resource://gre/modules/NetUtil.jsm",
PluralForm: "resource://gre/modules/PluralForm.jsm",
AppConstants: "resource://gre/modules/AppConstants.jsm",
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
DownloadHistory: "resource://gre/modules/DownloadHistory.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
@@ -48,17 +48,17 @@ XPCOMUtils.defineLazyModuleGetters(this,
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
});
XPCOMUtils.defineLazyServiceGetters(this, {
gClipboardHelper: ["@mozilla.org/widget/clipboardhelper;1", "nsIClipboardHelper"],
});
XPCOMUtils.defineLazyGetter(this, "DownloadsLogger", () => {
- let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm", {});
+ let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
let consoleOptions = {
maxLogLevelPref: "browser.download.loglevel",
prefix: "Downloads",
};
return new ConsoleAPI(consoleOptions);
});
const kDownloadsStringBundleUrl =
diff --git browser/components/downloads/DownloadsSubview.jsm browser/components/downloads/DownloadsSubview.jsm
--- browser/components/downloads/DownloadsSubview.jsm
+++ browser/components/downloads/DownloadsSubview.jsm
@@ -3,17 +3,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = [
"DownloadsSubview",
];
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "AppConstants",
"resource://gre/modules/AppConstants.jsm");
ChromeUtils.defineModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
ChromeUtils.defineModuleGetter(this, "DownloadsCommon",
"resource:///modules/DownloadsCommon.jsm");
ChromeUtils.defineModuleGetter(this, "DownloadsViewUI",
diff --git browser/components/downloads/DownloadsTaskbar.jsm browser/components/downloads/DownloadsTaskbar.jsm
--- browser/components/downloads/DownloadsTaskbar.jsm
+++ browser/components/downloads/DownloadsTaskbar.jsm
@@ -11,17 +11,17 @@
"use strict";
var EXPORTED_SYMBOLS = [
"DownloadsTaskbar",
];
// Globals
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
Services: "resource://gre/modules/Services.jsm",
});
XPCOMUtils.defineLazyGetter(this, "gWinTaskbar", function() {
if (!("@mozilla.org/windows-taskbar;1" in Cc)) {
diff --git browser/components/downloads/DownloadsViewUI.jsm browser/components/downloads/DownloadsViewUI.jsm
--- browser/components/downloads/DownloadsViewUI.jsm
+++ browser/components/downloads/DownloadsViewUI.jsm
@@ -8,17 +8,17 @@
*/
"use strict";
var EXPORTED_SYMBOLS = [
"DownloadsViewUI",
];
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
DownloadUtils: "resource://gre/modules/DownloadUtils.jsm",
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm",
OS: "resource://gre/modules/osfile.jsm",
diff --git browser/components/downloads/content/allDownloadsView.js browser/components/downloads/content/allDownloadsView.js
--- browser/components/downloads/content/allDownloadsView.js
+++ browser/components/downloads/content/allDownloadsView.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/. */
/* eslint-env mozilla/browser-window */
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.jsm",
Downloads: "resource://gre/modules/Downloads.jsm",
DownloadsCommon: "resource:///modules/DownloadsCommon.jsm",
DownloadsViewUI: "resource:///modules/DownloadsViewUI.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm",
NetUtil: "resource://gre/modules/NetUtil.jsm",
diff --git browser/components/downloads/content/contentAreaDownloadsView.js browser/components/downloads/content/contentAreaDownloadsView.js
--- browser/components/downloads/content/contentAreaDownloadsView.js
+++ browser/components/downloads/content/contentAreaDownloadsView.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/. */
/* import-globals-from allDownloadsView.js */
-ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
+const {PrivateBrowsingUtils} = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var ContentAreaDownloadsView = {
init() {
let view = new DownloadsPlacesView(document.getElementById("downloadsRichListBox"));
// Do not display the Places downloads in private windows
if (!PrivateBrowsingUtils.isContentWindowPrivate(window)) {
view.place = "place:transition=7&sort=4";
}
diff --git browser/components/downloads/content/downloads.js browser/components/downloads/content/downloads.js
--- browser/components/downloads/content/downloads.js
+++ browser/components/downloads/content/downloads.js
@@ -53,17 +53,17 @@
* We end up capturing the tab/down key events, and preventing their default
* behaviour. We then set a "keyfocus" attribute on the panel, which allows
* us to draw a ring around the currently focused element. If the panel is
* closed or the mouse moves over the panel, we remove the attribute.
*/
"use strict";
-ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
+var {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "DownloadsViewUI",
"resource:///modules/DownloadsViewUI.jsm");
ChromeUtils.defineModuleGetter(this, "DownloadsSubview",
"resource:///modules/DownloadsSubview.jsm");
ChromeUtils.defineModuleGetter(this, "FileUtils",
"resource://gre/modules/FileUtils.jsm");
ChromeUtils.defineModuleGetter(this, "NetUtil",
diff --git browser/components/downloads/test/browser/browser_iframe_gone_mid_download.js browser/components/downloads/test/browser/browser_iframe_gone_mid_download.js
--- browser/components/downloads/test/browser/browser_iframe_gone_mid_download.js
+++ browser/components/downloads/test/browser/browser_iframe_gone_mid_download.js
@@ -1,14 +1,14 @@
const SAVE_PER_SITE_PREF = "browser.download.lastDir.savePerSite";
function test_deleted_iframe(perSitePref, windowOptions = {}) {
return async function() {
await SpecialPowers.pushPrefEnv({ set: [[ SAVE_PER_SITE_PREF, perSitePref ]] });
- let {DownloadLastDir} = ChromeUtils.import("resource://gre/modules/DownloadLastDir.jsm", {});
+ let {DownloadLastDir} = ChromeUtils.import("resource://gre/modules/DownloadLastDir.jsm");
let win = await BrowserTestUtils.openNewBrowserWindow(windowOptions);
let tab = await BrowserTestUtils.openNewForegroundTab(win.gBrowser, "about:mozilla");
let doc = tab.linkedBrowser.contentDocument;
let iframe = doc.createElement("iframe");