mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Backed out changeset 5018856d8fee (bug 1758474) for causing node eslint failure. CLOSED TREE
This commit is contained in:
parent
413a559c70
commit
e89faa903f
@ -885,7 +885,8 @@ var FullScreen = {
|
||||
|
||||
XPCOMUtils.defineLazyGetter(FullScreen, "_permissionNotificationIDs", () => {
|
||||
let { PermissionUI } = ChromeUtils.import(
|
||||
"resource:///modules/PermissionUI.jsm"
|
||||
"resource:///modules/PermissionUI.jsm",
|
||||
{}
|
||||
);
|
||||
return (
|
||||
Object.values(PermissionUI)
|
||||
|
@ -1645,7 +1645,8 @@ var gBrowserInit = {
|
||||
) {
|
||||
let windowFrameColor = new Color(
|
||||
...ChromeUtils.import(
|
||||
"resource:///modules/Windows8WindowFrameColor.jsm"
|
||||
"resource:///modules/Windows8WindowFrameColor.jsm",
|
||||
{}
|
||||
).Windows8WindowFrameColor.get()
|
||||
);
|
||||
// Default to black for foreground text.
|
||||
@ -2338,7 +2339,8 @@ var gBrowserInit = {
|
||||
try {
|
||||
DownloadsCommon.initializeAllDataLinks();
|
||||
ChromeUtils.import(
|
||||
"resource:///modules/DownloadsTaskbar.jsm"
|
||||
"resource:///modules/DownloadsTaskbar.jsm",
|
||||
{}
|
||||
).DownloadsTaskbar.registerIndicator(window);
|
||||
if (AppConstants.platform == "macosx") {
|
||||
ChromeUtils.import(
|
||||
|
@ -6,12 +6,14 @@
|
||||
|
||||
// Pass an empty scope object to the import to prevent "leaked window property"
|
||||
// errors in tests.
|
||||
var { Preferences } = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
var { TelemetryReportingPolicy } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryReportingPolicy.jsm"
|
||||
);
|
||||
var Preferences = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm",
|
||||
{}
|
||||
).Preferences;
|
||||
var TelemetryReportingPolicy = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryReportingPolicy.jsm",
|
||||
{}
|
||||
).TelemetryReportingPolicy;
|
||||
|
||||
const PREF_BRANCH = "datareporting.policy.";
|
||||
const PREF_FIRST_RUN = "toolkit.telemetry.reportingpolicy.firstRun";
|
||||
|
@ -82,8 +82,10 @@ add_task(async function() {
|
||||
|
||||
let updateChannel = null;
|
||||
try {
|
||||
updateChannel = ChromeUtils.import("resource://gre/modules/UpdateUtils.jsm")
|
||||
.UpdateUtils.UpdateChannel;
|
||||
updateChannel = ChromeUtils.import(
|
||||
"resource://gre/modules/UpdateUtils.jsm",
|
||||
{}
|
||||
).UpdateUtils.UpdateChannel;
|
||||
} catch (ex) {}
|
||||
if (!updateChannel) {
|
||||
Assert.ok(
|
||||
|
@ -265,7 +265,8 @@ add_task(async function checkAllTheDTDs() {
|
||||
add_task(async function checkAllTheFluents() {
|
||||
let uris = await getAllTheFiles(".ftl");
|
||||
let { FluentParser, Visitor } = ChromeUtils.import(
|
||||
"resource://testing-common/FluentSyntax.jsm"
|
||||
"resource://testing-common/FluentSyntax.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
class TextElementVisitor extends Visitor {
|
||||
|
@ -407,9 +407,10 @@ add_task(async function checkAllTheCSS() {
|
||||
// Create a clean iframe to load all the files into. This needs to live at a
|
||||
// chrome URI so that it's allowed to load and parse any styles.
|
||||
let testFile = getRootDirectory(gTestPath) + "dummy_page.html";
|
||||
let { HiddenFrame } = ChromeUtils.import(
|
||||
"resource://gre/modules/HiddenFrame.jsm"
|
||||
);
|
||||
let HiddenFrame = ChromeUtils.import(
|
||||
"resource://gre/modules/HiddenFrame.jsm",
|
||||
{}
|
||||
).HiddenFrame;
|
||||
let hiddenFrame = new HiddenFrame();
|
||||
let win = await hiddenFrame.get();
|
||||
let iframe = win.document.createElementNS(
|
||||
|
@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function() {
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js", {});
|
||||
});
|
||||
|
||||
ChromeUtils.defineModuleGetter(
|
||||
|
@ -3,7 +3,8 @@ const { AddonManagerPrivate } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
const { AddonTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/AddonTestUtils.jsm"
|
||||
"resource://testing-common/AddonTestUtils.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
AddonTestUtils.initMochitest(this);
|
||||
|
@ -104,7 +104,7 @@ function promiseIndicatorWindow() {
|
||||
}
|
||||
|
||||
async function assertWebRTCIndicatorStatus(expected) {
|
||||
let ui = ChromeUtils.import("resource:///modules/webrtcUI.jsm").webrtcUI;
|
||||
let ui = ChromeUtils.import("resource:///modules/webrtcUI.jsm", {}).webrtcUI;
|
||||
let expectedState = expected ? "visible" : "hidden";
|
||||
let msg = "WebRTC indicator " + expectedState;
|
||||
if (!expected && ui.showGlobalIndicator) {
|
||||
|
@ -1642,7 +1642,8 @@ BrowserGlue.prototype = {
|
||||
let updateChannel;
|
||||
try {
|
||||
updateChannel = ChromeUtils.import(
|
||||
"resource://gre/modules/UpdateUtils.jsm"
|
||||
"resource://gre/modules/UpdateUtils.jsm",
|
||||
{}
|
||||
).UpdateUtils.UpdateChannel;
|
||||
} catch (ex) {}
|
||||
if (updateChannel) {
|
||||
|
@ -33,7 +33,8 @@ ChromeUtils.defineModuleGetter(
|
||||
"resource:///modules/MacAttribution.jsm"
|
||||
);
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
|
@ -9,7 +9,8 @@ const { XPCOMUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
|
@ -19,9 +19,10 @@ function checkSubviewButtonClass(menuId, buttonId, subviewId) {
|
||||
return async function() {
|
||||
// Initialize DevTools before starting the test in order to create menuitems in
|
||||
// menuWebDeveloperPopup.
|
||||
ChromeUtils.import("resource://devtools/shared/loader/Loader.jsm").require(
|
||||
"devtools/client/framework/devtools-browser"
|
||||
);
|
||||
ChromeUtils.import(
|
||||
"resource://devtools/shared/loader/Loader.jsm",
|
||||
{}
|
||||
).require("devtools/client/framework/devtools-browser");
|
||||
|
||||
info(
|
||||
"Checking for items without the subviewbutton class in " +
|
||||
|
@ -318,9 +318,10 @@ DistributionCustomizer.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let { ProfileAge } = ChromeUtils.import(
|
||||
"resource://gre/modules/ProfileAge.jsm"
|
||||
);
|
||||
let ProfileAge = ChromeUtils.import(
|
||||
"resource://gre/modules/ProfileAge.jsm",
|
||||
{}
|
||||
).ProfileAge;
|
||||
let profileAge = await ProfileAge();
|
||||
let resetDate = await profileAge.reset;
|
||||
|
||||
|
@ -21,7 +21,8 @@ const { XPCOMUtils } = ChromeUtils.import(
|
||||
);
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
maxLogLevelPref: "browser.esedbreader.loglevel",
|
||||
prefix: "ESEDBReader",
|
||||
|
@ -16,7 +16,8 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
FxAccountsPairingFlow: "resource://gre/modules/FxAccountsPairing.jsm",
|
||||
});
|
||||
const { require } = ChromeUtils.import(
|
||||
"resource://devtools/shared/loader/Loader.jsm"
|
||||
"resource://devtools/shared/loader/Loader.jsm",
|
||||
{}
|
||||
);
|
||||
const QR = require("devtools/shared/qrcode/index");
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
/* import-globals-from preferences.js */
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function() {
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js", {});
|
||||
});
|
||||
|
||||
const FXA_PAGE_LOGGED_OUT = 0;
|
||||
|
@ -3,9 +3,13 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
const { UIState } = ChromeUtils.import("resource://services-sync/UIState.jsm");
|
||||
const { UIState } = ChromeUtils.import(
|
||||
"resource://services-sync/UIState.jsm",
|
||||
{}
|
||||
);
|
||||
const { FxAccountsPairingFlow } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsPairing.jsm"
|
||||
"resource://gre/modules/FxAccountsPairing.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
// Use sinon for mocking.
|
||||
|
@ -41,12 +41,12 @@ function clearHistoryAndWait() {
|
||||
*/
|
||||
|
||||
async function runTest() {
|
||||
let { FileUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/FileUtils.jsm"
|
||||
);
|
||||
let { DownloadLastDir } = ChromeUtils.import(
|
||||
"resource://gre/modules/DownloadLastDir.jsm"
|
||||
);
|
||||
let FileUtils = ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {})
|
||||
.FileUtils;
|
||||
let DownloadLastDir = ChromeUtils.import(
|
||||
"resource://gre/modules/DownloadLastDir.jsm",
|
||||
{}
|
||||
).DownloadLastDir;
|
||||
|
||||
let tmpDir = FileUtils.getDir("TmpD", [], true);
|
||||
let dir1 = newDirectory();
|
||||
|
@ -6,12 +6,12 @@
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let { FileUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/FileUtils.jsm"
|
||||
);
|
||||
let { DownloadLastDir } = ChromeUtils.import(
|
||||
"resource://gre/modules/DownloadLastDir.jsm"
|
||||
);
|
||||
let FileUtils = ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {})
|
||||
.FileUtils;
|
||||
let DownloadLastDir = ChromeUtils.import(
|
||||
"resource://gre/modules/DownloadLastDir.jsm",
|
||||
{}
|
||||
).DownloadLastDir;
|
||||
let MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
let launcher = {
|
||||
source: Services.io.newURI("http://test1.com/file"),
|
||||
|
@ -6,12 +6,12 @@
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let { FileUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/FileUtils.jsm"
|
||||
);
|
||||
let { DownloadLastDir } = ChromeUtils.import(
|
||||
"resource://gre/modules/DownloadLastDir.jsm"
|
||||
);
|
||||
let FileUtils = ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {})
|
||||
.FileUtils;
|
||||
let DownloadLastDir = ChromeUtils.import(
|
||||
"resource://gre/modules/DownloadLastDir.jsm",
|
||||
{}
|
||||
).DownloadLastDir;
|
||||
let MockFilePicker = SpecialPowers.MockFilePicker;
|
||||
|
||||
MockFilePicker.init(window);
|
||||
|
@ -20,11 +20,6 @@ ChromeUtils.defineModuleGetter(
|
||||
"TestUtils",
|
||||
"resource://testing-common/TestUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(
|
||||
this,
|
||||
"FileUtils",
|
||||
"resource://gre/modules/FileUtils.jsm"
|
||||
);
|
||||
|
||||
function whenNewWindowLoaded(aOptions, aCallback) {
|
||||
let win = OpenBrowserWindow(aOptions);
|
||||
@ -61,6 +56,8 @@ async function openAboutPrivateBrowsing() {
|
||||
}
|
||||
|
||||
function newDirectory() {
|
||||
let FileUtils = ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {})
|
||||
.FileUtils;
|
||||
let tmpDir = FileUtils.getDir("TmpD", [], true);
|
||||
let dir = tmpDir.clone();
|
||||
dir.append("testdir");
|
||||
@ -69,6 +66,8 @@ function newDirectory() {
|
||||
}
|
||||
|
||||
function newFileInDirectory(aDir) {
|
||||
let FileUtils = ChromeUtils.import("resource://gre/modules/FileUtils.jsm", {})
|
||||
.FileUtils;
|
||||
let file = aDir.clone();
|
||||
file.append("testfile");
|
||||
file.createUnique(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_FILE);
|
||||
|
@ -102,10 +102,12 @@
|
||||
window.addEventListener("unload", this.destroy);
|
||||
|
||||
this.FormHistory = ChromeUtils.import(
|
||||
"resource://gre/modules/FormHistory.jsm"
|
||||
"resource://gre/modules/FormHistory.jsm",
|
||||
{}
|
||||
).FormHistory;
|
||||
this.SearchSuggestionController = ChromeUtils.import(
|
||||
"resource://gre/modules/SearchSuggestionController.jsm"
|
||||
"resource://gre/modules/SearchSuggestionController.jsm",
|
||||
{}
|
||||
).SearchSuggestionController;
|
||||
|
||||
Services.obs.addObserver(this.observer, "browser-search-engine-modified");
|
||||
|
@ -3,9 +3,10 @@
|
||||
|
||||
"use strict";
|
||||
|
||||
var { Preferences } = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
var Preferences = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm",
|
||||
{}
|
||||
).Preferences;
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
@ -83,9 +83,10 @@ add_task(async function test_add() {
|
||||
|
||||
add_task(async function test_diacritics() {
|
||||
const diacritic_engine = "Foo \u2661";
|
||||
let { Preferences } = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
let Preferences = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm",
|
||||
{}
|
||||
).Preferences;
|
||||
|
||||
Preferences.set("browser.search.hiddenOneOffs", diacritic_engine);
|
||||
await SearchTestUtils.promiseNewSearchEngine(
|
||||
|
@ -7,9 +7,10 @@ const searchPopup = document.getElementById("PopupSearchAutoComplete");
|
||||
|
||||
const diacritic_engine = "Foo \u2661";
|
||||
|
||||
var { Preferences } = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm"
|
||||
);
|
||||
var Preferences = ChromeUtils.import(
|
||||
"resource://gre/modules/Preferences.jsm",
|
||||
{}
|
||||
).Preferences;
|
||||
|
||||
let searchIcon;
|
||||
|
||||
|
@ -28,7 +28,8 @@ add_task(async function init() {
|
||||
// Make sure that we have a profile before initializing SessionFile
|
||||
let profd = do_get_profile();
|
||||
SessionFile = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
"resource:///modules/sessionstore/SessionFile.jsm",
|
||||
{}
|
||||
).SessionFile;
|
||||
Paths = SessionFile.Paths;
|
||||
|
||||
|
@ -58,7 +58,8 @@ add_task(async function test_migration() {
|
||||
// Make sure that we have a profile before initializing SessionFile.
|
||||
let profd = do_get_profile();
|
||||
SessionFile = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
"resource:///modules/sessionstore/SessionFile.jsm",
|
||||
{}
|
||||
).SessionFile;
|
||||
Paths = SessionFile.Paths;
|
||||
|
||||
|
@ -4,7 +4,8 @@
|
||||
function run_test() {
|
||||
let profd = do_get_profile();
|
||||
var SessionFile = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
"resource:///modules/sessionstore/SessionFile.jsm",
|
||||
{}
|
||||
).SessionFile;
|
||||
|
||||
let sourceSession = do_get_file("data/sessionstore_invalid.js");
|
||||
|
@ -9,7 +9,8 @@
|
||||
function run_test() {
|
||||
let profd = do_get_profile();
|
||||
var SessionFile = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionFile.jsm"
|
||||
"resource:///modules/sessionstore/SessionFile.jsm",
|
||||
{}
|
||||
).SessionFile;
|
||||
|
||||
let sourceSession = do_get_file("data/sessionstore_valid.js");
|
||||
|
@ -30,11 +30,12 @@ let { getChromeWindow } = ChromeUtils.import(
|
||||
const { UIState } = ChromeUtils.import("resource://services-sync/UIState.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function() {
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js", {});
|
||||
});
|
||||
|
||||
let log = ChromeUtils.import(
|
||||
"resource://gre/modules/Log.jsm"
|
||||
"resource://gre/modules/Log.jsm",
|
||||
{}
|
||||
).Log.repository.getLogger("Sync.RemoteTabs");
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SyncedTabsDeckComponent"];
|
||||
|
@ -5,7 +5,8 @@
|
||||
"use strict";
|
||||
|
||||
let log = ChromeUtils.import(
|
||||
"resource://gre/modules/Log.jsm"
|
||||
"resource://gre/modules/Log.jsm",
|
||||
{}
|
||||
).Log.repository.getLogger("Sync.RemoteTabs");
|
||||
|
||||
var EXPORTED_SYMBOLS = ["SyncedTabsDeckView"];
|
||||
|
@ -10,7 +10,8 @@ const { XPCOMUtils } = ChromeUtils.import(
|
||||
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
let log = ChromeUtils.import(
|
||||
"resource://gre/modules/Log.jsm"
|
||||
"resource://gre/modules/Log.jsm",
|
||||
{}
|
||||
).Log.repository.getLogger("Sync.RemoteTabs");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
|
@ -17,7 +17,8 @@ let { getChromeWindow } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
let log = ChromeUtils.import(
|
||||
"resource://gre/modules/Log.jsm"
|
||||
"resource://gre/modules/Log.jsm",
|
||||
{}
|
||||
).Log.repository.getLogger("Sync.RemoteTabs");
|
||||
|
||||
var EXPORTED_SYMBOLS = ["TabListView"];
|
||||
|
@ -5,7 +5,7 @@ var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
var { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function() {
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js", {});
|
||||
});
|
||||
|
||||
do_get_profile(); // fxa needs a profile directory for storage.
|
||||
|
@ -107,7 +107,8 @@ class TranslationChild extends JSWindowActorChild {
|
||||
|
||||
let engine = Services.prefs.getCharPref("browser.translation.engine");
|
||||
let importScope = ChromeUtils.import(
|
||||
`resource:///modules/translation/${engine}Translator.jsm`
|
||||
`resource:///modules/translation/${engine}Translator.jsm`,
|
||||
{}
|
||||
);
|
||||
let translator = new importScope[engine + "Translator"](
|
||||
translationDocument,
|
||||
|
@ -58,7 +58,8 @@ const TARGET_SEARCHENGINE_PREFIX = "searchEngine-";
|
||||
|
||||
// Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref.
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
maxLogLevelPref: PREF_LOG_LEVEL,
|
||||
prefix: "UITour",
|
||||
|
@ -91,7 +91,7 @@ class ProvidersManager {
|
||||
// providers at the front.
|
||||
this.providers = [];
|
||||
for (let [symbol, module] of Object.entries(localProviderModules)) {
|
||||
let { [symbol]: provider } = ChromeUtils.import(module);
|
||||
let { [symbol]: provider } = ChromeUtils.import(module, {});
|
||||
this.registerProvider(provider);
|
||||
}
|
||||
// Tracks ongoing Query instances by queryContext.
|
||||
@ -105,7 +105,7 @@ class ProvidersManager {
|
||||
// This maps muxer names to muxers.
|
||||
this.muxers = new Map();
|
||||
for (let [symbol, module] of Object.entries(localMuxerModules)) {
|
||||
let { [symbol]: muxer } = ChromeUtils.import(module);
|
||||
let { [symbol]: muxer } = ChromeUtils.import(module, {});
|
||||
this.registerMuxer(muxer);
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +278,8 @@
|
||||
this.setAttribute("formautofillattached", "true");
|
||||
|
||||
let { AppConstants } = ChromeUtils.import(
|
||||
"resource://gre/modules/AppConstants.jsm"
|
||||
"resource://gre/modules/AppConstants.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
let buttonTextBundleKey;
|
||||
|
@ -6,7 +6,8 @@
|
||||
"use strict";
|
||||
|
||||
const { setTimeout, clearTimeout } = ChromeUtils.import(
|
||||
"resource://gre/modules/Timer.jsm"
|
||||
"resource://gre/modules/Timer.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
var FormAutofillHandler, OSKeyStore;
|
||||
|
@ -4,6 +4,8 @@
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
ChromeUtils.import("resource:///modules/CustomizableUI.jsm", {});
|
||||
|
||||
add_task(async function testScreenshotButtonDisabled() {
|
||||
info("Test the Screenshots button in the panel");
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* globals ProcessHangMonitor */
|
||||
|
||||
const { WebExtensionPolicy } = Cu.getGlobalForObject(
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm")
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm", {})
|
||||
);
|
||||
|
||||
const { UpdateUtils } = ChromeUtils.import(
|
||||
|
@ -120,9 +120,10 @@ add_task(async function test_sessionRestore() {
|
||||
};
|
||||
|
||||
// Save the current session.
|
||||
let { SessionStore } = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStore.jsm"
|
||||
);
|
||||
let SessionStore = ChromeUtils.import(
|
||||
"resource:///modules/sessionstore/SessionStore.jsm",
|
||||
{}
|
||||
).SessionStore;
|
||||
|
||||
// Load the custom state and wait for SSTabRestored, as we want to make sure
|
||||
// that the URI counting code was hit.
|
||||
|
@ -36,8 +36,10 @@ async function setup() {
|
||||
|
||||
let aAddon = await AddonManager.getAddonByID("mozscreenshots@mozilla.org");
|
||||
isnot(aAddon, null, "The mozscreenshots extension should be installed");
|
||||
TestRunner = ChromeUtils.import("resource://mozscreenshots/TestRunner.jsm")
|
||||
.TestRunner;
|
||||
TestRunner = ChromeUtils.import(
|
||||
"resource://mozscreenshots/TestRunner.jsm",
|
||||
{}
|
||||
).TestRunner;
|
||||
TestRunner.initTest(this);
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,8 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
|
||||
const PREF_LOG_LEVEL = "extensions.mozscreenshots@mozilla.org.loglevel";
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
maxLogLevel: "info",
|
||||
maxLogLevelPref: PREF_LOG_LEVEL,
|
||||
|
@ -10,9 +10,10 @@ registerManifests(manifests);
|
||||
function run_test() {
|
||||
const uuidGenerator = Services.uuid;
|
||||
|
||||
let { newAppInfo } = ChromeUtils.import(
|
||||
"resource://testing-common/AppInfo.jsm"
|
||||
);
|
||||
let newAppInfo = ChromeUtils.import(
|
||||
"resource://testing-common/AppInfo.jsm",
|
||||
{}
|
||||
).newAppInfo;
|
||||
let XULAppInfo = newAppInfo({
|
||||
name: "XPCShell",
|
||||
ID: "{39885e5f-f6b4-4e2a-87e5-6259ecf79011}",
|
||||
|
@ -8,7 +8,8 @@ const Services = require("Services");
|
||||
|
||||
const ChromeUtils = require("ChromeUtils");
|
||||
const { RemoteSettings } = ChromeUtils.import(
|
||||
"resource://services-settings/remote-settings.js"
|
||||
"resource://services-settings/remote-settings.js",
|
||||
{}
|
||||
);
|
||||
|
||||
const TARGET_BROWSER_ID = [
|
||||
|
@ -5,7 +5,7 @@ reject-chromeutils-import-params
|
||||
largely deprecated.
|
||||
|
||||
The use of object destructuring is preferred over the second parameter being
|
||||
``this`` or ``{}``.
|
||||
``this``.
|
||||
|
||||
Using explicit exports is preferred over the second parameter being ``null``.
|
||||
|
||||
@ -16,7 +16,6 @@ Examples of incorrect code for this rule:
|
||||
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm", this);
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm", null);
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm", {});
|
||||
|
||||
Examples of correct code for this rule:
|
||||
---------------------------------------
|
||||
|
@ -37,7 +37,8 @@ ChromeUtils.defineModuleGetter(
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "Log", () => {
|
||||
return ChromeUtils.import(
|
||||
"resource://gre/modules/AndroidLog.jsm"
|
||||
"resource://gre/modules/AndroidLog.jsm",
|
||||
{}
|
||||
).AndroidLog.bind("Push");
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
var { Downloads } = ChromeUtils.import("resource://gre/modules/Downloads.jsm");
|
||||
var Downloads = ChromeUtils.import("resource://gre/modules/Downloads.jsm", {})
|
||||
.Downloads;
|
||||
|
||||
var gTestRoot = getRootDirectory(gTestPath).replace(
|
||||
"chrome://mochitests/content/",
|
||||
|
@ -6,7 +6,7 @@ const ConsoleAPIStorage = Cc["@mozilla.org/consoleAPI-storage;1"].getService(
|
||||
);
|
||||
|
||||
const { WebExtensionPolicy } = Cu.getGlobalForObject(
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm")
|
||||
ChromeUtils.import("resource://gre/modules/Services.jsm", {})
|
||||
);
|
||||
|
||||
const FAKE_ADDON_ID = "test-webext-addon@mozilla.org";
|
||||
|
@ -39,9 +39,10 @@ add_task(async function test_windowlessBrowserTroubleshootCrash() {
|
||||
}
|
||||
ok(true, "not crashed");
|
||||
|
||||
var { Troubleshoot } = ChromeUtils.import(
|
||||
"resource://gre/modules/Troubleshoot.jsm"
|
||||
);
|
||||
var Troubleshoot = ChromeUtils.import(
|
||||
"resource://gre/modules/Troubleshoot.jsm",
|
||||
{}
|
||||
).Troubleshoot;
|
||||
var data = await new Promise((resolve, reject) => {
|
||||
Troubleshoot.snapshot(data => {
|
||||
resolve(data);
|
||||
|
@ -88,7 +88,7 @@ var GeckoViewUtils = {
|
||||
XPCOMUtils.defineLazyGetter(scope, name, _ => {
|
||||
let ret = undefined;
|
||||
if (module) {
|
||||
ret = ChromeUtils.import(module)[name];
|
||||
ret = ChromeUtils.import(module, {})[name];
|
||||
} else if (service) {
|
||||
ret = Cc[service].getService(Ci.nsISupports).wrappedJSObject;
|
||||
} else if (typeof handler === "function") {
|
||||
|
@ -9,7 +9,7 @@ function test() {
|
||||
|
||||
// We overload this test to include verifying that httpd.js is
|
||||
// importable as a testing-only JS module.
|
||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
ChromeUtils.import("resource://testing-common/httpd.js", {});
|
||||
|
||||
nextTest();
|
||||
}
|
||||
|
@ -12,6 +12,10 @@
|
||||
// * it does a sanity check to ensure other cert verifier behavior is
|
||||
// unmodified
|
||||
|
||||
const { setTimeout } = ChromeUtils.import(
|
||||
"resource://gre/modules/Timer.jsm",
|
||||
{}
|
||||
);
|
||||
const { RemoteSecuritySettings } = ChromeUtils.import(
|
||||
"resource://gre/modules/psm/RemoteSecuritySettings.jsm"
|
||||
);
|
||||
|
@ -18,7 +18,7 @@ function expectImportsToSucceed(mm, base = MODULE_BASE) {
|
||||
let resource = base + m;
|
||||
let succeeded = false;
|
||||
try {
|
||||
ChromeUtils.import(resource);
|
||||
ChromeUtils.import(resource, {});
|
||||
succeeded = true;
|
||||
} catch (e) {}
|
||||
|
||||
@ -33,7 +33,7 @@ function expectImportsToFail(mm, base = MODULE_BASE) {
|
||||
let resource = base + m;
|
||||
let succeeded = false;
|
||||
try {
|
||||
ChromeUtils.import(resource);
|
||||
ChromeUtils.import(resource, {});
|
||||
succeeded = true;
|
||||
} catch (e) {}
|
||||
|
||||
|
@ -7,6 +7,6 @@ function run_test() {
|
||||
for (let m of modules) {
|
||||
let resource = "resource://services-crypto/" + m;
|
||||
_("Attempting to import: " + resource);
|
||||
ChromeUtils.import(resource);
|
||||
ChromeUtils.import(resource, {});
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,8 @@ FxAccountsPushService.prototype = {
|
||||
this.fxai = options.fxai;
|
||||
} else {
|
||||
let { fxAccounts } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccounts.jsm"
|
||||
"resource://gre/modules/FxAccounts.jsm",
|
||||
{}
|
||||
);
|
||||
this.fxai = fxAccounts._internal;
|
||||
}
|
||||
|
@ -4,16 +4,20 @@
|
||||
"use strict";
|
||||
|
||||
const { FxAccountsPairingFlow } = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsPairing.jsm"
|
||||
"resource://gre/modules/FxAccountsPairing.jsm",
|
||||
{}
|
||||
);
|
||||
const { EventEmitter } = ChromeUtils.import(
|
||||
"resource://gre/modules/EventEmitter.jsm"
|
||||
"resource://gre/modules/EventEmitter.jsm",
|
||||
{}
|
||||
);
|
||||
const { PromiseUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/PromiseUtils.jsm"
|
||||
"resource://gre/modules/PromiseUtils.jsm",
|
||||
{}
|
||||
);
|
||||
const { CryptoUtils } = ChromeUtils.import(
|
||||
"resource://services-crypto/utils.js"
|
||||
"resource://services-crypto/utils.js",
|
||||
{}
|
||||
);
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
jwcrypto: "resource://services-crypto/jwcrypto.jsm",
|
||||
|
@ -36,7 +36,8 @@ XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
|
||||
// See LOG_LEVELS in Console.jsm. Common examples: "all", "debug", "info", "warn", "error".
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
const { ConsoleAPI } = ChromeUtils.import(
|
||||
"resource://gre/modules/Console.jsm"
|
||||
"resource://gre/modules/Console.jsm",
|
||||
{}
|
||||
);
|
||||
return new ConsoleAPI({
|
||||
maxLogLevel: "warn",
|
||||
|
@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function() {
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js");
|
||||
return ChromeUtils.import("resource://gre/modules/FxAccountsCommon.js", {});
|
||||
});
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["SyncDisconnectInternal", "SyncDisconnect"];
|
||||
@ -32,7 +32,7 @@ this.SyncDisconnectInternal = {
|
||||
|
||||
// mocked by tests.
|
||||
getWeave() {
|
||||
return ChromeUtils.import("resource://services-sync/main.js").Weave;
|
||||
return ChromeUtils.import("resource://services-sync/main.js", {}).Weave;
|
||||
},
|
||||
|
||||
// Returns a promise that resolves when we are not syncing, waiting until
|
||||
|
@ -39,12 +39,12 @@ function run_test() {
|
||||
for (let m of modules) {
|
||||
let res = "resource://services-sync/" + m;
|
||||
_("Attempting to load " + res);
|
||||
ChromeUtils.import(res);
|
||||
ChromeUtils.import(res, {});
|
||||
}
|
||||
|
||||
for (let m of testingModules) {
|
||||
let res = "resource://testing-common/services/sync/" + m;
|
||||
_("Attempting to load " + res);
|
||||
ChromeUtils.import(res);
|
||||
ChromeUtils.import(res, {});
|
||||
}
|
||||
}
|
||||
|
@ -272,9 +272,10 @@ TalosPowersService.prototype = {
|
||||
// We can wait for various startup items here to complete during
|
||||
// the getInfo.html step for Talos so that subsequent runs don't
|
||||
// have to do things like re-request the SafeBrowsing list.
|
||||
let { SafeBrowsing } = ChromeUtils.import(
|
||||
"resource://gre/modules/SafeBrowsing.jsm"
|
||||
);
|
||||
let SafeBrowsing = ChromeUtils.import(
|
||||
"resource://gre/modules/SafeBrowsing.jsm",
|
||||
{}
|
||||
).SafeBrowsing;
|
||||
|
||||
// Speed things up in case nobody else called this:
|
||||
SafeBrowsing.init();
|
||||
|
@ -562,7 +562,8 @@ function _execute_test() {
|
||||
let coverageCollector = null;
|
||||
if (typeof _JSCOV_DIR === "string") {
|
||||
let _CoverageCollector = ChromeUtils.import(
|
||||
"resource://testing-common/CoverageUtils.jsm"
|
||||
"resource://testing-common/CoverageUtils.jsm",
|
||||
{}
|
||||
).CoverageCollector;
|
||||
coverageCollector = new _CoverageCollector(_JSCOV_DIR);
|
||||
}
|
||||
|
@ -15,7 +15,8 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
|
@ -11,7 +11,8 @@ const { XPCOMUtils } = ChromeUtils.import(
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
|
@ -150,9 +150,10 @@ var FormAutofill = {
|
||||
scope.debug = debug;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(scope, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import(
|
||||
"resource://gre/modules/Console.jsm"
|
||||
);
|
||||
let ConsoleAPI = ChromeUtils.import(
|
||||
"resource://gre/modules/Console.jsm",
|
||||
{}
|
||||
).ConsoleAPI;
|
||||
return new ConsoleAPI({
|
||||
maxLogLevelPref: "extensions.formautofill.loglevel",
|
||||
prefix: logPrefix,
|
||||
|
@ -38,7 +38,7 @@ if (typeof Components != "undefined") {
|
||||
this.exports = {};
|
||||
({ Services } = ChromeUtils.import("resource://gre/modules/Services.jsm"));
|
||||
this.Services = Services;
|
||||
Meta = ChromeUtils.import("resource://gre/modules/PromiseWorker.jsm")
|
||||
Meta = ChromeUtils.import("resource://gre/modules/PromiseWorker.jsm", {})
|
||||
.BasePromiseWorker.Meta;
|
||||
} else {
|
||||
importScripts("resource://gre/modules/workers/require.js");
|
||||
|
@ -7,7 +7,8 @@ const { LoginRelatedRealmsParent } = ChromeUtils.import(
|
||||
"resource://gre/modules/LoginRelatedRealms.jsm"
|
||||
);
|
||||
const { RemoteSettings } = ChromeUtils.import(
|
||||
"resource://services-settings/remote-settings.js"
|
||||
"resource://services-settings/remote-settings.js",
|
||||
{}
|
||||
);
|
||||
|
||||
const REMOTE_SETTINGS_COLLECTION = "websites-with-shared-credential-backends";
|
||||
|
@ -9,7 +9,8 @@
|
||||
"use strict";
|
||||
|
||||
const { RemoteSettings } = ChromeUtils.import(
|
||||
"resource://services-settings/remote-settings.js"
|
||||
"resource://services-settings/remote-settings.js",
|
||||
{}
|
||||
);
|
||||
|
||||
const REMOTE_SETTINGS_COLLECTION = "password-recipes";
|
||||
|
@ -27,7 +27,8 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
||||
XPCOMUtils.defineLazyGlobalGetters(this, ["XMLSerializer"]);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
let consoleOptions = {
|
||||
// tip: set maxLogLevel to "debug" and use log.debug() to create detailed
|
||||
// messages during development. See LOG_LEVELS in Console.jsm for details.
|
||||
|
@ -482,7 +482,7 @@
|
||||
if (this.isRemoteBrowser) {
|
||||
if (!this._remoteFinder) {
|
||||
let jsm = "resource://gre/modules/FinderParent.jsm";
|
||||
let { FinderParent } = ChromeUtils.import(jsm);
|
||||
let { FinderParent } = ChromeUtils.import(jsm, {});
|
||||
this._remoteFinder = new FinderParent(this);
|
||||
}
|
||||
return this._remoteFinder;
|
||||
@ -492,9 +492,8 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
let { Finder } = ChromeUtils.import(
|
||||
"resource://gre/modules/Finder.jsm"
|
||||
);
|
||||
let Finder = ChromeUtils.import("resource://gre/modules/Finder.jsm", {})
|
||||
.Finder;
|
||||
this._finder = new Finder(this.docShell);
|
||||
}
|
||||
return this._finder;
|
||||
|
@ -50,9 +50,8 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
let { Finder } = ChromeUtils.import(
|
||||
"resource://gre/modules/Finder.jsm"
|
||||
);
|
||||
let Finder = ChromeUtils.import("resource://gre/modules/Finder.jsm", {})
|
||||
.Finder;
|
||||
this._finder = new Finder(this.docShell);
|
||||
}
|
||||
return this._finder;
|
||||
|
@ -377,7 +377,8 @@ var OSKeyStore = {
|
||||
};
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let ConsoleAPI = ChromeUtils.import("resource://gre/modules/Console.jsm", {})
|
||||
.ConsoleAPI;
|
||||
return new ConsoleAPI({
|
||||
maxLogLevelPref: "toolkit.osKeyStore.loglevel",
|
||||
prefix: "OSKeyStore",
|
||||
|
@ -229,7 +229,8 @@ var dataProviders = {
|
||||
|
||||
if (AppConstants.MOZ_UPDATER) {
|
||||
data.updateChannel = ChromeUtils.import(
|
||||
"resource://gre/modules/UpdateUtils.jsm"
|
||||
"resource://gre/modules/UpdateUtils.jsm",
|
||||
{}
|
||||
).UpdateUtils.UpdateChannel;
|
||||
}
|
||||
|
||||
|
@ -720,7 +720,7 @@ var AddonManagerInternal = {
|
||||
CATEGORY_PROVIDER_MODULE
|
||||
)) {
|
||||
try {
|
||||
ChromeUtils.import(url);
|
||||
ChromeUtils.import(url, {});
|
||||
logger.debug(`Loaded provider scope for ${url}`);
|
||||
} catch (e) {
|
||||
AddonManagerPrivate.recordException(
|
||||
|
@ -54,7 +54,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "IconDetails", () => {
|
||||
return ChromeUtils.import("resource://gre/modules/ExtensionParent.jsm")
|
||||
return ChromeUtils.import("resource://gre/modules/ExtensionParent.jsm", {})
|
||||
.ExtensionParent.IconDetails;
|
||||
});
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
/* eslint max-len: ["error", 80] */
|
||||
|
||||
const { AddonTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/AddonTestUtils.jsm"
|
||||
"resource://testing-common/AddonTestUtils.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
const { ExtensionPermissions } = ChromeUtils.import(
|
||||
"resource://gre/modules/ExtensionPermissions.jsm"
|
||||
"resource://gre/modules/ExtensionPermissions.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
const SUPPORT_URL = Services.urlFormatter.formatURL(
|
||||
|
@ -1,5 +1,6 @@
|
||||
const { AddonTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/AddonTestUtils.jsm"
|
||||
"resource://testing-common/AddonTestUtils.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
AddonTestUtils.initMochitest(this);
|
||||
|
@ -11,7 +11,8 @@ registerCleanupFunction(() => {
|
||||
});
|
||||
|
||||
const { AddonTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/AddonTestUtils.jsm"
|
||||
"resource://testing-common/AddonTestUtils.jsm",
|
||||
{}
|
||||
);
|
||||
|
||||
const PREF_UPDATE_ENABLED = "extensions.update.enabled";
|
||||
|
@ -19,13 +19,6 @@ function isIdentifier(node, id) {
|
||||
}
|
||||
|
||||
module.exports = function(context) {
|
||||
function getRangeAfterArgToEnd(argNumber, args) {
|
||||
let sourceCode = context.getSourceCode();
|
||||
return [
|
||||
sourceCode.getTokenAfter(args[argNumber]).range[0],
|
||||
args.at(-1).range[1],
|
||||
];
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public
|
||||
// --------------------------------------------------------------------------
|
||||
@ -38,14 +31,16 @@ module.exports = function(context) {
|
||||
isIdentifier(callee.property, "import") &&
|
||||
node.arguments.length >= 2
|
||||
) {
|
||||
let targetObj = node.arguments[1];
|
||||
if (targetObj.type == "Literal" && targetObj.raw == "null") {
|
||||
if (
|
||||
node.arguments[1].type == "Literal" &&
|
||||
node.arguments[1].raw == "null"
|
||||
) {
|
||||
context.report(
|
||||
node,
|
||||
"ChromeUtils.import should not be called with (..., null) to " +
|
||||
"retrieve the JSM global object. Rely on explicit exports instead."
|
||||
);
|
||||
} else if (targetObj.type == "ThisExpression") {
|
||||
} else if (node.arguments[1].type == "ThisExpression") {
|
||||
context.report({
|
||||
node,
|
||||
message:
|
||||
@ -68,27 +63,6 @@ module.exports = function(context) {
|
||||
},
|
||||
],
|
||||
});
|
||||
} else if (
|
||||
targetObj.type == "ObjectExpression" &&
|
||||
targetObj.properties.length == 0
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
message:
|
||||
"Passing an empty object to ChromeUtils.import is unnecessary",
|
||||
suggest: [
|
||||
{
|
||||
desc:
|
||||
"Passing an empty object to ChromeUtils.import is " +
|
||||
"unnecessary - remove the empty object",
|
||||
fix: fixer => {
|
||||
return fixer.removeRange(
|
||||
getRangeAfterArgToEnd(0, node.arguments)
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -82,19 +82,5 @@ const { My } = ChromeUtils.import("resource://some/path/to/My.jsm");`,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
code: 'ChromeUtils.import("resource://some/path/to/My.js", {})',
|
||||
errors: [
|
||||
{
|
||||
suggestions: [
|
||||
{
|
||||
desc:
|
||||
"Passing an empty object to ChromeUtils.import is unnecessary - remove the empty object",
|
||||
output: `ChromeUtils.import("resource://some/path/to/My.js")`,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user