Bug 1799314 - Convert consumers of testing modules to import ES modules direct (miscellaneous). r=mossop

Differential Revision: https://phabricator.services.mozilla.com/D161917
This commit is contained in:
Mark Banner 2022-11-17 12:00:32 +00:00
parent e37f1bd043
commit ec76a72706
24 changed files with 43 additions and 47 deletions

View File

@ -1,9 +1,9 @@
"use strict";
const { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"
const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"
);
const { XPCShellContentUtils } = ChromeUtils.import(
"resource://testing-common/XPCShellContentUtils.jsm"
const { XPCShellContentUtils } = ChromeUtils.importESModule(
"resource://testing-common/XPCShellContentUtils.sys.mjs"
);
const { ExtensionTestUtils } = ChromeUtils.import(
"resource://testing-common/ExtensionXPCShellUtils.jsm"

View File

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

View File

@ -7,8 +7,8 @@ var MANIFESTS = [do_get_file("data/test_bug380398.manifest")];
registerManifests(MANIFESTS);
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
updateAppInfo({
name: "XPCShell",

View File

@ -7,8 +7,8 @@ var MANIFESTS = [do_get_file("data/test_bug397073.manifest")];
registerManifests(MANIFESTS);
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
updateAppInfo({
name: "XPCShell",

View File

@ -7,8 +7,8 @@ var MANIFESTS = [do_get_file("data/test_bug399707.manifest")];
registerManifests(MANIFESTS);
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
updateAppInfo({
name: "XPCShell",

View File

@ -7,8 +7,8 @@ var MANIFESTS = [do_get_file("data/test_bug401153.manifest")];
registerManifests(MANIFESTS);
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
updateAppInfo({
name: "XPCShell",

View File

@ -10,8 +10,8 @@ registerManifests(manifests);
function run_test() {
const uuidGenerator = Services.uuid;
let { newAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
let { newAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
let XULAppInfo = newAppInfo({
name: "XPCShell",

View File

@ -55,8 +55,8 @@ var testProtocols = [
},
];
function run_test() {
const { newAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { newAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
let XULAppInfo = newAppInfo({
name: "XPCShell",

View File

@ -104,8 +104,8 @@ function maybeOnSpellCheck(editableElement, callback) {
* started.
*/
function onSpellCheck(editableElement, callback) {
const { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"
const { TestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TestUtils.sys.mjs"
);
let editor = editableElement.editor;

View File

@ -6,8 +6,8 @@
const { CustomizableUITestUtils } = ChromeUtils.import(
"resource://testing-common/CustomizableUITestUtils.jsm"
);
const { ContentTaskUtils } = ChromeUtils.import(
"resource://testing-common/ContentTaskUtils.jsm"
const { ContentTaskUtils } = ChromeUtils.importESModule(
"resource://testing-common/ContentTaskUtils.sys.mjs"
);
const gCUITestUtils = new CustomizableUITestUtils(window);
const gDOMWindowUtils = EventUtils._getDOMWindowUtils(window);

View File

@ -1,8 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
function run_test() {

View File

@ -1,8 +1,8 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
function run_test() {

View File

@ -5,8 +5,8 @@
/* Turning off this rule to allow control flow operations in finally block
* http://eslint.org/docs/rules/no-unsafe-finally */
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"
const { updateAppInfo } = ChromeUtils.importESModule(
"resource://testing-common/AppInfo.sys.mjs"
);
function ensureRemove(file) {

View File

@ -145,7 +145,7 @@ support-files = file_dynamic_toolbar_max_height.html
[test_emulateMedium.html]
[test_emulate_color_scheme.html]
[test_event_target_radius.html]
skip-if = xorigin # JavaScript error: resource://specialpowers/SpecialPowersChild.jsm, line 73: SecurityError: Permission denied to access property "windowUtils" on cross-origin object
skip-if = xorigin # JavaScript error: resource://specialpowers/SpecialPowersChild.sys.mjs, line 73: SecurityError: Permission denied to access property "windowUtils" on cross-origin object
[test_frame_reconstruction_for_column_span.html]
[test_frame_reconstruction_for_pseudo_elements.html]
[test_frame_reconstruction_for_svg_transforms.html]

View File

@ -9,8 +9,8 @@
// process, and changes after that point are stored as entries in a dynamic hash
// table, on top of the snapshot.
const { XPCShellContentUtils } = ChromeUtils.import(
"resource://testing-common/XPCShellContentUtils.jsm"
const { XPCShellContentUtils } = ChromeUtils.importESModule(
"resource://testing-common/XPCShellContentUtils.sys.mjs"
);
XPCShellContentUtils.init(this);

View File

@ -25,8 +25,8 @@ const PREF1_VALUE = false;
const PREF2_NAME = "dom.mutation-events.cssom.disabled";
const PREF2_VALUE = true;
const { XPCShellContentUtils } = ChromeUtils.import(
"resource://testing-common/XPCShellContentUtils.jsm"
const { XPCShellContentUtils } = ChromeUtils.importESModule(
"resource://testing-common/XPCShellContentUtils.sys.mjs"
);
XPCShellContentUtils.init(this);

View File

@ -4,8 +4,8 @@
// This file tests the Vacuum Manager.
const { MockRegistrar } = ChromeUtils.import(
"resource://testing-common/MockRegistrar.jsm"
const { MockRegistrar } = ChromeUtils.importESModule(
"resource://testing-common/MockRegistrar.sys.mjs"
);
/**

View File

@ -14,7 +14,7 @@ var util = require("util");
module.exports = {
globals: util._extend(
{
// testing/specialpowers/content/SpecialPowersParent.jsm
// testing/specialpowers/content/SpecialPowersParent.sys.mjs
// SPLoadChromeScript block
createWindowlessBrowser: false,

View File

@ -18,7 +18,7 @@ module.exports = {
Cu: false,
Services: false,
// testing/specialpowers/content/SpecialPowersSandbox.jsm
// testing/specialpowers/content/SpecialPowersSandbox.sys.mjs
// SANDBOX_GLOBALS
Blob: false,

View File

@ -28,7 +28,7 @@ const extraGlobals = [
"simulateNoScriptActivity",
"registerXPCTestComponents",
// Assert.jsm globals.
// Assert.sys.mjs globals.
"setReporter",
"report",
"ok",

View File

@ -43,7 +43,7 @@ module.exports = {
helpers.addVarToScope(name, context.getScope(), value);
}
let globals = [
// testing/specialpowers/content/SpecialPowersChild.jsm
// testing/specialpowers/content/SpecialPowersChild.sys.mjs
// SpecialPowersChild._spawnTask
"SpecialPowers",
"ContentTaskUtils",
@ -61,7 +61,7 @@ module.exports = {
helpers.addVarToScope(name, context.getScope(), value);
}
let globals = [
// testing/specialpowers/content/SpecialPowersParent.jsm
// testing/specialpowers/content/SpecialPowersParent.sys.mjs
// SpecialPowersParent._spawnChrome
"windowGlobalParent",
"browsingContext",

View File

@ -5,10 +5,6 @@ Services.scriptloader.loadSubScript(
this
);
const { BrowserTestUtils } = ChromeUtils.import(
"resource://testing-common/BrowserTestUtils.jsm"
);
const BASE_URL = "http://example.com/browser/tools/profiler/tests/browser/";
const BASE_URL_HTTPS =
"https://example.com/browser/tools/profiler/tests/browser/";

View File

@ -373,7 +373,7 @@ function escapeStringRegexp(string) {
/** ------ Assertions helper ------ */
/**
* This assert helper function makes it easy to check a lot of properties in an
* object. We augment Assert.jsm to make it easier to use.
* object. We augment Assert.sys.mjs to make it easier to use.
*/
Object.assign(Assert, {
/*

View File

@ -3,8 +3,8 @@
"use strict";
const { ContentTaskUtils } = ChromeUtils.import(
"resource://testing-common/ContentTaskUtils.jsm"
const { ContentTaskUtils } = ChromeUtils.importESModule(
"resource://testing-common/ContentTaskUtils.sys.mjs"
);
const gDOMWindowUtils = EventUtils._getDOMWindowUtils(window);