Bug 1772351 - Part 4: Stop calling XPCOMUtils.defineLazyModuleGetters for AppConstants for already converted cases. r=florian

Differential Revision: https://phabricator.services.mozilla.com/D148167
This commit is contained in:
Tooru Fujisawa 2022-06-06 02:49:13 +00:00
Родитель b200384ddb
Коммит 4dc660a4b7
5 изменённых файлов: 28 добавлений и 21 удалений

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

@ -13,16 +13,17 @@ const { GeckoViewUtils } = ChromeUtils.import(
"resource://gre/modules/GeckoViewUtils.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
EventDispatcher: "resource://gre/modules/Messaging.jsm",
OS: "resource://gre/modules/osfile.jsm",
});
ChromeUtils.defineModuleGetter(lazy, "OS", "resource://gre/modules/osfile.jsm");
const { debug, warn } = GeckoViewUtils.initLogging("ChildCrashHandler");
function getDir(name) {
@ -56,7 +57,7 @@ var ChildCrashHandler = {
if (
!aSubject.get("abnormal") ||
!lazy.AppConstants.MOZ_CRASHREPORTER ||
!AppConstants.MOZ_CRASHREPORTER ||
disableReporting
) {
return;

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

@ -10,11 +10,13 @@ const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
ClientEnvironmentBase:
"resource://gre/modules/components-utils/ClientEnvironment.jsm",
Database: "resource://services-settings/Database.jsm",
@ -232,7 +234,7 @@ class RemoteSettingsClient extends EventEmitter {
constructor(
collectionName,
{
bucketName = lazy.AppConstants.REMOTE_SETTINGS_DEFAULT_BUCKET,
bucketName = AppConstants.REMOTE_SETTINGS_DEFAULT_BUCKET,
signerName,
filterFunc,
localFields = [],
@ -254,7 +256,7 @@ class RemoteSettingsClient extends EventEmitter {
// This attribute allows signature verification to be disabled, when running tests
// or when pulling data from a dev server.
this.verifySignature = lazy.AppConstants.REMOTE_SETTINGS_VERIFY_SIGNATURE;
this.verifySignature = AppConstants.REMOTE_SETTINGS_VERIFY_SIGNATURE;
XPCOMUtils.defineLazyGetter(
this,

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

@ -11,12 +11,14 @@ const { XPCOMUtils } = ChromeUtils.import(
const { ServiceRequest } = ChromeUtils.import(
"resource://gre/modules/ServiceRequest.jsm"
);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
SharedUtils: "resource://services-settings/SharedUtils.jsm",
AppConstants: "resource://gre/modules/AppConstants.jsm",
});
XPCOMUtils.defineLazyServiceGetter(
@ -62,7 +64,7 @@ XPCOMUtils.defineLazyGetter(lazy, "isRunningTests", () => {
// Overriding the server URL is normally disabled on Beta and Release channels,
// except under some conditions.
XPCOMUtils.defineLazyGetter(lazy, "allowServerURLOverride", () => {
if (!lazy.AppConstants.RELEASE_OR_BETA) {
if (!AppConstants.RELEASE_OR_BETA) {
// Always allow to override the server URL on Nightly/DevEdition.
return true;
}
@ -87,7 +89,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"gServerURL",
"services.settings.server",
lazy.AppConstants.REMOTE_SETTINGS_SERVER_URL
AppConstants.REMOTE_SETTINGS_SERVER_URL
);
XPCOMUtils.defineLazyPreferenceGetter(
@ -105,7 +107,7 @@ var Utils = {
get SERVER_URL() {
return lazy.allowServerURLOverride
? lazy.gServerURL
: lazy.AppConstants.REMOTE_SETTINGS_SERVER_URL;
: AppConstants.REMOTE_SETTINGS_SERVER_URL;
},
CHANGES_PATH: "/buckets/monitor/collections/changes/changeset",
@ -116,7 +118,7 @@ var Utils = {
log: lazy.log,
get CERT_CHAIN_ROOT_IDENTIFIER() {
if (this.SERVER_URL == lazy.AppConstants.REMOTE_SETTINGS_SERVER_URL) {
if (this.SERVER_URL == AppConstants.REMOTE_SETTINGS_SERVER_URL) {
return Ci.nsIContentSignatureVerifier.ContentSignatureProdRoot;
}
if (this.SERVER_URL.includes("stage.")) {
@ -137,7 +139,7 @@ var Utils = {
get LOAD_DUMPS() {
// Load dumps only if pulling data from the production server, or in tests.
return (
this.SERVER_URL == lazy.AppConstants.REMOTE_SETTINGS_SERVER_URL ||
this.SERVER_URL == AppConstants.REMOTE_SETTINGS_SERVER_URL ||
lazy.isRunningTests
);
},

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

@ -16,11 +16,13 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
UptakeTelemetry: "resource://services-common/uptake-telemetry.js",
pushBroadcastService: "resource://gre/modules/PushBroadcastService.jsm",
RemoteSettingsClient: "resource://services-settings/RemoteSettingsClient.jsm",
@ -147,9 +149,7 @@ function remoteSettingsFunction() {
// this client is known but it was not registered yet (eg. calling module not "imported" yet).
if (
bucketName ==
lazy.Utils.actualBucketName(
lazy.AppConstants.REMOTE_SETTINGS_DEFAULT_BUCKET
)
lazy.Utils.actualBucketName(AppConstants.REMOTE_SETTINGS_DEFAULT_BUCKET)
) {
const c = new lazy.RemoteSettingsClient(collectionName, defaultOptions);
const [dbExists, localDump] = await Promise.all([
@ -495,7 +495,7 @@ function remoteSettingsFunction() {
localTimestamp: lazy.gPrefs.getCharPref(PREF_SETTINGS_LAST_ETAG, null),
lastCheck: lazy.gPrefs.getIntPref(PREF_SETTINGS_LAST_UPDATE, 0),
mainBucket: lazy.Utils.actualBucketName(
lazy.AppConstants.REMOTE_SETTINGS_DEFAULT_BUCKET
AppConstants.REMOTE_SETTINGS_DEFAULT_BUCKET
),
defaultSigner: DEFAULT_SIGNER,
previewMode: lazy.Utils.PREVIEW_MODE,

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

@ -27,12 +27,14 @@ const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const lazy = {};
XPCOMUtils.defineLazyModuleGetters(lazy, {
Authentication: "resource://tps/auth/fxaccounts.jsm",
AppConstants: "resource://gre/modules/AppConstants.jsm",
Async: "resource://services-common/async.js",
BrowserTabs: "resource://tps/modules/tabs.jsm",
BrowserWindows: "resource://tps/modules/windows.jsm",
@ -1096,9 +1098,9 @@ var TPS = {
lazy.Logger.logInfo("Firefox version: " + Services.appinfo.version);
lazy.Logger.logInfo(
"Firefox source revision: " +
(lazy.AppConstants.SOURCE_REVISION_URL || "unknown")
(AppConstants.SOURCE_REVISION_URL || "unknown")
);
lazy.Logger.logInfo("Firefox platform: " + lazy.AppConstants.platform);
lazy.Logger.logInfo("Firefox platform: " + AppConstants.platform);
// do some sync housekeeping
if (lazy.Weave.Service.isLoggedIn) {