Bug 1799314 - Convert consumers of testing modules to import ES modules direct (services/). r=markh

Differential Revision: https://phabricator.services.mozilla.com/D161911
This commit is contained in:
Mark Banner 2022-11-17 12:00:29 +00:00
parent 82a9bfdbe8
commit bcbe5bc30d
10 changed files with 20 additions and 18 deletions

View file

@ -9,8 +9,8 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs" "resource://gre/modules/XPCOMUtils.sys.mjs"
); );
const { updateAppInfo } = ChromeUtils.import( const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.jsm" "resource://testing-common/AppInfo.sys.mjs"
); );
updateAppInfo({ updateAppInfo({
name: "XPCShell", name: "XPCShell",

View file

@ -36,8 +36,8 @@ var {
var { getTestLogger, initTestLogging } = ChromeUtils.import( var { getTestLogger, initTestLogging } = ChromeUtils.import(
"resource://testing-common/services/common/logging.js" "resource://testing-common/services/common/logging.js"
); );
var { MockRegistrar } = ChromeUtils.import( var { MockRegistrar } = ChromeUtils.importESModule(
"resource://testing-common/MockRegistrar.jsm" "resource://testing-common/MockRegistrar.sys.mjs"
); );
var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm"); var { NetUtil } = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");

View file

@ -19,8 +19,8 @@ try {
OS = "Linux"; OS = "Linux";
} }
const { updateAppInfo } = ChromeUtils.import( const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.jsm" "resource://testing-common/AppInfo.sys.mjs"
); );
updateAppInfo({ updateAppInfo({
name: "XPCShell", name: "XPCShell",

View file

@ -1,7 +1,7 @@
/* import-globals-from ../../../common/tests/unit/head_helpers.js */ /* import-globals-from ../../../common/tests/unit/head_helpers.js */
const { TestUtils } = ChromeUtils.import( const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.jsm" "resource://testing-common/TestUtils.sys.mjs"
); );
const { Utils } = ChromeUtils.import("resource://services-settings/Utils.jsm"); const { Utils } = ChromeUtils.import("resource://services-settings/Utils.jsm");

View file

@ -3,8 +3,8 @@
const { AppConstants } = ChromeUtils.importESModule( const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs" "resource://gre/modules/AppConstants.sys.mjs"
); );
const { TestUtils } = ChromeUtils.import( const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.jsm" "resource://testing-common/TestUtils.sys.mjs"
); );
const { RemoteSettingsWorker } = ChromeUtils.import( const { RemoteSettingsWorker } = ChromeUtils.import(

View file

@ -3,8 +3,8 @@ http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict"; "use strict";
const { TestUtils } = ChromeUtils.import( const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.jsm" "resource://testing-common/TestUtils.sys.mjs"
); );
const { Database } = ChromeUtils.import( const { Database } = ChromeUtils.import(

View file

@ -26,7 +26,9 @@ const { CommonUtils } = ChromeUtils.import(
const { CryptoUtils } = ChromeUtils.import( const { CryptoUtils } = ChromeUtils.import(
"resource://services-crypto/utils.js" "resource://services-crypto/utils.js"
); );
const { Assert } = ChromeUtils.import("resource://testing-common/Assert.jsm"); const { Assert } = ChromeUtils.importESModule(
"resource://testing-common/Assert.sys.mjs"
);
const { initTestLogging } = ChromeUtils.import( const { initTestLogging } = ChromeUtils.import(
"resource://testing-common/services/common/logging.js" "resource://testing-common/services/common/logging.js"
); );

View file

@ -34,8 +34,8 @@ function getOS() {
} }
} }
const { updateAppInfo } = ChromeUtils.import( const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.jsm" "resource://testing-common/AppInfo.sys.mjs"
); );
updateAppInfo({ updateAppInfo({
name: "XPCShell", name: "XPCShell",

View file

@ -7,8 +7,8 @@ var Cm = Components.manager;
// Shared logging for all HTTP server functions. // Shared logging for all HTTP server functions.
var { Log } = ChromeUtils.importESModule("resource://gre/modules/Log.sys.mjs"); var { Log } = ChromeUtils.importESModule("resource://gre/modules/Log.sys.mjs");
var { CommonUtils } = ChromeUtils.import("resource://services-common/utils.js"); var { CommonUtils } = ChromeUtils.import("resource://services-common/utils.js");
var { TestUtils } = ChromeUtils.import( var { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.jsm" "resource://testing-common/TestUtils.sys.mjs"
); );
var { var {
AccountState, AccountState,

View file

@ -13,7 +13,7 @@ const { Weave } = ChromeUtils.import("resource://services-sync/main.js");
const { Logger } = ChromeUtils.import("resource://tps/logger.jsm"); const { Logger } = ChromeUtils.import("resource://tps/logger.jsm");
// Unfortunately, due to where TPS is run, we can't directly reuse the logic from // Unfortunately, due to where TPS is run, we can't directly reuse the logic from
// BrowserTestUtils.jsm. Moreover, we can't resolve the URI it loads the content // BrowserTestUtils.sys.mjs. Moreover, we can't resolve the URI it loads the content
// frame script from ("chrome://mochikit/content/tests/BrowserTestUtils/content-utils.js"), // frame script from ("chrome://mochikit/content/tests/BrowserTestUtils/content-utils.js"),
// hence the hackiness here and in BrowserTabs.Add. // hence the hackiness here and in BrowserTabs.Add.
Services.mm.loadFrameScript( Services.mm.loadFrameScript(