зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1758476 - Remove some unnecessary uses of the target object argument to ChromeUtils.import. r=mossop,webdriver-reviewers,perftest-reviewers,robwu,whimboo,AlexandruIonescu
Differential Revision: https://phabricator.services.mozilla.com/D140518
This commit is contained in:
Родитель
c61c65324b
Коммит
2d563feacc
|
@ -28,9 +28,8 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "PageMenuChild", () => {
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/PageMenu.jsm", tmp);
|
||||
return new tmp.PageMenuChild();
|
||||
let pageMenu = ChromeUtils.import("resource://gre/modules/PageMenu.jsm");
|
||||
return new pageMenu.PageMenuChild();
|
||||
});
|
||||
|
||||
let contextMenus = new WeakMap();
|
||||
|
|
|
@ -94,9 +94,10 @@ var PointerlockFsWarning = {
|
|||
} else {
|
||||
textElem.removeAttribute("hidden");
|
||||
// Document's principal's URI has a host. Display a warning including it.
|
||||
let utils = {};
|
||||
ChromeUtils.import("resource://gre/modules/DownloadUtils.jsm", utils);
|
||||
let displayHost = utils.DownloadUtils.getURIHost(uri.spec)[0];
|
||||
let { DownloadUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/DownloadUtils.jsm"
|
||||
);
|
||||
let displayHost = DownloadUtils.getURIHost(uri.spec)[0];
|
||||
let l10nString = {
|
||||
"fullscreen-warning": "fullscreen-warning-domain",
|
||||
"pointerlock-warning": "pointerlock-warning-domain",
|
||||
|
|
|
@ -211,9 +211,6 @@ async function drop(dragData, expectedURLs, ignoreFirstWindow = false) {
|
|||
let newWindowButton = document.getElementById("new-window-button");
|
||||
ok(newWindowButton, "New Window button exists");
|
||||
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://testing-common/TestUtils.jsm", tmp);
|
||||
|
||||
let awaitDrop = BrowserTestUtils.waitForEvent(newWindowButton, "drop");
|
||||
|
||||
let loadedPromises = expectedURLs.map(url =>
|
||||
|
|
|
@ -11,18 +11,17 @@ function makeInputStream(aString) {
|
|||
}
|
||||
|
||||
add_task(async function test_remoteWebNavigation_postdata() {
|
||||
let obj = {};
|
||||
ChromeUtils.import("resource://testing-common/httpd.js", obj);
|
||||
ChromeUtils.import("resource://services-common/utils.js", obj);
|
||||
let { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
|
||||
let { CommonUtils } = ChromeUtils.import(
|
||||
"resource://services-common/utils.js"
|
||||
);
|
||||
|
||||
let server = new obj.HttpServer();
|
||||
let server = new HttpServer();
|
||||
server.start(-1);
|
||||
|
||||
await new Promise(resolve => {
|
||||
server.registerPathHandler("/test", (request, response) => {
|
||||
let body = obj.CommonUtils.readBytesFromInputStream(
|
||||
request.bodyInputStream
|
||||
);
|
||||
let body = CommonUtils.readBytesFromInputStream(request.bodyInputStream);
|
||||
is(body, "success", "request body is correct");
|
||||
is(request.method, "POST", "request was a post");
|
||||
response.write("Received from POST: " + body);
|
||||
|
|
|
@ -2537,12 +2537,10 @@ BrowserGlue.prototype = {
|
|||
WINTASKBAR_CONTRACTID in Cc &&
|
||||
Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available
|
||||
) {
|
||||
let temp = {};
|
||||
ChromeUtils.import(
|
||||
"resource:///modules/WindowsJumpLists.jsm",
|
||||
temp
|
||||
const { WinTaskbarJumpList } = ChromeUtils.import(
|
||||
"resource:///modules/WindowsJumpLists.jsm"
|
||||
);
|
||||
temp.WinTaskbarJumpList.startup();
|
||||
WinTaskbarJumpList.startup();
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -2839,9 +2837,10 @@ BrowserGlue.prototype = {
|
|||
},
|
||||
|
||||
() => {
|
||||
let obj = {};
|
||||
ChromeUtils.import("resource://gre/modules/GMPInstallManager.jsm", obj);
|
||||
this._gmpInstallManager = new obj.GMPInstallManager();
|
||||
let { GMPInstallManager } = ChromeUtils.import(
|
||||
"resource://gre/modules/GMPInstallManager.jsm"
|
||||
);
|
||||
this._gmpInstallManager = new GMPInstallManager();
|
||||
// We don't really care about the results, if someone is interested they
|
||||
// can check the log.
|
||||
this._gmpInstallManager.simpleCheckAndInstall().catch(() => {});
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
let syncService = {};
|
||||
ChromeUtils.import("resource://services-sync/service.js", syncService);
|
||||
const service = syncService.Service;
|
||||
const { UIState } = ChromeUtils.import("resource://services-sync/UIState.jsm");
|
||||
|
||||
function mockState(state) {
|
||||
|
|
|
@ -194,13 +194,12 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let scope = {};
|
||||
ChromeUtils.import("resource://gre/modules/Console.jsm", scope);
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let consoleOptions = {
|
||||
maxLogLevel: gDebuggingEnabled ? "all" : "log",
|
||||
prefix: "CustomizableUI",
|
||||
};
|
||||
return new scope.ConsoleAPI(consoleOptions);
|
||||
return new ConsoleAPI(consoleOptions);
|
||||
});
|
||||
|
||||
var CustomizableUIInternal = {
|
||||
|
|
|
@ -36,14 +36,13 @@ const kPrefCustomizationDebug = "browser.uiCustomization.debug";
|
|||
const kPrefScreenshots = "extensions.screenshots.disabled";
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let scope = {};
|
||||
ChromeUtils.import("resource://gre/modules/Console.jsm", scope);
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
let debug = Services.prefs.getBoolPref(kPrefCustomizationDebug, false);
|
||||
let consoleOptions = {
|
||||
maxLogLevel: debug ? "all" : "log",
|
||||
prefix: "CustomizableWidgets",
|
||||
};
|
||||
return new scope.ConsoleAPI(consoleOptions);
|
||||
return new ConsoleAPI(consoleOptions);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
|
|
|
@ -74,14 +74,13 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
|
||||
let gDebug;
|
||||
XPCOMUtils.defineLazyGetter(this, "log", () => {
|
||||
let scope = {};
|
||||
ChromeUtils.import("resource://gre/modules/Console.jsm", scope);
|
||||
let { ConsoleAPI } = ChromeUtils.import("resource://gre/modules/Console.jsm");
|
||||
gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug, false);
|
||||
let consoleOptions = {
|
||||
maxLogLevel: gDebug ? "all" : "log",
|
||||
prefix: "CustomizeMode",
|
||||
};
|
||||
return new scope.ConsoleAPI(consoleOptions);
|
||||
return new ConsoleAPI(consoleOptions);
|
||||
});
|
||||
|
||||
var gDraggingInToolbars;
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
*/
|
||||
"use strict";
|
||||
|
||||
let syncService = {};
|
||||
ChromeUtils.import("resource://services-sync/service.js", syncService);
|
||||
const service = syncService.Service;
|
||||
let { Service } = ChromeUtils.import("resource://services-sync/service.js");
|
||||
const { UIState } = ChromeUtils.import("resource://services-sync/UIState.jsm");
|
||||
|
||||
let getState;
|
||||
|
@ -80,7 +78,7 @@ function mockFunctions() {
|
|||
email: "user@mozilla.com",
|
||||
});
|
||||
|
||||
service.sync = mocked_sync;
|
||||
Service.sync = mocked_sync;
|
||||
}
|
||||
|
||||
function mocked_sync() {
|
||||
|
@ -89,10 +87,10 @@ function mocked_sync() {
|
|||
|
||||
function restoreValues() {
|
||||
UIState.get = getState;
|
||||
service.sync = originalSync;
|
||||
Service.sync = originalSync;
|
||||
}
|
||||
|
||||
function storeInitialValues() {
|
||||
getState = UIState.get;
|
||||
originalSync = service.sync;
|
||||
originalSync = Service.sync;
|
||||
}
|
||||
|
|
|
@ -4,15 +4,12 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
// Avoid leaks by using tmp for imports...
|
||||
var tmp = {};
|
||||
ChromeUtils.import("resource:///modules/CustomizableUI.jsm", tmp);
|
||||
ChromeUtils.import("resource://gre/modules/AppConstants.jsm", tmp);
|
||||
ChromeUtils.import(
|
||||
"resource://testing-common/CustomizableUITestUtils.jsm",
|
||||
tmp
|
||||
);
|
||||
var { CustomizableUI, AppConstants, CustomizableUITestUtils } = tmp;
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AppConstants: "resource://gre/modules/AppConstants.jsm",
|
||||
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
|
||||
CustomizableUITestUtils:
|
||||
"resource://testing-common/CustomizableUITestUtils.jsm",
|
||||
});
|
||||
|
||||
var EventUtils = {};
|
||||
Services.scriptloader.loadSubScript(
|
||||
|
|
|
@ -4,15 +4,12 @@
|
|||
|
||||
// tests the translation infobar, using a fake 'Translation' implementation.
|
||||
|
||||
var tmp = {};
|
||||
ChromeUtils.import(
|
||||
"resource:///modules/translation/TranslationParent.jsm",
|
||||
tmp
|
||||
const { Translation } = ChromeUtils.import(
|
||||
"resource:///modules/translation/TranslationParent.jsm"
|
||||
);
|
||||
const { PermissionTestUtils } = ChromeUtils.import(
|
||||
"resource://testing-common/PermissionTestUtils.jsm"
|
||||
);
|
||||
var { Translation } = tmp;
|
||||
|
||||
const kLanguagesPref = "browser.translation.neverForLanguages";
|
||||
const kShowUIPref = "browser.translation.ui.show";
|
||||
|
|
|
@ -4,12 +4,9 @@
|
|||
|
||||
// tests the translation infobar, using a fake 'Translation' implementation.
|
||||
|
||||
var tmp = {};
|
||||
ChromeUtils.import(
|
||||
"resource:///modules/translation/TranslationParent.jsm",
|
||||
tmp
|
||||
const { Translation, TranslationParent } = ChromeUtils.import(
|
||||
"resource:///modules/translation/TranslationParent.jsm"
|
||||
);
|
||||
var { Translation, TranslationParent } = tmp;
|
||||
|
||||
const kDetectLanguagePref = "browser.translation.detectLanguage";
|
||||
const kShowUIPref = "browser.translation.ui.show";
|
||||
|
|
|
@ -3,12 +3,9 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
var tmp = {};
|
||||
ChromeUtils.import(
|
||||
"resource:///modules/translation/TranslationParent.jsm",
|
||||
tmp
|
||||
const { Translation, TranslationTelemetry } = ChromeUtils.import(
|
||||
"resource:///modules/translation/TranslationParent.jsm"
|
||||
);
|
||||
var { Translation, TranslationTelemetry } = tmp;
|
||||
const Telemetry = Services.telemetry;
|
||||
|
||||
var MetricsChecker = {
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
const SCALAR_BUILDID_MISMATCH = "dom.contentprocess.buildID_mismatch";
|
||||
|
||||
add_task(async function test_aboutRestartRequired() {
|
||||
let CrashHandlers = {};
|
||||
ChromeUtils.import(
|
||||
"resource:///modules/ContentCrashHandlers.jsm",
|
||||
CrashHandlers
|
||||
const { TabCrashHandler } = ChromeUtils.import(
|
||||
"resource:///modules/ContentCrashHandlers.jsm"
|
||||
);
|
||||
|
||||
// Let's reset the counts.
|
||||
|
@ -22,10 +20,8 @@ add_task(async function test_aboutRestartRequired() {
|
|||
);
|
||||
|
||||
// Simulate buildID mismatch
|
||||
CrashHandlers.TabCrashHandler._crashedTabCount = 1;
|
||||
CrashHandlers.TabCrashHandler.sendToRestartRequiredPage(
|
||||
gBrowser.selectedTab.linkedBrowser
|
||||
);
|
||||
TabCrashHandler._crashedTabCount = 1;
|
||||
TabCrashHandler.sendToRestartRequiredPage(gBrowser.selectedTab.linkedBrowser);
|
||||
|
||||
scalars = TelemetryTestUtils.getProcessScalars("parent");
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ function test() {
|
|||
|
||||
const ENABLE_PREF_NAME = "browser.taskbar.previews.enable";
|
||||
|
||||
let temp = {};
|
||||
ChromeUtils.import("resource:///modules/WindowsPreviewPerTab.jsm", temp);
|
||||
let AeroPeek = temp.AeroPeek;
|
||||
let { AeroPeek } = ChromeUtils.import(
|
||||
"resource:///modules/WindowsPreviewPerTab.jsm"
|
||||
);
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
"use strict";
|
||||
|
||||
function scopedCuImport(path) {
|
||||
const scope = {};
|
||||
ChromeUtils.import(path, scope);
|
||||
return scope;
|
||||
}
|
||||
const { require } = scopedCuImport(
|
||||
const { require } = ChromeUtils.import(
|
||||
"resource://devtools/shared/loader/Loader.jsm"
|
||||
);
|
||||
let { gDevTools } = require("devtools/client/framework/devtools");
|
||||
|
|
|
@ -2,12 +2,6 @@
|
|||
// Ensure that FTP subresource loads trigger a warning in the webconsole.
|
||||
"use strict";
|
||||
|
||||
function scopedCuImport(path) {
|
||||
const scope = {};
|
||||
ChromeUtils.import(path, scope);
|
||||
return scope;
|
||||
}
|
||||
|
||||
// These files don't actually exist, we are just looking for messages
|
||||
// that indicate that loading those files would have been blocked.
|
||||
var seen_files = ["a.html", "b.html", "c.html", "d.png"];
|
||||
|
|
|
@ -113,8 +113,7 @@ class MockTimer {
|
|||
add_test(function test_executeSoon_callback() {
|
||||
// executeSoon() is already defined for xpcshell in head.js. As such import
|
||||
// our implementation into a custom namespace.
|
||||
let sync = {};
|
||||
ChromeUtils.import("chrome://remote/content/marionette/sync.js", sync);
|
||||
let sync = ChromeUtils.import("chrome://remote/content/marionette/sync.js");
|
||||
|
||||
for (let func of ["foo", null, true, [], {}]) {
|
||||
Assert.throws(() => sync.executeSoon(func), /TypeError/);
|
||||
|
|
|
@ -29,8 +29,7 @@ add_task(async function test_AnimationFramePromiseAbortWhenWindowClosed() {
|
|||
add_test(function test_executeSoon_callback() {
|
||||
// executeSoon() is already defined for xpcshell in head.js. As such import
|
||||
// our implementation into a custom namespace.
|
||||
let sync = {};
|
||||
ChromeUtils.import("chrome://remote/content/shared/Sync.jsm", sync);
|
||||
let sync = ChromeUtils.import("chrome://remote/content/shared/Sync.jsm");
|
||||
|
||||
for (let func of ["foo", null, true, [], {}]) {
|
||||
Assert.throws(() => sync.executeSoon(func), /TypeError/);
|
||||
|
|
|
@ -734,9 +734,10 @@ FxAccountsInternal.prototype = {
|
|||
this.observerPreloads = [
|
||||
// Sync
|
||||
() => {
|
||||
let scope = {};
|
||||
ChromeUtils.import("resource://services-sync/main.js", scope);
|
||||
return scope.Weave.Service.promiseInitialized;
|
||||
let { Weave } = ChromeUtils.import(
|
||||
"resource://services-sync/main.js"
|
||||
);
|
||||
return Weave.Service.promiseInitialized;
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -43,11 +43,9 @@ const MOCK_ACCOUNT_KEYS = {
|
|||
(function initFxAccountsTestingInfrastructure() {
|
||||
do_get_profile();
|
||||
|
||||
let ns = {};
|
||||
ChromeUtils.import(
|
||||
"resource://testing-common/services/common/logging.js",
|
||||
ns
|
||||
let { initTestLogging } = ChromeUtils.import(
|
||||
"resource://testing-common/services/common/logging.js"
|
||||
);
|
||||
|
||||
ns.initTestLogging("Trace");
|
||||
initTestLogging("Trace");
|
||||
}.call(this));
|
||||
|
|
|
@ -280,8 +280,8 @@ var configureFxAccountIdentity = function(
|
|||
|
||||
var configureIdentity = async function(identityOverrides, server) {
|
||||
let config = makeIdentityConfig(identityOverrides, server);
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://services-sync/service.js", ns);
|
||||
// Must be imported after the identity configuration is set up.
|
||||
let { Service } = ChromeUtils.import("resource://services-sync/service.js");
|
||||
|
||||
// If a server was specified, ensure FxA has a correct cluster URL available.
|
||||
if (server && !config.fxaccount.token.endpoint) {
|
||||
|
@ -293,16 +293,16 @@ var configureIdentity = async function(identityOverrides, server) {
|
|||
config.fxaccount.token.endpoint = ep;
|
||||
}
|
||||
|
||||
configureFxAccountIdentity(ns.Service.identity, config);
|
||||
configureFxAccountIdentity(Service.identity, config);
|
||||
Services.prefs.setStringPref("services.sync.username", config.username);
|
||||
// many of these tests assume all the auth stuff is setup and don't hit
|
||||
// a path which causes that auth to magically happen - so do it now.
|
||||
await ns.Service.identity._ensureValidToken();
|
||||
await Service.identity._ensureValidToken();
|
||||
|
||||
// and cheat to avoid requiring each test do an explicit login - give it
|
||||
// a cluster URL.
|
||||
if (config.fxaccount.token.endpoint) {
|
||||
ns.Service.clusterURL = config.fxaccount.token.endpoint;
|
||||
Service.clusterURL = config.fxaccount.token.endpoint;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -314,9 +314,6 @@ function syncTestLogging(level = "Trace") {
|
|||
}
|
||||
|
||||
var SyncTestingInfrastructure = async function(server, username) {
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://services-sync/service.js", ns);
|
||||
|
||||
let config = makeIdentityConfig({ username });
|
||||
await configureIdentity(config, server);
|
||||
return {
|
||||
|
|
|
@ -8,8 +8,7 @@ const { XPCOMUtils } = ChromeUtils.import(
|
|||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
|
||||
var Weave = {};
|
||||
ChromeUtils.import("resource://services-sync/constants.js", Weave);
|
||||
var Weave = ChromeUtils.import("resource://services-sync/constants.js");
|
||||
var lazies = {
|
||||
"service.js": ["Service"],
|
||||
"status.js": ["Status"],
|
||||
|
|
|
@ -69,10 +69,8 @@ XPCOMUtils.defineLazyPreferenceGetter(
|
|||
);
|
||||
|
||||
// FxAccountsCommon.js doesn't use a "namespace", so create one here.
|
||||
var fxAccountsCommon = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js",
|
||||
fxAccountsCommon
|
||||
var fxAccountsCommon = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js"
|
||||
);
|
||||
|
||||
const SCOPE_OLD_SYNC = fxAccountsCommon.SCOPE_OLD_SYNC;
|
||||
|
|
|
@ -39,8 +39,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
|
|||
Weave: "resource://services-sync/main.js",
|
||||
});
|
||||
|
||||
let constants = {};
|
||||
ChromeUtils.import("resource://services-sync/constants.js", constants);
|
||||
let constants = ChromeUtils.import("resource://services-sync/constants.js");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
this,
|
||||
|
|
|
@ -29,16 +29,9 @@ const { XPCOMUtils } = ChromeUtils.import(
|
|||
"resource://gre/modules/XPCOMUtils.jsm"
|
||||
);
|
||||
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
|
||||
|
||||
// FxAccountsCommon.js doesn't use a "namespace", so create one here.
|
||||
XPCOMUtils.defineLazyGetter(this, "FxAccountsCommon", function() {
|
||||
let FxAccountsCommon = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js",
|
||||
FxAccountsCommon
|
||||
);
|
||||
return FxAccountsCommon;
|
||||
});
|
||||
const FxAccountsCommon = ChromeUtils.import(
|
||||
"resource://gre/modules/FxAccountsCommon.js"
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyServiceGetter(
|
||||
this,
|
||||
|
|
|
@ -67,23 +67,19 @@ add_task(async function head_setup() {
|
|||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "SyncPingSchema", function() {
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://gre/modules/FileUtils.jsm", ns);
|
||||
ChromeUtils.import("resource://gre/modules/NetUtil.jsm", ns);
|
||||
let { FileUtils } = ChromeUtils.import(
|
||||
"resource://gre/modules/FileUtils.jsm"
|
||||
);
|
||||
let { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
|
||||
let stream = Cc["@mozilla.org/network/file-input-stream;1"].createInstance(
|
||||
Ci.nsIFileInputStream
|
||||
);
|
||||
let schema;
|
||||
try {
|
||||
let schemaFile = do_get_file("sync_ping_schema.json");
|
||||
stream.init(
|
||||
schemaFile,
|
||||
ns.FileUtils.MODE_RDONLY,
|
||||
ns.FileUtils.PERMS_FILE,
|
||||
0
|
||||
);
|
||||
stream.init(schemaFile, FileUtils.MODE_RDONLY, FileUtils.PERMS_FILE, 0);
|
||||
|
||||
let bytes = ns.NetUtil.readInputStream(stream, stream.available());
|
||||
let bytes = NetUtil.readInputStream(stream, stream.available());
|
||||
schema = JSON.parse(new TextDecoder().decode(bytes));
|
||||
} finally {
|
||||
stream.close();
|
||||
|
@ -96,9 +92,8 @@ XPCOMUtils.defineLazyGetter(this, "SyncPingSchema", function() {
|
|||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "SyncPingValidator", function() {
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://testing-common/ajv-6.12.6.js", ns);
|
||||
let ajv = new ns.Ajv({ async: "co*" });
|
||||
let { Ajv } = ChromeUtils.import("resource://testing-common/ajv-6.12.6.js");
|
||||
let ajv = new Ajv({ async: "co*" });
|
||||
return ajv.compile(SyncPingSchema);
|
||||
});
|
||||
|
||||
|
@ -275,15 +270,16 @@ function mockGetWindowEnumerator(url, numWindows, numTabs, indexes, moreURLs) {
|
|||
// Helper function to get the sync telemetry and add the typically used test
|
||||
// engine names to its list of allowed engines.
|
||||
function get_sync_test_telemetry() {
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://services-sync/telemetry.js", ns);
|
||||
ns.SyncTelemetry.tryRefreshDevices = function() {};
|
||||
let { SyncTelemetry } = ChromeUtils.import(
|
||||
"resource://services-sync/telemetry.js"
|
||||
);
|
||||
SyncTelemetry.tryRefreshDevices = function() {};
|
||||
let testEngines = ["rotary", "steam", "sterling", "catapult", "nineties"];
|
||||
for (let engineName of testEngines) {
|
||||
ns.SyncTelemetry.allowedEngines.add(engineName);
|
||||
SyncTelemetry.allowedEngines.add(engineName);
|
||||
}
|
||||
ns.SyncTelemetry.submissionInterval = -1;
|
||||
return ns.SyncTelemetry;
|
||||
SyncTelemetry.submissionInterval = -1;
|
||||
return SyncTelemetry;
|
||||
}
|
||||
|
||||
function assert_valid_ping(record) {
|
||||
|
@ -440,10 +436,9 @@ async function sync_engine_and_validate_telem(
|
|||
let caughtError = null;
|
||||
// Clear out status, so failures from previous syncs won't show up in the
|
||||
// telemetry ping.
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://services-sync/status.js", ns);
|
||||
ns.Status._engines = {};
|
||||
ns.Status.partial = false;
|
||||
let { Status } = ChromeUtils.import("resource://services-sync/status.js");
|
||||
Status._engines = {};
|
||||
Status.partial = false;
|
||||
// Ideally we'd clear these out like we do with engines, (probably via
|
||||
// Status.resetSync()), but this causes *numerous* tests to fail, so we just
|
||||
// assume that if no failureReason or engine failures are set, and the
|
||||
|
@ -451,8 +446,8 @@ async function sync_engine_and_validate_telem(
|
|||
// a leftover.
|
||||
// This is only an issue since we're triggering the sync of just one engine,
|
||||
// without doing any other parts of the sync.
|
||||
let initialServiceStatus = ns.Status._service;
|
||||
let initialSyncStatus = ns.Status._sync;
|
||||
let initialServiceStatus = Status._service;
|
||||
let initialSyncStatus = Status._sync;
|
||||
|
||||
let oldSubmit = telem.submit;
|
||||
let submitPromise = new Promise((resolve, reject) => {
|
||||
|
|
|
@ -18,7 +18,8 @@ XPCOMUtils.defineLazyServiceGetter(
|
|||
async function tpsStartup() {
|
||||
try {
|
||||
var { TPS } = ChromeUtils.import("resource://tps/tps.jsm");
|
||||
ChromeUtils.import("resource://tps/quit.js", TPS);
|
||||
let { goQuitApplication } = ChromeUtils.import("resource://tps/quit.js");
|
||||
TPS.goQuitApplication = goQuitApplication;
|
||||
|
||||
let testFile = Services.prefs.getStringPref("testing.tps.testFile", "");
|
||||
let testPhase = Services.prefs.getStringPref("testing.tps.testPhase", "");
|
||||
|
|
|
@ -1024,9 +1024,8 @@ var TPS = {
|
|||
"testing/modules/ajv-6.12.6.js"
|
||||
);
|
||||
let ajvURL = fileProtocolHandler.getURLSpecFromActualFile(ajvFile);
|
||||
let ns = {};
|
||||
ChromeUtils.import(ajvURL, ns);
|
||||
let ajv = new ns.Ajv({ async: "co*" });
|
||||
let { Ajv } = ChromeUtils.import(ajvURL);
|
||||
let ajv = new Ajv({ async: "co*" });
|
||||
this.pingValidator = ajv.compile(schema);
|
||||
} catch (e) {
|
||||
this.DumpError(
|
||||
|
|
|
@ -161,11 +161,7 @@ CoverageCollector.prototype._getMethodNames = function() {
|
|||
* to a json file in a specified directory.
|
||||
*/
|
||||
CoverageCollector.prototype.recordTestCoverage = function(testName) {
|
||||
let ccov_scope = {};
|
||||
const { OS } = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile.jsm",
|
||||
ccov_scope
|
||||
);
|
||||
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
||||
|
||||
dump("Collecting coverage for: " + testName + "\n");
|
||||
let rawLines = this._getLinesCovered(testName);
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
// https://github.com/joyent/node/blob/6101eb184db77d0b11eb96e48744e57ecce4b73d/test/simple/test-assert.js
|
||||
// MIT license: http://opensource.org/licenses/MIT
|
||||
|
||||
var { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm");
|
||||
|
||||
function run_test() {
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://testing-common/Assert.jsm", ns);
|
||||
let assert = new ns.Assert();
|
||||
let assert = new Assert();
|
||||
|
||||
function makeBlock(f, ...args) {
|
||||
return function() {
|
||||
|
@ -34,13 +34,13 @@ function run_test() {
|
|||
}
|
||||
|
||||
assert.ok(
|
||||
indirectInstanceOf(ns.Assert.AssertionError.prototype, Error),
|
||||
indirectInstanceOf(Assert.AssertionError.prototype, Error),
|
||||
"Assert.AssertionError instanceof Error"
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
makeBlock(assert.ok, false),
|
||||
ns.Assert.AssertionError,
|
||||
Assert.AssertionError,
|
||||
"ok(false)"
|
||||
);
|
||||
|
||||
|
@ -50,7 +50,7 @@ function run_test() {
|
|||
|
||||
assert.throws(
|
||||
makeBlock(assert.equal, true, false),
|
||||
ns.Assert.AssertionError,
|
||||
Assert.AssertionError,
|
||||
"equal"
|
||||
);
|
||||
|
||||
|
@ -66,19 +66,19 @@ function run_test() {
|
|||
|
||||
assert.throws(
|
||||
makeBlock(assert.notEqual, true, true),
|
||||
ns.Assert.AssertionError,
|
||||
Assert.AssertionError,
|
||||
"notEqual"
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
makeBlock(assert.strictEqual, 2, "2"),
|
||||
ns.Assert.AssertionError,
|
||||
Assert.AssertionError,
|
||||
"strictEqual"
|
||||
);
|
||||
|
||||
assert.throws(
|
||||
makeBlock(assert.strictEqual, null, undefined),
|
||||
ns.Assert.AssertionError,
|
||||
Assert.AssertionError,
|
||||
"strictEqual"
|
||||
);
|
||||
|
||||
|
@ -95,7 +95,7 @@ function run_test() {
|
|||
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, new Date(), new Date(2000, 3, 14)),
|
||||
ns.Assert.AssertionError,
|
||||
Assert.AssertionError,
|
||||
"deepEqual date"
|
||||
);
|
||||
|
||||
|
@ -105,40 +105,25 @@ function run_test() {
|
|||
assert.deepEqual(/a/i, /a/i);
|
||||
assert.deepEqual(/a/m, /a/m);
|
||||
assert.deepEqual(/a/gim, /a/gim);
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, /ab/, /a/),
|
||||
ns.Assert.AssertionError
|
||||
);
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, /a/g, /a/),
|
||||
ns.Assert.AssertionError
|
||||
);
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, /a/i, /a/),
|
||||
ns.Assert.AssertionError
|
||||
);
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, /a/m, /a/),
|
||||
ns.Assert.AssertionError
|
||||
);
|
||||
assert.throws(makeBlock(assert.deepEqual, /ab/, /a/), Assert.AssertionError);
|
||||
assert.throws(makeBlock(assert.deepEqual, /a/g, /a/), Assert.AssertionError);
|
||||
assert.throws(makeBlock(assert.deepEqual, /a/i, /a/), Assert.AssertionError);
|
||||
assert.throws(makeBlock(assert.deepEqual, /a/m, /a/), Assert.AssertionError);
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, /a/gim, /a/im),
|
||||
ns.Assert.AssertionError
|
||||
Assert.AssertionError
|
||||
);
|
||||
|
||||
let re1 = /a/;
|
||||
re1.lastIndex = 3;
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, re1, /a/),
|
||||
ns.Assert.AssertionError
|
||||
);
|
||||
assert.throws(makeBlock(assert.deepEqual, re1, /a/), Assert.AssertionError);
|
||||
|
||||
// 7.4
|
||||
assert.deepEqual(4, "4", "deepEqual == check");
|
||||
assert.deepEqual(true, 1, "deepEqual == check");
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, 4, "5"),
|
||||
ns.Assert.AssertionError,
|
||||
Assert.AssertionError,
|
||||
"deepEqual == check"
|
||||
);
|
||||
|
||||
|
@ -149,7 +134,7 @@ function run_test() {
|
|||
assert.deepEqual([4], ["4"]);
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, { a: 4 }, { a: 4, b: true }),
|
||||
ns.Assert.AssertionError
|
||||
Assert.AssertionError
|
||||
);
|
||||
assert.deepEqual(["a"], { 0: "a" });
|
||||
|
||||
|
@ -161,7 +146,7 @@ function run_test() {
|
|||
a2.a = "test";
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, Object.keys(a1), Object.keys(a2)),
|
||||
ns.Assert.AssertionError
|
||||
Assert.AssertionError
|
||||
);
|
||||
assert.deepEqual(a1, a2);
|
||||
|
||||
|
@ -192,34 +177,31 @@ function run_test() {
|
|||
|
||||
nameBuilder2.prototype = Object;
|
||||
nb2 = new nameBuilder2("Ryan", "Dahl");
|
||||
assert.throws(
|
||||
makeBlock(assert.deepEqual, nb1, nb2),
|
||||
ns.Assert.AssertionError
|
||||
);
|
||||
assert.throws(makeBlock(assert.deepEqual, nb1, nb2), Assert.AssertionError);
|
||||
|
||||
// String literal + object
|
||||
assert.throws(makeBlock(assert.deepEqual, "a", {}), ns.Assert.AssertionError);
|
||||
assert.throws(makeBlock(assert.deepEqual, "a", {}), Assert.AssertionError);
|
||||
|
||||
// Testing the throwing
|
||||
function thrower(errorConstructor) {
|
||||
throw new errorConstructor("test");
|
||||
}
|
||||
makeBlock(thrower, ns.Assert.AssertionError);
|
||||
makeBlock(thrower, ns.Assert.AssertionError);
|
||||
makeBlock(thrower, Assert.AssertionError);
|
||||
makeBlock(thrower, Assert.AssertionError);
|
||||
|
||||
// the basic calls work
|
||||
assert.throws(
|
||||
makeBlock(thrower, ns.Assert.AssertionError),
|
||||
ns.Assert.AssertionError,
|
||||
makeBlock(thrower, Assert.AssertionError),
|
||||
Assert.AssertionError,
|
||||
"message"
|
||||
);
|
||||
assert.throws(
|
||||
makeBlock(thrower, ns.Assert.AssertionError),
|
||||
ns.Assert.AssertionError
|
||||
makeBlock(thrower, Assert.AssertionError),
|
||||
Assert.AssertionError
|
||||
);
|
||||
assert.throws(
|
||||
makeBlock(thrower, ns.Assert.AssertionError),
|
||||
ns.Assert.AssertionError
|
||||
makeBlock(thrower, Assert.AssertionError),
|
||||
Assert.AssertionError
|
||||
);
|
||||
|
||||
// if not passing an error, catch all.
|
||||
|
@ -228,7 +210,7 @@ function run_test() {
|
|||
// when passing a type, only catch errors of the appropriate type
|
||||
let threw = false;
|
||||
try {
|
||||
assert.throws(makeBlock(thrower, TypeError), ns.Assert.AssertionError);
|
||||
assert.throws(makeBlock(thrower, TypeError), Assert.AssertionError);
|
||||
} catch (e) {
|
||||
threw = true;
|
||||
assert.ok(e instanceof TypeError, "type");
|
||||
|
@ -237,7 +219,7 @@ function run_test() {
|
|||
true,
|
||||
threw,
|
||||
"Assert.throws with an explicit error is eating extra errors",
|
||||
ns.Assert.AssertionError
|
||||
Assert.AssertionError
|
||||
);
|
||||
threw = false;
|
||||
|
||||
|
@ -364,7 +346,7 @@ function run_test() {
|
|||
|
||||
// Test robustness of reporting:
|
||||
equal(
|
||||
new ns.Assert.AssertionError({
|
||||
new Assert.AssertionError({
|
||||
actual: {
|
||||
toJSON() {
|
||||
throw new Error("bam!");
|
||||
|
@ -450,9 +432,7 @@ function run_test() {
|
|||
}
|
||||
|
||||
add_task(async function test_rejects() {
|
||||
let ns = {};
|
||||
ChromeUtils.import("resource://testing-common/Assert.jsm", ns);
|
||||
let assert = new ns.Assert();
|
||||
let assert = new Assert();
|
||||
|
||||
// A helper function to test failures.
|
||||
async function checkRejectsFails(err, expected) {
|
||||
|
|
|
@ -1143,11 +1143,6 @@ class SpecialPowersChild extends JSWindowActorChild {
|
|||
removeAutoCompletePopupEventListener(window, eventname, listener) {
|
||||
this._getAutoCompletePopup(window).removeEventListener(eventname, listener);
|
||||
}
|
||||
get formHistory() {
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/FormHistory.jsm", tmp);
|
||||
return tmp.FormHistory;
|
||||
}
|
||||
getFormFillController(window) {
|
||||
return Cc["@mozilla.org/satchel/form-fill-controller;1"].getService(
|
||||
Ci.nsIFormFillController
|
||||
|
|
|
@ -12,7 +12,6 @@ ChromeUtils.defineModuleGetter(
|
|||
"resource:///modules/AboutNewTab.jsm"
|
||||
);
|
||||
|
||||
let context = {};
|
||||
let TalosParentProfiler;
|
||||
|
||||
/**
|
||||
|
@ -216,11 +215,9 @@ async function test(window) {
|
|||
return;
|
||||
}
|
||||
|
||||
ChromeUtils.import(
|
||||
"resource://talos-powers/TalosParentProfiler.jsm",
|
||||
context
|
||||
);
|
||||
TalosParentProfiler = context.TalosParentProfiler;
|
||||
TalosParentProfiler = ChromeUtils.import(
|
||||
"resource://talos-powers/TalosParentProfiler.jsm"
|
||||
).TalosParentProfiler;
|
||||
|
||||
let testURLs = [];
|
||||
|
||||
|
|
|
@ -27,9 +27,10 @@ class FindBarChild extends JSWindowActorChild {
|
|||
this,
|
||||
"FindBarContent",
|
||||
() => {
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/FindBarContent.jsm", tmp);
|
||||
return new tmp.FindBarContent(this);
|
||||
const { FindBarContent } = ChromeUtils.import(
|
||||
"resource://gre/modules/FindBarContent.jsm"
|
||||
);
|
||||
return new FindBarContent(this);
|
||||
},
|
||||
{ inQuickFind: false, inPassThrough: false }
|
||||
);
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Scope used to relaunch the tests with |ctypes| opened in a limited scope.
|
||||
var scope = {};
|
||||
var ctypes = ctypes;
|
||||
|
||||
function run_test() {
|
||||
|
@ -8,7 +7,7 @@ function run_test() {
|
|||
|
||||
// Relaunch the test with exotic loading of ctypes.jsm
|
||||
Cu.unload("resource://gre/modules/ctypes.jsm");
|
||||
ChromeUtils.import("resource://gre/modules/ctypes.jsm", scope);
|
||||
let scope = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
|
||||
ctypes = scope.ctypes;
|
||||
main_test();
|
||||
}
|
||||
|
|
|
@ -6,10 +6,8 @@
|
|||
|
||||
var SharedAll;
|
||||
if (typeof Components != "undefined") {
|
||||
SharedAll = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
|
||||
SharedAll
|
||||
SharedAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
var { Primitives } = ChromeUtils.import(
|
||||
"resource://gre/modules/lz4_internal.js"
|
||||
|
|
|
@ -10,10 +10,8 @@ var Primitives = {};
|
|||
|
||||
var SharedAll;
|
||||
if (typeof Components != "undefined") {
|
||||
SharedAll = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
|
||||
SharedAll
|
||||
SharedAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["Primitives"];
|
||||
|
|
|
@ -22,10 +22,8 @@
|
|||
// Scheduler is exported for test-only usage.
|
||||
var EXPORTED_SYMBOLS = ["OS", "Scheduler"];
|
||||
|
||||
var SharedAll = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
|
||||
SharedAll
|
||||
var SharedAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
const { clearInterval, setInterval } = ChromeUtils.import(
|
||||
"resource://gre/modules/Timer.jsm"
|
||||
|
@ -36,16 +34,14 @@ var LOG = SharedAll.LOG.bind(SharedAll, "Controller");
|
|||
var isTypedArray = SharedAll.isTypedArray;
|
||||
|
||||
// The constructor for file errors.
|
||||
var SysAll = {};
|
||||
var SysAll;
|
||||
if (SharedAll.Constants.Win) {
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_win_allthreads.jsm",
|
||||
SysAll
|
||||
SysAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_win_allthreads.jsm"
|
||||
);
|
||||
} else if (SharedAll.Constants.libc) {
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_unix_allthreads.jsm",
|
||||
SysAll
|
||||
SysAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_unix_allthreads.jsm"
|
||||
);
|
||||
} else {
|
||||
throw new Error("I am neither under Windows nor under a Posix system");
|
||||
|
@ -53,8 +49,7 @@ if (SharedAll.Constants.Win) {
|
|||
var OSError = SysAll.Error;
|
||||
var Type = SysAll.Type;
|
||||
|
||||
var Path = {};
|
||||
ChromeUtils.import("resource://gre/modules/osfile/ospath.jsm", Path);
|
||||
var Path = ChromeUtils.import("resource://gre/modules/osfile/ospath.jsm");
|
||||
|
||||
// The library of promises.
|
||||
ChromeUtils.defineModuleGetter(
|
||||
|
|
|
@ -14,16 +14,14 @@ var { Constants } = ChromeUtils.import(
|
|||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
|
||||
var SysAll = {};
|
||||
var SysAll;
|
||||
if (Constants.Win) {
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_win_allthreads.jsm",
|
||||
SysAll
|
||||
SysAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_win_allthreads.jsm"
|
||||
);
|
||||
} else if (Constants.libc) {
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_unix_allthreads.jsm",
|
||||
SysAll
|
||||
SysAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_unix_allthreads.jsm"
|
||||
);
|
||||
} else {
|
||||
throw new Error("I am neither under Windows nor under a Posix system");
|
||||
|
|
|
@ -27,10 +27,8 @@ if (typeof Components != "undefined") {
|
|||
const { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
|
||||
this.ctypes = ctypes;
|
||||
|
||||
SharedAll = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
|
||||
SharedAll
|
||||
SharedAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
this.exports = {};
|
||||
} else if (typeof module != "undefined" && typeof require != "undefined") {
|
||||
|
|
|
@ -27,10 +27,8 @@ if (typeof Components != "undefined") {
|
|||
const { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
|
||||
this.ctypes = ctypes;
|
||||
|
||||
SharedAll = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
|
||||
SharedAll
|
||||
SharedAll = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
this.exports = {};
|
||||
} else if (typeof module != "undefined" && typeof require != "undefined") {
|
||||
|
|
|
@ -29,17 +29,15 @@ if (typeof Components == "undefined") {
|
|||
}
|
||||
module.exports = Path;
|
||||
} else {
|
||||
let Scope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm",
|
||||
Scope
|
||||
let Scope = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/osfile_shared_allthreads.jsm"
|
||||
);
|
||||
|
||||
let Path = {};
|
||||
let Path;
|
||||
if (Scope.OS.Constants.Win) {
|
||||
ChromeUtils.import("resource://gre/modules/osfile/ospath_win.jsm", Path);
|
||||
Path = ChromeUtils.import("resource://gre/modules/osfile/ospath_win.jsm");
|
||||
} else {
|
||||
ChromeUtils.import("resource://gre/modules/osfile/ospath_unix.jsm", Path);
|
||||
Path = ChromeUtils.import("resource://gre/modules/osfile/ospath_unix.jsm");
|
||||
}
|
||||
|
||||
this.EXPORTED_SYMBOLS = [];
|
||||
|
|
|
@ -8,13 +8,10 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|||
Services.prefs.setBoolPref("toolkit.osfile.test.syslib_necessary", false);
|
||||
// We don't need libc/kernel32.dll for this test
|
||||
|
||||
var ImportWin = {};
|
||||
var ImportUnix = {};
|
||||
ChromeUtils.import("resource://gre/modules/osfile/ospath_win.jsm", ImportWin);
|
||||
ChromeUtils.import("resource://gre/modules/osfile/ospath_unix.jsm", ImportUnix);
|
||||
|
||||
var Win = ImportWin;
|
||||
var Unix = ImportUnix;
|
||||
const Win = ChromeUtils.import("resource://gre/modules/osfile/ospath_win.jsm");
|
||||
const Unix = ChromeUtils.import(
|
||||
"resource://gre/modules/osfile/ospath_unix.jsm"
|
||||
);
|
||||
|
||||
function do_check_fail(f) {
|
||||
try {
|
||||
|
|
|
@ -225,9 +225,10 @@ var TabModalPrompt = class {
|
|||
// when the domWindow, for which the prompt was created, generates
|
||||
// a "pagehide" event.
|
||||
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/CommonDialog.jsm", tmp);
|
||||
this.Dialog = new tmp.CommonDialog(args, this.ui);
|
||||
let { CommonDialog } = ChromeUtils.import(
|
||||
"resource://gre/modules/CommonDialog.jsm"
|
||||
);
|
||||
this.Dialog = new CommonDialog(args, this.ui);
|
||||
this.Dialog.onLoad(null);
|
||||
|
||||
// For content prompts display the tabprompt title that shows the prompt origin when
|
||||
|
|
|
@ -11,9 +11,10 @@ var { XPCOMUtils } = ChromeUtils.import(
|
|||
var gAppInfo = null;
|
||||
|
||||
function createAppInfo(ID, name, version, platformVersion = "1.0") {
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://testing-common/AppInfo.jsm", tmp);
|
||||
gAppInfo = tmp.newAppInfo({
|
||||
let { newAppInfo } = ChromeUtils.import(
|
||||
"resource://testing-common/AppInfo.jsm"
|
||||
);
|
||||
gAppInfo = newAppInfo({
|
||||
ID,
|
||||
name,
|
||||
version,
|
||||
|
|
|
@ -401,9 +401,10 @@ var Impl = {
|
|||
// Look for app-specific timestamps
|
||||
var appTimestamps = {};
|
||||
try {
|
||||
let o = {};
|
||||
ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm", o);
|
||||
appTimestamps = o.TelemetryTimestamps.get();
|
||||
let { TelemetryTimestamps } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryTimestamps.jsm"
|
||||
);
|
||||
appTimestamps = TelemetryTimestamps.get();
|
||||
} catch (ex) {}
|
||||
|
||||
// Only submit this if the extended set is enabled.
|
||||
|
|
|
@ -17,8 +17,6 @@ const { updateAppInfo } = ChromeUtils.import(
|
|||
);
|
||||
updateAppInfo();
|
||||
|
||||
var gGlobalScope = this;
|
||||
|
||||
function getSimpleMeasurementsFromTelemetryController() {
|
||||
return TelemetrySession.getPayload().simpleMeasurements;
|
||||
}
|
||||
|
@ -43,9 +41,9 @@ add_task(async function actualTest() {
|
|||
await TelemetryController.testSetup();
|
||||
|
||||
// Test the module logic
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/TelemetryTimestamps.jsm", tmp);
|
||||
let TelemetryTimestamps = tmp.TelemetryTimestamps;
|
||||
let { TelemetryTimestamps } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryTimestamps.jsm"
|
||||
);
|
||||
let now = Date.now();
|
||||
TelemetryTimestamps.add("foo");
|
||||
Assert.ok(TelemetryTimestamps.get().foo != null); // foo was added
|
||||
|
|
|
@ -86,9 +86,10 @@ TooltipTextProvider.prototype = {
|
|||
} else if (files.length > TRUNCATED_FILE_COUNT + 1) {
|
||||
let xmoreStr = bundle.GetStringFromName("AndNMoreFiles");
|
||||
let xmoreNum = files.length - TRUNCATED_FILE_COUNT;
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/PluralForm.jsm", tmp);
|
||||
let andXMoreStr = tmp.PluralForm.get(xmoreNum, xmoreStr).replace(
|
||||
let { PluralForm } = ChromeUtils.import(
|
||||
"resource://gre/modules/PluralForm.jsm"
|
||||
);
|
||||
let andXMoreStr = PluralForm.get(xmoreNum, xmoreStr).replace(
|
||||
"#1",
|
||||
xmoreNum
|
||||
);
|
||||
|
|
|
@ -64,12 +64,10 @@ add_task(async function run_test() {
|
|||
crashReporter.appendAppNotesToCrashReport("MoreJunk");
|
||||
|
||||
// TelemetrySession setup will trigger the session annotation
|
||||
let scope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm",
|
||||
scope
|
||||
let { TelemetryController } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm"
|
||||
);
|
||||
scope.TelemetryController.testSetup();
|
||||
TelemetryController.testSetup();
|
||||
},
|
||||
function(mdump, extra) {
|
||||
Assert.equal(extra.TestKey, "TestValue");
|
||||
|
@ -122,14 +120,14 @@ add_task(async function run_test() {
|
|||
);
|
||||
|
||||
// TelemetrySession setup will trigger the session annotation
|
||||
let scope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm",
|
||||
scope
|
||||
let { TelemetryController } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm"
|
||||
);
|
||||
ChromeUtils.import("resource://gre/modules/TelemetrySend.jsm", scope);
|
||||
scope.TelemetrySend.setTestModeEnabled(true);
|
||||
scope.TelemetryController.testSetup();
|
||||
let { TelemetrySend } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetrySend.jsm"
|
||||
);
|
||||
TelemetrySend.setTestModeEnabled(true);
|
||||
TelemetryController.testSetup();
|
||||
},
|
||||
function(mdump, extra) {
|
||||
Assert.ok(
|
||||
|
@ -166,14 +164,14 @@ add_task(async function run_test() {
|
|||
);
|
||||
|
||||
// TelemetrySession setup will trigger the session annotation
|
||||
let scope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm",
|
||||
scope
|
||||
let { TelemetryController } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm"
|
||||
);
|
||||
ChromeUtils.import("resource://gre/modules/TelemetrySend.jsm", scope);
|
||||
scope.TelemetrySend.setTestModeEnabled(true);
|
||||
scope.TelemetryController.testSetup();
|
||||
let { TelemetrySend } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetrySend.jsm"
|
||||
);
|
||||
TelemetrySend.setTestModeEnabled(true);
|
||||
TelemetryController.testSetup();
|
||||
},
|
||||
function(mdump, extra) {
|
||||
Assert.ok(
|
||||
|
@ -201,14 +199,14 @@ add_task(async function run_test() {
|
|||
);
|
||||
|
||||
// TelemetrySession setup will trigger the session annotation
|
||||
let scope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm",
|
||||
scope
|
||||
let { TelemetryController } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm"
|
||||
);
|
||||
ChromeUtils.import("resource://gre/modules/TelemetrySend.jsm", scope);
|
||||
scope.TelemetrySend.setTestModeEnabled(true);
|
||||
scope.TelemetryController.testSetup();
|
||||
let { TelemetrySend } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetrySend.jsm"
|
||||
);
|
||||
TelemetrySend.setTestModeEnabled(true);
|
||||
TelemetryController.testSetup();
|
||||
},
|
||||
function(mdump, extra) {
|
||||
Assert.ok(
|
||||
|
|
|
@ -17,12 +17,10 @@ add_task(async function test_main_process_crash() {
|
|||
do_crash(
|
||||
function() {
|
||||
// TelemetrySession setup will trigger the session annotation
|
||||
let scope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm",
|
||||
scope
|
||||
let { TelemetryController } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm"
|
||||
);
|
||||
scope.TelemetryController.testSetup();
|
||||
TelemetryController.testSetup();
|
||||
crashType = CrashTestUtils.CRASH_MOZ_CRASH;
|
||||
crashReporter.annotateCrashReport("ShutdownProgress", "event-test");
|
||||
},
|
||||
|
|
|
@ -10,9 +10,10 @@ add_task(async function run_test() {
|
|||
}
|
||||
|
||||
// TelemetrySession setup will trigger the session annotation
|
||||
let scope = {};
|
||||
ChromeUtils.import("resource://gre/modules/TelemetryController.jsm", scope);
|
||||
scope.TelemetryController.testSetup();
|
||||
let { TelemetryController } = ChromeUtils.import(
|
||||
"resource://gre/modules/TelemetryController.jsm"
|
||||
);
|
||||
TelemetryController.testSetup();
|
||||
|
||||
// Try crashing with a runtime abort
|
||||
await do_content_crash(
|
||||
|
|
|
@ -16,10 +16,9 @@ let shortURL = {};
|
|||
let searchShortcuts = {};
|
||||
let didSuccessfulImport = false;
|
||||
try {
|
||||
ChromeUtils.import("resource://activity-stream/lib/ShortURL.jsm", shortURL);
|
||||
ChromeUtils.import(
|
||||
"resource://activity-stream/lib/SearchShortcuts.jsm",
|
||||
searchShortcuts
|
||||
shortURL = ChromeUtils.import("resource://activity-stream/lib/ShortURL.jsm");
|
||||
searchShortcuts = ChromeUtils.import(
|
||||
"resource://activity-stream/lib/SearchShortcuts.jsm"
|
||||
);
|
||||
didSuccessfulImport = true;
|
||||
} catch (e) {
|
||||
|
@ -58,10 +57,9 @@ ChromeUtils.defineModuleGetter(
|
|||
|
||||
let BrowserWindowTracker;
|
||||
try {
|
||||
ChromeUtils.import(
|
||||
"resource:///modules/BrowserWindowTracker.jsm",
|
||||
BrowserWindowTracker
|
||||
);
|
||||
BrowserWindowTracker = ChromeUtils.import(
|
||||
"resource:///modules/BrowserWindowTracker.jsm"
|
||||
).BrowserWindowTracker;
|
||||
} catch (e) {
|
||||
// BrowserWindowTracker is used to determine devicePixelRatio in
|
||||
// _addFavicons. We fallback to the value 2 if we can't find a window,
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
var tempScope = {};
|
||||
ChromeUtils.import("resource://gre/modules/Geometry.jsm", tempScope);
|
||||
var Point = tempScope.Point;
|
||||
var Rect = tempScope.Rect;
|
||||
const { Point, Rect } = ChromeUtils.import(
|
||||
"resource://gre/modules/Geometry.jsm"
|
||||
);
|
||||
|
||||
function test() {
|
||||
ok(Rect, "Rect class exists");
|
||||
|
|
|
@ -2,10 +2,8 @@ var InlineSpellChecker;
|
|||
var SpellCheckHelper;
|
||||
|
||||
function test() {
|
||||
let tempScope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/InlineSpellChecker.jsm",
|
||||
tempScope
|
||||
let tempScope = ChromeUtils.import(
|
||||
"resource://gre/modules/InlineSpellChecker.jsm"
|
||||
);
|
||||
InlineSpellChecker = tempScope.InlineSpellChecker;
|
||||
SpellCheckHelper = tempScope.SpellCheckHelper;
|
||||
|
|
|
@ -65,9 +65,10 @@ function run_test() {
|
|||
// In xpcshell tests, the "@mozilla.org/xre/app-info;1" component implements
|
||||
// only the nsIXULRuntime interface, but not nsIXULAppInfo. To test the
|
||||
// service getter for the latter interface, load mock app-info.
|
||||
let tmp = {};
|
||||
ChromeUtils.import("resource://testing-common/AppInfo.jsm", tmp);
|
||||
tmp.updateAppInfo();
|
||||
let { updateAppInfo } = ChromeUtils.import(
|
||||
"resource://testing-common/AppInfo.jsm"
|
||||
);
|
||||
updateAppInfo();
|
||||
|
||||
// We need to reload the module to update the lazy getter.
|
||||
Cu.unload("resource://gre/modules/Services.jsm");
|
||||
|
|
|
@ -5,8 +5,7 @@
|
|||
|
||||
// Tests exports from Timer.jsm
|
||||
|
||||
var imported = {};
|
||||
ChromeUtils.import("resource://gre/modules/Timer.jsm", imported);
|
||||
var imported = ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
||||
|
||||
add_task(async function test_setTimeout() {
|
||||
let timeout1 = imported.setTimeout(
|
||||
|
|
|
@ -32,10 +32,12 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
|
|||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AMTelemetry: "resource://gre/modules/AddonManager.jsm",
|
||||
ExtensionTestCommon: "resource://testing-common/ExtensionTestCommon.jsm",
|
||||
getAppInfo: "resource://testing-common/AppInfo.jsm",
|
||||
Management: "resource://gre/modules/Extension.jsm",
|
||||
ExtensionAddonObserver: "resource://gre/modules/Extension.jsm",
|
||||
FileTestUtils: "resource://testing-common/FileTestUtils.jsm",
|
||||
MockRegistrar: "resource://testing-common/MockRegistrar.jsm",
|
||||
updateAppInfo: "resource://testing-common/AppInfo.jsm",
|
||||
XPCShellContentUtils: "resource://testing-common/XPCShellContentUtils.jsm",
|
||||
});
|
||||
|
||||
|
@ -46,12 +48,6 @@ XPCOMUtils.defineLazyServiceGetters(this, {
|
|||
],
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "AppInfo", () => {
|
||||
let AppInfo = {};
|
||||
ChromeUtils.import("resource://testing-common/AppInfo.jsm", AppInfo);
|
||||
return AppInfo;
|
||||
});
|
||||
|
||||
const PREF_DISABLE_SECURITY =
|
||||
"security.turn_off_all_security_so_that_" +
|
||||
"viruses_can_take_over_this_computer";
|
||||
|
@ -490,14 +486,14 @@ var AddonTestUtils = {
|
|||
},
|
||||
|
||||
createAppInfo(ID, name, version, platformVersion = "1.0") {
|
||||
AppInfo.updateAppInfo({
|
||||
updateAppInfo({
|
||||
ID,
|
||||
name,
|
||||
version,
|
||||
platformVersion,
|
||||
crashReporter: true,
|
||||
});
|
||||
this.appInfo = AppInfo.getAppInfo();
|
||||
this.appInfo = getAppInfo();
|
||||
},
|
||||
|
||||
getManifestURI(file) {
|
||||
|
|
|
@ -2,12 +2,9 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var tempScope = {};
|
||||
ChromeUtils.import(
|
||||
"resource://gre/modules/addons/AddonUpdateChecker.jsm",
|
||||
tempScope
|
||||
let { AddonUpdateChecker } = ChromeUtils.import(
|
||||
"resource://gre/modules/addons/AddonUpdateChecker.jsm"
|
||||
);
|
||||
var AddonUpdateChecker = tempScope.AddonUpdateChecker;
|
||||
|
||||
const updatejson = RELATIVE_DIR + "browser_updatessl.json";
|
||||
const redirect = RELATIVE_DIR + "redirect.sjs?";
|
||||
|
|
|
@ -10,12 +10,10 @@ const { TelemetryTestUtils } = ChromeUtils.import(
|
|||
"resource://testing-common/TelemetryTestUtils.jsm"
|
||||
);
|
||||
|
||||
var tmp = {};
|
||||
ChromeUtils.import("resource://gre/modules/AddonManager.jsm", tmp);
|
||||
ChromeUtils.import("resource://gre/modules/Log.jsm", tmp);
|
||||
var AddonManager = tmp.AddonManager;
|
||||
var AddonManagerPrivate = tmp.AddonManagerPrivate;
|
||||
var Log = tmp.Log;
|
||||
let { AddonManager, AddonManagerPrivate } = ChromeUtils.import(
|
||||
"resource://gre/modules/AddonManager.jsm"
|
||||
);
|
||||
let { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
|
||||
|
||||
var pathParts = gTestPath.split("/");
|
||||
// Drop the test filename
|
||||
|
|
|
@ -4,10 +4,8 @@
|
|||
|
||||
// restartManager() mucks with XPIProvider.jsm importing, so we hack around.
|
||||
this.__defineGetter__("XPIProvider", function() {
|
||||
let scope = {};
|
||||
return ChromeUtils.import(
|
||||
"resource://gre/modules/addons/XPIProvider.jsm",
|
||||
scope
|
||||
"resource://gre/modules/addons/XPIProvider.jsm"
|
||||
).XPIProvider;
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче