Bug 1790758 - Convert Region.jsm and IgnoreLists.jsm JSM modules to ESMs r=Standard8,preferences-reviewers,credential-management-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D157337
This commit is contained in:
Jonathan Sudiaman 2022-09-20 12:21:45 +00:00
Родитель 90bc1261e7
Коммит c27b002b63
35 изменённых файлов: 93 добавлений и 75 удалений

Просмотреть файл

@ -11,6 +11,10 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
FXA_PWDMGR_HOST: "resource://gre/modules/FxAccountsCommon.js",
@ -19,7 +23,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
LoginBreaches: "resource:///modules/LoginBreaches.jsm",
LoginHelper: "resource://gre/modules/LoginHelper.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
Region: "resource://gre/modules/Region.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => {

Просмотреть файл

@ -21,9 +21,12 @@ const { RemoteSettings } = ChromeUtils.import(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Preferences: "resource://gre/modules/Preferences.jsm",
Region: "resource://gre/modules/Region.jsm",
});
const kGlobalPrefBranch = "doh-rollout";

Просмотреть файл

@ -1,12 +1,15 @@
"use strict";
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
ASRouter: "resource://activity-stream/lib/ASRouter.jsm",
DoHController: "resource:///modules/DoHController.jsm",
DoHConfigController: "resource:///modules/DoHConfig.jsm",
DoHTestUtils: "resource://testing-common/DoHTestUtils.jsm",
Preferences: "resource://gre/modules/Preferences.jsm",
Region: "resource://gre/modules/Region.jsm",
RegionTestUtils: "resource://testing-common/RegionTestUtils.jsm",
RemoteSettings: "resource://services-settings/remote-settings.js",
});

Просмотреть файл

@ -12,6 +12,10 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
BrowserUtils: "resource://gre/modules/BrowserUtils.jsm",
@ -25,7 +29,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
AboutWelcomeDefaults:
"resource://activity-stream/aboutwelcome/lib/AboutWelcomeDefaults.jsm",
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
Region: "resource://gre/modules/Region.jsm",
ShellService: "resource:///modules/ShellService.jsm",
LangPackMatcher: "resource://gre/modules/LangPackMatcher.jsm",
});

Просмотреть файл

