Bug 1773747 - Part 1: Do not use lazy getter for immediately-used symbol in browser/components/. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D149986
This commit is contained in:
Tooru Fujisawa
2022-06-24 11:03:52 +00:00
parent 6f07349601
commit 005cb01ee5
2 changed files with 8 additions and 13 deletions

View File

@@ -16,9 +16,6 @@ const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const lazy = {};
@@ -72,7 +69,7 @@ let gForceExitSpinResolve = false;
let gKeepUndoData = false;
let gUndoData = null;
XPCOMUtils.defineLazyGetter(lazy, "gAvailableMigratorKeys", function() {
const gAvailableMigratorKeys = (function() {
if (AppConstants.platform == "win") {
return [
"firefox",
@@ -111,7 +108,7 @@ XPCOMUtils.defineLazyGetter(lazy, "gAvailableMigratorKeys", function() {
];
}
return [];
});
})();
function getL10n() {
if (!gL10n) {
@@ -1026,7 +1023,7 @@ var MigrationUtils = Object.seal({
if (!migrator) {
let migrators = await Promise.all(
lazy.gAvailableMigratorKeys.map(key => this.getMigrator(key))
gAvailableMigratorKeys.map(key => this.getMigrator(key))
);
// If there's no migrator set so far, ensure that there is at least one
// migrator available before opening the wizard.
@@ -1242,7 +1239,7 @@ var MigrationUtils = Object.seal({
gL10n = null;
},
gAvailableMigratorKeys: lazy.gAvailableMigratorKeys,
gAvailableMigratorKeys,
MIGRATION_ENTRYPOINT_UNKNOWN: 0,
MIGRATION_ENTRYPOINT_FIRSTRUN: 1,

View File

@@ -28,11 +28,9 @@ ChromeUtils.defineModuleGetter(
var EXPORTED_SYMBOLS = ["SaveToPocket"];
XPCOMUtils.defineLazyGetter(lazy, "gStrings", () => {
return Services.strings.createBundle(
"chrome://global/locale/aboutReader.properties"
);
});
const gStrings = Services.strings.createBundle(
"chrome://global/locale/aboutReader.properties"
);
var PocketCustomizableWidget = {
init() {
lazy.CustomizableUI.createWidget({
@@ -131,7 +129,7 @@ var SaveToPocket = {
_readerButtonData: {
id: "pocket-button",
telemetryId: "save-to-pocket",
label: lazy.gStrings.formatStringFromName("readerView.savetopocket.label", [
label: gStrings.formatStringFromName("readerView.savetopocket.label", [
"Pocket",
]),
image: "chrome://global/skin/icons/pocket.svg",