Skip to content

Commit 4ecff8f

Browse files
committed
Bug 1866720 - Clean up more imports to import ES modules directly. r=arai,extension-reviewers,devtools-reviewers,sync-reviewers,sessionstore-reviewers,dao,robwu
Differential Revision: https://phabricator.services.mozilla.com/D194723
1 parent fc1d7f6 commit 4ecff8f

File tree

6 files changed

+26
-25
lines changed

6 files changed

+26
-25
lines changed

browser/components/sessionstore/test/browser_closed_tabs_closed_windows.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* This Source Code Form is subject to the terms of the Mozilla Public
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4-
const { TelemetryTestUtils } = ChromeUtils.import(
5-
"resource://testing-common/TelemetryTestUtils.jsm"
4+
const { TelemetryTestUtils } = ChromeUtils.importESModule(
5+
"resource://testing-common/TelemetryTestUtils.sys.mjs"
66
);
77
const TEST_URLS = [
88
"http://mochi.test:8888/browser/",

devtools/client/jsonview/converter-child.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
"use strict";
66

77
const lazy = {};
8-
ChromeUtils.defineModuleGetter(
9-
lazy,
10-
"NetUtil",
11-
"resource://gre/modules/NetUtil.jsm"
12-
);
8+
ChromeUtils.defineESModuleGetters(lazy, {
9+
NetUtil: "resource://gre/modules/NetUtil.sys.mjs",
10+
});
1311

1412
const {
1513
getTheme,

devtools/docs/contributor/frontend/telemetry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ This is best shown via an example:
340340
"use strict";
341341

342342
const { Toolbox } = require("devtools/client/framework/toolbox");
343-
const { TelemetryTestUtils } = ChromeUtils.import("resource://testing-common/TelemetryTestUtils.jsm");
343+
const { TelemetryTestUtils } = ChromeUtils.importESModule("resource://testing-common/TelemetryTestUtils.sys.mjs");
344344

345345
const URL = "data:text/html;charset=utf8,browser_toolbox_telemetry_close.js";
346346
const { RIGHT, BOTTOM } = Toolbox.HostType;

services/sync/modules/service.sys.mjs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,30 +67,33 @@ const fxAccounts = getFxAccountsSingleton();
6767

6868
function getEngineModules() {
6969
let result = {
70-
Addons: { module: "addons.js", symbol: "AddonsEngine" },
71-
Password: { module: "passwords.js", symbol: "PasswordEngine" },
72-
Prefs: { module: "prefs.js", symbol: "PrefsEngine" },
70+
Addons: { module: "addons.sys.mjs", symbol: "AddonsEngine" },
71+
Password: { module: "passwords.sys.mjs", symbol: "PasswordEngine" },
72+
Prefs: { module: "prefs.sys.mjs", symbol: "PrefsEngine" },
7373
};
7474
if (AppConstants.MOZ_APP_NAME != "thunderbird") {
75-
result.Bookmarks = { module: "bookmarks.js", symbol: "BookmarksEngine" };
76-
result.Form = { module: "forms.js", symbol: "FormEngine" };
77-
result.History = { module: "history.js", symbol: "HistoryEngine" };
78-
result.Tab = { module: "tabs.js", symbol: "TabEngine" };
75+
result.Bookmarks = {
76+
module: "bookmarks.sys.mjs",
77+
symbol: "BookmarksEngine",
78+
};
79+
result.Form = { module: "forms.sys.mjs", symbol: "FormEngine" };
80+
result.History = { module: "history.sys.mjs", symbol: "HistoryEngine" };
81+
result.Tab = { module: "tabs.sys.mjs", symbol: "TabEngine" };
7982
}
8083
if (Svc.PrefBranch.getBoolPref("engine.addresses.available", false)) {
8184
result.Addresses = {
82-
module: "resource://autofill/FormAutofillSync.jsm",
85+
module: "resource://autofill/FormAutofillSync.sys.mjs",
8386
symbol: "AddressesEngine",
8487
};
8588
}
8689
if (Svc.PrefBranch.getBoolPref("engine.creditcards.available", false)) {
8790
result.CreditCards = {
88-
module: "resource://autofill/FormAutofillSync.jsm",
91+
module: "resource://autofill/FormAutofillSync.sys.mjs",
8992
symbol: "CreditCardsEngine",
9093
};
9194
}
9295
result["Extension-Storage"] = {
93-
module: "extension-storage.js",
96+
module: "extension-storage.sys.mjs",
9497
controllingPref: "webextensions.storage.sync.kinto",
9598
whenTrue: "ExtensionStorageEngineKinto",
9699
whenFalse: "ExtensionStorageEngineBridge",
@@ -455,7 +458,7 @@ Sync11Service.prototype = {
455458
modInfo.module = "resource://services-sync/engines/" + modInfo.module;
456459
}
457460
try {
458-
let ns = ChromeUtils.import(modInfo.module);
461+
let ns = ChromeUtils.importESModule(modInfo.module);
459462
if (modInfo.symbol) {
460463
let symbol = modInfo.symbol;
461464
if (!(symbol in ns)) {

testing/mochitest/tests/Harness_sanity/test_SpecialPowersSpawn.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22

3-
const { XPCShellContentUtils } = ChromeUtils.import(
4-
"resource://testing-common/XPCShellContentUtils.jsm"
3+
const { XPCShellContentUtils } = ChromeUtils.importESModule(
4+
"resource://testing-common/XPCShellContentUtils.sys.mjs"
55
);
66

77
XPCShellContentUtils.init(this);

toolkit/components/extensions/test/xpcshell/head_service_worker.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ Services.obs.notifyObservers(
2727
// NOTE: this helper class does also depends from the two jsm files where the
2828
// Parent and Child TestWorkerWatcher actor is defined:
2929
//
30-
// - data/TestWorkerWatcherParent.jsm
31-
// - data/TestWorkerWatcherChild.jsm
30+
// - data/TestWorkerWatcherParent.sys.mjs
31+
// - data/TestWorkerWatcherChild.sys.mjs
3232
class TestWorkerWatcher extends ExtensionCommon.EventEmitter {
3333
JS_ACTOR_NAME = "TestWorkerWatcher";
3434

@@ -113,10 +113,10 @@ class TestWorkerWatcher extends ExtensionCommon.EventEmitter {
113113
const { JS_ACTOR_NAME } = this;
114114
ChromeUtils.registerProcessActor(JS_ACTOR_NAME, {
115115
parent: {
116-
moduleURI: `resource://testing-common/${JS_ACTOR_NAME}Parent.jsm`,
116+
esModuleURI: `resource://testing-common/${JS_ACTOR_NAME}Parent.sys.mjs`,
117117
},
118118
child: {
119-
moduleURI: `resource://testing-common/${JS_ACTOR_NAME}Child.jsm`,
119+
esModuleURI: `resource://testing-common/${JS_ACTOR_NAME}Child.sys.mjs`,
120120
},
121121
});
122122
}

0 commit comments

Comments
 (0)