@ -21,6 +21,10 @@ const { ShellService } = ChromeUtils.import(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
ASRouterPreferences: "resource://activity-stream/lib/ASRouterPreferences.jsm",
AddonManager: "resource://gre/modules/AddonManager.jsm",
@ -29,7 +33,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
TelemetryEnvironment: "resource://gre/modules/TelemetryEnvironment.jsm",
AttributionCode: "resource:///modules/AttributionCode.jsm",
TargetingContext: "resource://messaging-system/targeting/Targeting.jsm",
Region: "resource://gre/modules/Region.jsm",
TelemetrySession: "resource://gre/modules/TelemetrySession.jsm",
HomePage: "resource:///modules/HomePage.jsm",
AboutNewTab: "resource:///modules/AboutNewTab.jsm",

Просмотреть файл

@ -15,11 +15,9 @@ ChromeUtils.defineModuleGetter(
"resource://activity-stream/lib/DefaultSites.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"Region",
"resource://gre/modules/Region.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
// NB: Eagerly load modules that will be loaded/constructed/initialized in the
// common case to avoid the overhead of wrapping and detecting lazy loading.

Просмотреть файл

@ -25,11 +25,9 @@ const { setTimeout, clearTimeout } = ChromeUtils.import(
const { actionTypes: at, actionCreators: ac } = ChromeUtils.import(
"resource://activity-stream/common/Actions.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"Region",
"resource://gre/modules/Region.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
ChromeUtils.defineModuleGetter(
lazy,
"PersistentCache",

Просмотреть файл

@ -18,10 +18,13 @@ const { AppConstants } = ChromeUtils.import(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
Region: "resource://gre/modules/Region.jsm",
});
class PrefsFeed {

Просмотреть файл

@ -67,11 +67,9 @@ ChromeUtils.defineModuleGetter(
"RemoteSettings",
"resource://services-settings/remote-settings.js"
);
ChromeUtils.defineModuleGetter(
lazy,
"Region",
"resource://gre/modules/Region.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
const { Logger } = ChromeUtils.import(

Просмотреть файл

@ -32,6 +32,7 @@ ChromeUtils.defineModuleGetter(
);
ChromeUtils.defineESModuleGetters(this, {
PlacesTestUtils: "resource://testing-common/PlacesTestUtils.sys.mjs",
Region: "resource://gre/modules/Region.sys.mjs",
});
ChromeUtils.defineModuleGetter(
this,
@ -41,11 +42,6 @@ ChromeUtils.defineModuleGetter(
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"Region",
"resource://gre/modules/Region.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"HomePage",

Просмотреть файл

@ -7,7 +7,9 @@ const { EnterprisePolicyTesting } = ChromeUtils.importESModule(
"resource://testing-common/EnterprisePolicyTesting.sys.mjs"
);
let { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
let { Region } = ChromeUtils.importESModule(
"resource://gre/modules/Region.sys.mjs"
);
const initialHomeRegion = Region._home;
const initialCurrentRegion = Region._current;

Просмотреть файл

@ -1,4 +1,6 @@
const { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
const { Region } = ChromeUtils.importESModule(
"resource://gre/modules/Region.sys.mjs"
);
const { ASRouter } = ChromeUtils.import(
"resource://activity-stream/lib/ASRouter.jsm"
);

Просмотреть файл

@ -4,8 +4,8 @@
"use strict";
XPCOMUtils.defineLazyModuleGetters(this, {
Region: "resource://gre/modules/Region.jsm",
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
});
add_setup(async function() {

Просмотреть файл

@ -8,7 +8,9 @@ const { AboutProtectionsParent } = ChromeUtils.import(
"resource:///actors/AboutProtectionsParent.jsm"
);
let { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
let { Region } = ChromeUtils.importESModule(
"resource://gre/modules/Region.sys.mjs"
);
const initialHomeRegion = Region._home;
const initialCurrentRegion = Region._current;

Просмотреть файл

@ -12,8 +12,8 @@ const nsLoginInfo = new Components.Constructor(
"init"
);
XPCOMUtils.defineLazyModuleGetters(this, {
Region: "resource://gre/modules/Region.jsm",
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
});
const { SearchTestUtils } = ChromeUtils.importESModule(

Просмотреть файл

@ -15,12 +15,12 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
Region: "resource://gre/modules/Region.jsm",
});
const PREF_URLBAR_BRANCH = "browser.urlbar.";

Просмотреть файл

@ -7,8 +7,8 @@
"use strict";
XPCOMUtils.defineLazyModuleGetters(this, {
Region: "resource://gre/modules/Region.jsm",
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
});
// All the prefs that `updateFirefoxSuggestScenario` sets along with the

Просмотреть файл

@ -4,8 +4,8 @@ const { FormAutofillUtils } = ChromeUtils.import(
"resource://autofill/FormAutofillUtils.jsm"
);
XPCOMUtils.defineLazyModuleGetters(this, {
Region: "resource://gre/modules/Region.jsm",
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
});
requestLongerTimeout(6);

Просмотреть файл

@ -12,12 +12,15 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
IgnoreLists: "resource://gre/modules/IgnoreLists.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
CustomizableUI: "resource:///modules/CustomizableUI.jsm",
ExtensionParent: "resource://gre/modules/ExtensionParent.jsm",
ExtensionPreferencesManager:
"resource://gre/modules/ExtensionPreferencesManager.jsm",
IgnoreLists: "resource://gre/modules/IgnoreLists.jsm",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
});

Просмотреть файл

@ -15,8 +15,11 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Region: "resource://gre/modules/Region.jsm",
PingCentre: "resource:///modules/PingCentre.jsm",
});

Просмотреть файл

@ -17,6 +17,7 @@ const SUGGESTION_ENGINE_NAME =
"browser_UsageTelemetry usageTelemetrySearchSuggestions.xml";
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
SearchTestUtils: "resource://testing-common/SearchTestUtils.sys.mjs",
UrlbarTestUtils: "resource://testing-common/UrlbarTestUtils.sys.mjs",
});
@ -24,7 +25,6 @@ ChromeUtils.defineESModuleGetters(this, {
XPCOMUtils.defineLazyModuleGetters(this, {
CustomizableUITestUtils:
"resource://testing-common/CustomizableUITestUtils.jsm",
Region: "resource://gre/modules/Region.jsm",
HttpServer: "resource://testing-common/httpd.js",
});

Просмотреть файл

@ -12,8 +12,8 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
Region: "resource://gre/modules/Region.jsm",
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
const ADDRESSES_FIRST_TIME_USE_PREF = "extensions.formautofill.firstTimeUse";

Просмотреть файл

@ -13,11 +13,11 @@ const { AppConstants } = ChromeUtils.import(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
Region: "resource://gre/modules/Region.jsm",
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
});

Просмотреть файл

@ -17,8 +17,10 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AddonSearchEngine: "resource://gre/modules/AddonSearchEngine.sys.mjs",
IgnoreLists: "resource://gre/modules/IgnoreLists.sys.mjs",
OpenSearchEngine: "resource://gre/modules/OpenSearchEngine.sys.mjs",
PolicySearchEngine: "resource://gre/modules/PolicySearchEngine.sys.mjs",
Region: "resource://gre/modules/Region.sys.mjs",
SearchEngine: "resource://gre/modules/SearchEngine.sys.mjs",
SearchEngineSelector: "resource://gre/modules/SearchEngineSelector.sys.mjs",
SearchSettings: "resource://gre/modules/SearchSettings.sys.mjs",
@ -29,8 +31,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
IgnoreLists: "resource://gre/modules/IgnoreLists.jsm",
Region: "resource://gre/modules/Region.jsm",
RemoteSettings: "resource://services-settings/remote-settings.js",
NimbusFeatures: "resource://nimbus/ExperimentAPI.jsm",
});

Просмотреть файл

@ -6,6 +6,7 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
);
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
SearchEngineSelector: "resource://gre/modules/SearchEngineSelector.sys.mjs",
SearchService: "resource://gre/modules/SearchService.sys.mjs",
SearchSettings: "resource://gre/modules/SearchSettings.sys.mjs",
@ -17,7 +18,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
clearTimeout: "resource://gre/modules/Timer.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm",
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
Region: "resource://gre/modules/Region.jsm",
RemoteSettings: "resource://services-settings/remote-settings.js",
RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm",
setTimeout: "resource://gre/modules/Timer.jsm",

Просмотреть файл

@ -11,6 +11,7 @@ const { AppConstants } = ChromeUtils.import(
);
ChromeUtils.defineESModuleGetters(this, {
Region: "resource://gre/modules/Region.sys.mjs",
SearchEngine: "resource://gre/modules/SearchEngine.sys.mjs",
SearchEngineSelector: "resource://gre/modules/SearchEngineSelector.sys.mjs",
SearchTestUtils: "resource://testing-common/SearchTestUtils.sys.mjs",
@ -21,7 +22,6 @@ XPCOMUtils.defineLazyModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
AddonTestUtils: "resource://testing-common/AddonTestUtils.jsm",
ObjectUtils: "resource://gre/modules/ObjectUtils.jsm",
Region: "resource://gre/modules/Region.jsm",
RemoteSettings: "resource://services-settings/remote-settings.js",
sinon: "resource://testing-common/Sinon.jsm",
});

Просмотреть файл

@ -31,11 +31,9 @@ ChromeUtils.defineModuleGetter(
"resource://gre/modules/UpdateUtils.jsm"
);
ChromeUtils.defineModuleGetter(
lazy,
"Region",
"resource://gre/modules/Region.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
function nsURLFormatterService() {
XPCOMUtils.defineLazyGetter(this, "ABI", function UFS_ABI() {

Просмотреть файл

@ -14,11 +14,9 @@ const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"Region",
"resource://gre/modules/Region.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
Region: "resource://gre/modules/Region.sys.mjs",
});
XPCOMUtils.defineLazyPreferenceGetter(
lazy,

Просмотреть файл

@ -3,9 +3,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -14,8 +12,6 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm",
});
var EXPORTED_SYMBOLS = ["IgnoreLists"];
const SETTINGS_IGNORELIST_KEY = "hijack-blocklists";
class IgnoreListsManager {
@ -95,4 +91,4 @@ class IgnoreListsManager {
}
}
const IgnoreLists = new IgnoreListsManager();
export const IgnoreLists = new IgnoreListsManager();

Просмотреть файл

@ -4,11 +4,8 @@
"use strict";
const EXPORTED_SYMBOLS = ["Region"];
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
@ -874,7 +871,7 @@ class RegionDetector {
}
}
let Region = new RegionDetector();
export let Region = new RegionDetector();
Region.init();
// A method that tries to determine if this user is in a US geography.

Просмотреть файл

@ -177,7 +177,7 @@ EXTRA_JS_MODULES += [
"Geometry.jsm",
"HiddenFrame.jsm",
"Http.jsm",
"IgnoreLists.jsm",
"IgnoreLists.sys.mjs",
"IndexedDB.jsm",
"InlineSpellChecker.jsm",
"InlineSpellCheckerContent.jsm",
@ -199,7 +199,7 @@ EXTRA_JS_MODULES += [
"ProcessType.jsm",
"ProfileAge.jsm",
"PromiseUtils.jsm",
"Region.jsm",
"Region.sys.mjs",
"RemotePageAccessManager.jsm",
"ResetProfile.jsm",
"ResponsivenessMonitor.jsm",

Просмотреть файл

@ -13,7 +13,9 @@ const { EnterprisePolicyTesting } = ChromeUtils.importESModule(
"resource://testing-common/EnterprisePolicyTesting.sys.mjs"
);
const { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
const { Region } = ChromeUtils.importESModule(
"resource://gre/modules/Region.sys.mjs"
);
const { updateAppInfo } = ChromeUtils.import(
"resource://testing-common/AppInfo.jsm"

Просмотреть файл

@ -3,8 +3,11 @@
"use strict";
ChromeUtils.defineESModuleGetters(this, {
IgnoreLists: "resource://gre/modules/IgnoreLists.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
IgnoreLists: "resource://gre/modules/IgnoreLists.jsm",
PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
RemoteSettings: "resource://services-settings/remote-settings.js",
RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm",

Просмотреть файл

@ -4,7 +4,9 @@ const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const { HttpServer } = ChromeUtils.import("resource://testing-common/httpd.js");
const { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
const { Region } = ChromeUtils.importESModule(
"resource://gre/modules/Region.sys.mjs"
);
const { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
const { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"

Просмотреть файл

@ -1,6 +1,8 @@
"use strict";
const { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm");
const { Region } = ChromeUtils.importESModule(
"resource://gre/modules/Region.sys.mjs"
);
const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm");
const { TestUtils } = ChromeUtils.import(
"resource://testing-common/TestUtils.jsm"