Skip to content

Commit

Permalink
Bug 1866720 - Clean up more imports to import ES modules directly. r=…
Browse files Browse the repository at this point in the history
…arai,extension-reviewers,devtools-reviewers,sync-reviewers,sessionstore-reviewers,dao,robwu

Differential Revision: https://phabricator.services.mozilla.com/D194723
  • Loading branch information
Standard8 committed Nov 29, 2023
1 parent fc1d7f6 commit 4ecff8f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
const { TelemetryTestUtils } = ChromeUtils.import(
"resource://testing-common/TelemetryTestUtils.jsm"
const { TelemetryTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/TelemetryTestUtils.sys.mjs"
);
const TEST_URLS = [
"http://mochi.test:8888/browser/",
Expand Down
8 changes: 3 additions & 5 deletions devtools/client/jsonview/converter-child.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
"use strict";

const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"NetUtil",
"resource://gre/modules/NetUtil.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
NetUtil: "resource://gre/modules/NetUtil.sys.mjs",
});

const {
getTheme,
Expand Down
2 changes: 1 addition & 1 deletion devtools/docs/contributor/frontend/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ This is best shown via an example:
"use strict";

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

const URL = "data:text/html;charset=utf8,browser_toolbox_telemetry_close.js";
const { RIGHT, BOTTOM } = Toolbox.HostType;
Expand Down
25 changes: 14 additions & 11 deletions services/sync/modules/service.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -67,30 +67,33 @@ const fxAccounts = getFxAccountsSingleton();

function getEngineModules() {
let result = {
Addons: { module: "addons.js", symbol: "AddonsEngine" },
Password: { module: "passwords.js", symbol: "PasswordEngine" },
Prefs: { module: "prefs.js", symbol: "PrefsEngine" },
Addons: { module: "addons.sys.mjs", symbol: "AddonsEngine" },
Password: { module: "passwords.sys.mjs", symbol: "PasswordEngine" },
Prefs: { module: "prefs.sys.mjs", symbol: "PrefsEngine" },
};
if (AppConstants.MOZ_APP_NAME != "thunderbird") {
result.Bookmarks = { module: "bookmarks.js", symbol: "BookmarksEngine" };
result.Form = { module: "forms.js", symbol: "FormEngine" };
result.History = { module: "history.js", symbol: "HistoryEngine" };
result.Tab = { module: "tabs.js", symbol: "TabEngine" };
result.Bookmarks = {
module: "bookmarks.sys.mjs",
symbol: "BookmarksEngine",
};
result.Form = { module: "forms.sys.mjs", symbol: "FormEngine" };
result.History = { module: "history.sys.mjs", symbol: "HistoryEngine" };
result.Tab = { module: "tabs.sys.mjs", symbol: "TabEngine" };
}
if (Svc.PrefBranch.getBoolPref("engine.addresses.available", false)) {
result.Addresses = {
module: "resource://autofill/FormAutofillSync.jsm",
module: "resource://autofill/FormAutofillSync.sys.mjs",
symbol: "AddressesEngine",
};
}
if (Svc.PrefBranch.getBoolPref("engine.creditcards.available", false)) {
result.CreditCards = {
module: "resource://autofill/FormAutofillSync.jsm",
module: "resource://autofill/FormAutofillSync.sys.mjs",
symbol: "CreditCardsEngine",
};
}
result["Extension-Storage"] = {
module: "extension-storage.js",
module: "extension-storage.sys.mjs",
controllingPref: "webextensions.storage.sync.kinto",
whenTrue: "ExtensionStorageEngineKinto",
whenFalse: "ExtensionStorageEngineBridge",
Expand Down Expand Up @@ -455,7 +458,7 @@ Sync11Service.prototype = {
modInfo.module = "resource://services-sync/engines/" + modInfo.module;
}
try {
let ns = ChromeUtils.import(modInfo.module);
let ns = ChromeUtils.importESModule(modInfo.module);
if (modInfo.symbol) {
let symbol = modInfo.symbol;
if (!(symbol in ns)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

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

XPCShellContentUtils.init(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ Services.obs.notifyObservers(
// NOTE: this helper class does also depends from the two jsm files where the
// Parent and Child TestWorkerWatcher actor is defined:
//
// - data/TestWorkerWatcherParent.jsm
// - data/TestWorkerWatcherChild.jsm
// - data/TestWorkerWatcherParent.sys.mjs
// - data/TestWorkerWatcherChild.sys.mjs
class TestWorkerWatcher extends ExtensionCommon.EventEmitter {
JS_ACTOR_NAME = "TestWorkerWatcher";

Expand Down Expand Up @@ -113,10 +113,10 @@ class TestWorkerWatcher extends ExtensionCommon.EventEmitter {
const { JS_ACTOR_NAME } = this;
ChromeUtils.registerProcessActor(JS_ACTOR_NAME, {
parent: {
moduleURI: `resource://testing-common/${JS_ACTOR_NAME}Parent.jsm`,
esModuleURI: `resource://testing-common/${JS_ACTOR_NAME}Parent.sys.mjs`,
},
child: {
moduleURI: `resource://testing-common/${JS_ACTOR_NAME}Child.jsm`,
esModuleURI: `resource://testing-common/${JS_ACTOR_NAME}Child.sys.mjs`,
},
});
}
Expand Down

0 comments on commit 4ecff8f

Please sign in to comment.