Bug 1845311 - Use ChromeUtils.defineLazyGetter in more places r=arai,webdriver-reviewers,geckoview-reviewers,extension-reviewers,application-update-reviewers,credential-management-reviewers,devtools-reviewers,fxview-reviewers,anti-tracking-reviewers,sessionstore-reviewers,pbz,joschmidt,robwu,issammani,bytesized,owlish,dao

Differential Revision: https://phabricator.services.mozilla.com/D184481
This commit is contained in:
Gregory Pappas 2023-07-26 16:28:11 +00:00
parent eeac47b9a5
commit 3eac12bbd7
313 changed files with 528 additions and 868 deletions

View File

@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
FXA_PWDMGR_REALM: "resource://gre/modules/FxAccountsCommon.js",
});
XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => {
ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => {
return ChromeUtils.importESModule(
"resource://gre/modules/FxAccounts.sys.mjs"
).getFxAccountsSingleton();

View File

@ -9,7 +9,7 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "gNavigatorBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gNavigatorBundle", function () {
return Services.strings.createBundle(
"chrome://browser/locale/browser.properties"
);

View File

@ -2,23 +2,22 @@
/* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "gBrandBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gBrandBundle", function () {
return Services.strings.createBundle(
"chrome://branding/locale/brand.properties"
);
});
XPCOMUtils.defineLazyGetter(lazy, "gNavigatorBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gNavigatorBundle", function () {
return Services.strings.createBundle(
"chrome://browser/locale/browser.properties"
);
});
XPCOMUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
ChromeUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
return new Localization(["branding/brand.ftl", "browser/browser.ftl"], true);
});

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -12,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
CrashSubmit: "resource://gre/modules/CrashSubmit.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "gNavigatorBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gNavigatorBundle", function () {
const url = "chrome://browser/locale/browser.properties";
return Services.strings.createBundle(url);
});

View File

@ -25,7 +25,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
XPCOMUtils.defineLazyGetter(lazy, "gTabBrowserLocalization", function () {
ChromeUtils.defineLazyGetter(lazy, "gTabBrowserLocalization", function () {
return new Localization(["browser/tabbrowser.ftl"], true);
});

View File

@ -28,11 +28,11 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
WindowsUIUtils: ["@mozilla.org/windows-ui-utils;1", "nsIWindowsUIUtils"],
});
XPCOMUtils.defineLazyGetter(lazy, "gSystemPrincipal", () =>
ChromeUtils.defineLazyGetter(lazy, "gSystemPrincipal", () =>
Services.scriptSecurityManager.getSystemPrincipal()
);
XPCOMUtils.defineLazyGetter(lazy, "gWindowsAlertsService", () => {
ChromeUtils.defineLazyGetter(lazy, "gWindowsAlertsService", () => {
// We might not have the Windows alerts service: e.g., on Windows 7 and Windows 8.
if (!("nsIWindowsAlertsService" in Ci)) {
return null;

View File

@ -118,7 +118,7 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
PushService: ["@mozilla.org/push/Service;1", "nsIPushService"],
});
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"accountsL10n",
() =>
@ -821,7 +821,7 @@ let JSWINDOWACTORS = {
},
};
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"WeaveService",
() => Cc["@mozilla.org/weave/service;1"].getService().wrappedJSObject
@ -833,19 +833,19 @@ if (AppConstants.MOZ_CRASHREPORTER) {
});
}
XPCOMUtils.defineLazyGetter(lazy, "gBrandBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gBrandBundle", function () {
return Services.strings.createBundle(
"chrome://branding/locale/brand.properties"
);
});
XPCOMUtils.defineLazyGetter(lazy, "gBrowserBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gBrowserBundle", function () {
return Services.strings.createBundle(
"chrome://browser/locale/browser.properties"
);
});
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);
@ -920,7 +920,7 @@ export function BrowserGlue() {
"nsIUserIdleService"
);
XPCOMUtils.defineLazyGetter(this, "_distributionCustomizer", function () {
ChromeUtils.defineLazyGetter(this, "_distributionCustomizer", function () {
const { DistributionCustomizer } = ChromeUtils.importESModule(
"resource:///modules/distribution.sys.mjs"
);

View File

@ -21,7 +21,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
UIState: "resource://services-sync/UIState.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
return lazy.LoginHelper.createLogger("AboutLoginsParent");
});
XPCOMUtils.defineLazyPreferenceGetter(
@ -48,7 +48,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
"signon.management.page.vulnerable-passwords.enabled",
false
);
XPCOMUtils.defineLazyGetter(lazy, "AboutLoginsL10n", () => {
ChromeUtils.defineLazyGetter(lazy, "AboutLoginsL10n", () => {
return new Localization(["branding/brand.ftl", "browser/aboutLogins.ftl"]);
});

View File

@ -7,8 +7,6 @@
* RemoteSettings.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -168,6 +166,6 @@ export const LoginBreaches = {
},
};
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
return lazy.LoginHelper.createLogger("LoginBreaches");
});

View File

@ -12,14 +12,13 @@ export const AttributionIOUtils = {
exists: async path => IOUtils.exists(path),
};
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
MacAttribution: "resource:///modules/MacAttribution.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -2,10 +2,8 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -19,7 +19,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
ShortcutUtils: "resource://gre/modules/ShortcutUtils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "gWidgetsBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gWidgetsBundle", function () {
const kUrl =
"chrome://browser/locale/customizableui/customizableWidgets.properties";
return Services.strings.createBundle(kUrl);
@ -185,7 +185,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
}
);
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -22,7 +22,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
const kPrefCustomizationDebug = "browser.uiCustomization.debug";
const kPrefScreenshots = "extensions.screenshots.disabled";
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -31,7 +31,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
URILoadingHelper: "resource:///modules/URILoadingHelper.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "gWidgetsBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gWidgetsBundle", function () {
const kUrl =
"chrome://browser/locale/customizableui/customizableWidgets.properties";
return Services.strings.createBundle(kUrl);
@ -44,7 +44,7 @@ XPCOMUtils.defineLazyServiceGetter(
);
let gDebug;
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -97,14 +97,12 @@
* Open views
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "gBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gBundle", function () {
return Services.strings.createBundle(
"chrome://browser/locale/browser.properties"
);

View File

@ -48,7 +48,7 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
gMIMEService: ["@mozilla.org/mime;1", "nsIMIMEService"],
});
XPCOMUtils.defineLazyGetter(lazy, "DownloadsLogger", () => {
ChromeUtils.defineLazyGetter(lazy, "DownloadsLogger", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);
@ -115,7 +115,7 @@ var PrefObserver = {
kPrefBranch.addObserver("", this, true);
for (let key in prefs) {
let name = key;
XPCOMUtils.defineLazyGetter(this, name, function () {
ChromeUtils.defineLazyGetter(this, name, function () {
return PrefObserver.getPref(name);
});
}
@ -744,10 +744,10 @@ export var DownloadsCommon = {
},
};
XPCOMUtils.defineLazyGetter(DownloadsCommon, "log", () => {
ChromeUtils.defineLazyGetter(DownloadsCommon, "log", () => {
return lazy.DownloadsLogger.log.bind(lazy.DownloadsLogger);
});
XPCOMUtils.defineLazyGetter(DownloadsCommon, "error", () => {
ChromeUtils.defineLazyGetter(DownloadsCommon, "error", () => {
return lazy.DownloadsLogger.error.bind(lazy.DownloadsLogger);
});
@ -999,18 +999,18 @@ DownloadsDataCtor.prototype = {
},
};
XPCOMUtils.defineLazyGetter(lazy, "HistoryDownloadsData", function () {
ChromeUtils.defineLazyGetter(lazy, "HistoryDownloadsData", function () {
return new DownloadsDataCtor({ isHistory: true });
});
XPCOMUtils.defineLazyGetter(lazy, "LimitedHistoryDownloadsData", function () {
ChromeUtils.defineLazyGetter(lazy, "LimitedHistoryDownloadsData", function () {
return new DownloadsDataCtor({
isHistory: true,
maxHistoryResults: kMaxHistoryResultsForLimitedView,
});
});
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"LimitedPrivateHistoryDownloadData",
function () {
@ -1022,11 +1022,11 @@ XPCOMUtils.defineLazyGetter(
}
);
XPCOMUtils.defineLazyGetter(lazy, "PrivateDownloadsData", function () {
ChromeUtils.defineLazyGetter(lazy, "PrivateDownloadsData", function () {
return new DownloadsDataCtor({ isPrivate: true });
});
XPCOMUtils.defineLazyGetter(lazy, "DownloadsData", function () {
ChromeUtils.defineLazyGetter(lazy, "DownloadsData", function () {
return new DownloadsDataCtor();
});
@ -1459,11 +1459,15 @@ Object.setPrototypeOf(
DownloadsViewPrototype
);
XPCOMUtils.defineLazyGetter(lazy, "PrivateDownloadsIndicatorData", function () {
return new DownloadsIndicatorDataCtor(true);
});
ChromeUtils.defineLazyGetter(
lazy,
"PrivateDownloadsIndicatorData",
function () {
return new DownloadsIndicatorDataCtor(true);
}
);
XPCOMUtils.defineLazyGetter(lazy, "DownloadsIndicatorData", function () {
ChromeUtils.defineLazyGetter(lazy, "DownloadsIndicatorData", function () {
return new DownloadsIndicatorDataCtor(false);
});

View File

@ -10,8 +10,6 @@
// Globals
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -19,7 +17,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
Downloads: "resource://gre/modules/Downloads.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "gWinTaskbar", function () {
ChromeUtils.defineLazyGetter(lazy, "gWinTaskbar", function () {
if (!("@mozilla.org/windows-taskbar;1" in Cc)) {
return null;
}
@ -29,14 +27,14 @@ XPCOMUtils.defineLazyGetter(lazy, "gWinTaskbar", function () {
return winTaskbar.available && winTaskbar;
});
XPCOMUtils.defineLazyGetter(lazy, "gMacTaskbarProgress", function () {
ChromeUtils.defineLazyGetter(lazy, "gMacTaskbarProgress", function () {
return (
"@mozilla.org/widget/macdocksupport;1" in Cc &&
Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsITaskbarProgress)
);
});
XPCOMUtils.defineLazyGetter(lazy, "gGtkTaskbarProgress", function () {
ChromeUtils.defineLazyGetter(lazy, "gGtkTaskbarProgress", function () {
return (
"@mozilla.org/widget/taskbarprogress/gtk;1" in Cc &&
Cc["@mozilla.org/widget/taskbarprogress/gtk;1"].getService(

View File

@ -37,7 +37,7 @@ const ABOUT_CONTRACT = "@mozilla.org/network/protocol/about;1?what=";
const isXpcshell = Services.env.exists("XPCSHELL_TEST_PROFILE_DIR");
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -37,8 +37,6 @@
* The schema for this object is defined in policies-schema.json.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -47,7 +45,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
const PREF_LOGLEVEL = "browser.policies.loglevel";
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);
@ -250,7 +248,7 @@ function setFaviconForBookmark(bookmark) {
// function. The name consists in the parentGuid (which should always
// be the menuGuid or the toolbarGuid) + the folder title. This is to
// support having the same folder name in both the toolbar and menu.
XPCOMUtils.defineLazyGetter(lazy, "gFoldersMapPromise", () => {
ChromeUtils.defineLazyGetter(lazy, "gFoldersMapPromise", () => {
return new Promise(resolve => {
let foldersMap = new Map();
return lazy.PlacesUtils.bookmarks

View File

@ -2,13 +2,11 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const PREF_LOGLEVEL = "browser.policies.loglevel";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -24,15 +24,13 @@
* way is to configure that with extensions or through a company firewall.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const LIST_LENGTH_LIMIT = 1000;
const PREF_LOGLEVEL = "browser.policies.loglevel";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -2,11 +2,9 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "makeRange", () => {
ChromeUtils.defineLazyGetter(lazy, "makeRange", () => {
const { ExtensionParent } = ChromeUtils.importESModule(
"resource://gre/modules/ExtensionParent.sys.mjs"
);

View File

@ -15,7 +15,6 @@
*/
import { ExtensionCommon } from "resource://gre/modules/ExtensionCommon.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -30,7 +29,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
let { makeWidgetId } = ExtensionCommon;
XPCOMUtils.defineLazyGetter(lazy, "strBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "strBundle", function () {
return Services.strings.createBundle(
"chrome://global/locale/extensions.properties"
);
@ -38,7 +37,7 @@ XPCOMUtils.defineLazyGetter(lazy, "strBundle", function () {
const PREF_BRANCH_INSTALLED_ADDON = "extensions.installedDistroAddon.";
XPCOMUtils.defineLazyGetter(lazy, "distributionAddonsList", function () {
ChromeUtils.defineLazyGetter(lazy, "distributionAddonsList", function () {
let addonList = Services.prefs
.getChildList(PREF_BRANCH_INSTALLED_ADDON)
.map(id => id.replace(PREF_BRANCH_INSTALLED_ADDON, ""));

View File

@ -4,8 +4,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -40,7 +38,7 @@ function promisePopupShown(popup) {
});
}
XPCOMUtils.defineLazyGetter(lazy, "standaloneStylesheets", () => {
ChromeUtils.defineLazyGetter(lazy, "standaloneStylesheets", () => {
let stylesheets = [];
if (AppConstants.platform === "macosx") {

View File

@ -15,7 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
UIState: "resource://services-sync/UIState.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "syncUtils", () => {
ChromeUtils.defineLazyGetter(lazy, "syncUtils", () => {
return ChromeUtils.importESModule("resource://services-sync/util.sys.mjs")
.Utils;
});

View File

@ -20,12 +20,12 @@ ChromeUtils.defineESModuleGetters(lazy, {
UIState: "resource://services-sync/UIState.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "syncUtils", () => {
ChromeUtils.defineLazyGetter(lazy, "syncUtils", () => {
return ChromeUtils.importESModule("resource://services-sync/util.sys.mjs")
.Utils;
});
XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => {
ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => {
return ChromeUtils.importESModule(
"resource://gre/modules/FxAccounts.sys.mjs"
).getFxAccountsSingleton();

View File

@ -33,7 +33,6 @@ const INSTALLER_PREFS_BRANCH = "installer.";
const INSTALLER_PREFS_LIST = ["installer.taskbarpin.win10.enabled"];
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
// This constructor can take a list of prefs to override the default one,
// but this is really only intended for tests to use. Normal usage should be
@ -44,7 +43,7 @@ export function InstallerPrefs(prefsList) {
// Each pref to be reflected will get a value created under this key, in HKCU.
// The path will look something like:
// "Software\Mozilla\Firefox\Installer\71AE18FE3142402B\".
XPCOMUtils.defineLazyGetter(this, "_registryKeyPath", function () {
ChromeUtils.defineLazyGetter(this, "_registryKeyPath", function () {
const app = AppConstants.MOZ_APP_NAME;
const vendor = Services.appinfo.vendor || "Mozilla";
const xreDirProvider = Cc[

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs";
const lazy = {};
@ -13,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
Sqlite: "resource://gre/modules/Sqlite.sys.mjs",
});
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"filenamesRegex",
() => /^360(?:default_ori|sefav)_([0-9_]+)\.favdb$/i

View File

@ -10,7 +10,6 @@
import { ChromeMigrationUtils } from "resource:///modules/ChromeMigrationUtils.sys.mjs";
import { OSCrypto } from "resource://gre/modules/OSCrypto_win.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
/**
* These constants should match those from Chromium.
@ -42,7 +41,7 @@ export class ChromeWindowsLoginCrypto {
// Lazily decrypt the key from "Chrome"s local state using OSCrypto and save
// it as the master key to decrypt or encrypt passwords.
XPCOMUtils.defineLazyGetter(this, "_keyPromise", async () => {
ChromeUtils.defineLazyGetter(this, "_keyPromise", async () => {
let keyData;
try {
// NB: For testing, allow directory service to be faked before getting.

View File

@ -3,10 +3,9 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
import { ctypes } from "resource://gre/modules/ctypes.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -4,8 +4,6 @@
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs";
import { MigratorBase } from "resource:///modules/MigratorBase.sys.mjs";
import { MSMigrationUtils } from "resource:///modules/MSMigrationUtils.sys.mjs";
@ -25,7 +23,7 @@ const kEdgeRegistryRoot =
"microsoft.microsoftedge_8wekyb3d8bbwe\\MicrosoftEdge";
const kEdgeDatabasePath = "AC\\MicrosoftEdge\\User\\Default\\DataStore\\Data\\";
XPCOMUtils.defineLazyGetter(lazy, "gEdgeDatabase", function () {
ChromeUtils.defineLazyGetter(lazy, "gEdgeDatabase", function () {
let edgeDir = MSMigrationUtils.getEdgeLocalDataFolder();
if (!edgeDir) {
return null;

View File

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const lazy = {};
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
ChromeUtils.defineESModuleGetters(lazy, {
BookmarkHTMLUtils: "resource://gre/modules/BookmarkHTMLUtils.sys.mjs",
@ -13,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
"chrome://browser/content/migration/migration-wizard-constants.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
ChromeUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
return new Localization([
"branding/brand.ftl",
"browser/migrationWizard.ftl",

View File

@ -5,11 +5,10 @@
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { MigrationUtils } from "resource:///modules/MigrationUtils.sys.mjs";
import { E10SUtils } from "resource://gre/modules/E10SUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
ChromeUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
return new Localization([
"branding/brand.ftl",
"browser/migrationWizard.ftl",

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -14,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
TwitterPageData: "resource:///modules/pagedata/TwitterPageData.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logConsole", function () {
ChromeUtils.defineLazyGetter(lazy, "logConsole", function () {
return console.createInstance({
prefix: "PageData",
maxLogLevel: Services.prefs.getBoolPref("browser.pagedata.log", false)
@ -35,7 +33,7 @@ XPCOMUtils.defineLazyGetter(lazy, "logConsole", function () {
* The data returned need not be valid, collectors should return whatever they
* can and then we drop anything that is invalid once all data is joined.
*/
XPCOMUtils.defineLazyGetter(lazy, "DATA_COLLECTORS", function () {
ChromeUtils.defineLazyGetter(lazy, "DATA_COLLECTORS", function () {
return [lazy.SchemaOrgPageData, lazy.OpenGraphPageData, lazy.TwitterPageData];
});

View File

@ -15,7 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
PromiseUtils: "resource://gre/modules/PromiseUtils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logConsole", function () {
ChromeUtils.defineLazyGetter(lazy, "logConsole", function () {
return console.createInstance({
prefix: "PageData",
maxLogLevel: Services.prefs.getBoolPref("browser.pagedata.log", false)

View File

@ -15,7 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logConsole", function () {
ChromeUtils.defineLazyGetter(lazy, "logConsole", function () {
return console.createInstance({
prefix: "InteractionsManager",
maxLogLevel: Services.prefs.getBoolPref(

View File

@ -14,7 +14,7 @@ XPCOMUtils.defineLazyModuleGetters(lazy, {
FilterAdult: "resource://activity-stream/lib/FilterAdult.jsm",
});
XPCOMUtils.defineLazyGetter(lazy, "logConsole", function () {
ChromeUtils.defineLazyGetter(lazy, "logConsole", function () {
return console.createInstance({
prefix: "InteractionsBlocklist",
maxLogLevel: Services.prefs.getBoolPref(

View File

@ -1943,32 +1943,32 @@ PlacesUIUtils.canLoadToolbarContentPromise = new Promise(resolve => {
});
// These are lazy getters to avoid importing PlacesUtils immediately.
XPCOMUtils.defineLazyGetter(PlacesUIUtils, "PLACES_FLAVORS", () => {
ChromeUtils.defineLazyGetter(PlacesUIUtils, "PLACES_FLAVORS", () => {
return [
lazy.PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER,
lazy.PlacesUtils.TYPE_X_MOZ_PLACE_SEPARATOR,
lazy.PlacesUtils.TYPE_X_MOZ_PLACE,
];
});
XPCOMUtils.defineLazyGetter(PlacesUIUtils, "URI_FLAVORS", () => {
ChromeUtils.defineLazyGetter(PlacesUIUtils, "URI_FLAVORS", () => {
return [
lazy.PlacesUtils.TYPE_X_MOZ_URL,
TAB_DROP_TYPE,
lazy.PlacesUtils.TYPE_PLAINTEXT,
];
});
XPCOMUtils.defineLazyGetter(PlacesUIUtils, "SUPPORTED_FLAVORS", () => {
ChromeUtils.defineLazyGetter(PlacesUIUtils, "SUPPORTED_FLAVORS", () => {
return [...PlacesUIUtils.PLACES_FLAVORS, ...PlacesUIUtils.URI_FLAVORS];
});
XPCOMUtils.defineLazyGetter(PlacesUIUtils, "ellipsis", function () {
ChromeUtils.defineLazyGetter(PlacesUIUtils, "ellipsis", function () {
return Services.prefs.getComplexValue(
"intl.ellipsis",
Ci.nsIPrefLocalizedString
).data;
});
XPCOMUtils.defineLazyGetter(PlacesUIUtils, "promptLocalization", () => {
ChromeUtils.defineLazyGetter(PlacesUIUtils, "promptLocalization", () => {
return new Localization(
["browser/placesPrompts.ftl", "branding/brand.ftl"],
true

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
PingCentre: "resource:///modules/PingCentre.sys.mjs",
@ -20,7 +18,7 @@ const STRUCTURED_INGESTION_ENDPOINT_PREF =
const POCKET_TELEMETRY_TOPIC = "pocket";
const PREF_IMPRESSION_ID = "browser.newtabpage.activity-stream.impressionId";
XPCOMUtils.defineLazyGetter(lazy, "pingCentre", () => {
ChromeUtils.defineLazyGetter(lazy, "pingCentre", () => {
return new lazy.PingCentre({ topic: POCKET_TELEMETRY_TOPIC });
});

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
/**
* Implements nsIPromptCollection
* @class PromptCollection
@ -176,7 +174,7 @@ const BUNDLES = {
PromptCollection.prototype.stringBundles = {};
for (const [bundleName, bundleUrl] of Object.entries(BUNDLES)) {
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
PromptCollection.prototype.stringBundles,
bundleName,
function () {

View File

@ -26,7 +26,6 @@
* The user is resizing the selection
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import {
setMaxDetectHeight,
setMaxDetectWidth,
@ -37,7 +36,7 @@ import {
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "overlayLocalization", () => {
ChromeUtils.defineLazyGetter(lazy, "overlayLocalization", () => {
return new Localization(["browser/screenshotsOverlay.ftl"], true);
});

View File

@ -17,7 +17,7 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
AlertsService: ["@mozilla.org/alerts-service;1", "nsIAlertsService"],
});
XPCOMUtils.defineLazyGetter(lazy, "screenshotsLocalization", () => {
ChromeUtils.defineLazyGetter(lazy, "screenshotsLocalization", () => {
return new Localization(["browser/screenshots.ftl"], true);
});

View File

@ -24,7 +24,7 @@ export const TELEMETRY_SETTINGS_KEY = "search-telemetry-v2";
const impressionIdsWithoutEngagementsSet = new Set();
XPCOMUtils.defineLazyGetter(lazy, "logConsole", () => {
ChromeUtils.defineLazyGetter(lazy, "logConsole", () => {
return console.createInstance({
prefix: "SearchTelemetry",
maxLogLevel: lazy.SearchUtils.loggingEnabled ? "Debug" : "Warn",

View File

@ -6,11 +6,9 @@
* Various utilities for search related UI.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "SearchUIUtilsL10n", () => {
ChromeUtils.defineLazyGetter(lazy, "SearchUIUtilsL10n", () => {
return new Localization(["browser/search.ftl", "branding/brand.ftl"]);
});

View File

@ -2,7 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import {
clearTimeout,
setTimeoutWithTarget,
@ -518,7 +517,7 @@ export class ContentSessionStore {
new SessionHistoryListener(this),
];
XPCOMUtils.defineLazyGetter(this, "contentRestore", () => {
ChromeUtils.defineLazyGetter(this, "contentRestore", () => {
this.contentRestoreInitialized = true;
return new lazy.ContentRestore(mm);
});

View File

@ -11,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
SessionStore: "resource:///modules/sessionstore/SessionStore.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "l10n", () => {
ChromeUtils.defineLazyGetter(lazy, "l10n", () => {
return new Localization(["browser/recentlyClosed.ftl"], true);
});

View File

@ -251,7 +251,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "blankURI", () => {
ChromeUtils.defineLazyGetter(lazy, "blankURI", () => {
return Services.io.newURI("about:blank");
});

View File

@ -21,7 +21,7 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIXREDirProvider"
);
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -2,8 +2,6 @@
// 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/.
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
@ -23,7 +21,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
UpdateUtils: "resource://gre/modules/UpdateUtils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "fxAccounts", () => {
ChromeUtils.defineLazyGetter(lazy, "fxAccounts", () => {
return ChromeUtils.importESModule(
"resource://gre/modules/FxAccounts.sys.mjs"
).getFxAccountsSingleton();
@ -48,7 +46,7 @@ const BACKGROUND_PAGE_ACTIONS_ALLOWED = new Set([
const MAX_BUTTONS = 4;
// Array of which colorway/theme ids can be activated.
XPCOMUtils.defineLazyGetter(lazy, "COLORWAY_IDS", () =>
ChromeUtils.defineLazyGetter(lazy, "COLORWAY_IDS", () =>
[...lazy.BuiltInThemes.builtInThemeMap.keys()].filter(
id =>
id.endsWith("-colorway@mozilla.org") &&
@ -60,7 +58,7 @@ XPCOMUtils.defineLazyGetter(lazy, "COLORWAY_IDS", () =>
const TARGET_SEARCHENGINE_PREFIX = "searchEngine-";
// Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref.
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);
@ -210,7 +208,7 @@ export var UITour = {
// Lazy getter is initialized here so it can be replicated any time
// in a test.
delete this.url;
XPCOMUtils.defineLazyGetter(this, "url", function () {
ChromeUtils.defineLazyGetter(this, "url", function () {
return Services.urlFormatter.formatURLPref("browser.uitour.url");
});

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -46,7 +44,7 @@ export class MerinoClient {
*/
constructor(name = "anonymous") {
this.#name = name;
XPCOMUtils.defineLazyGetter(this, "logger", () =>
ChromeUtils.defineLazyGetter(this, "logger", () =>
lazy.UrlbarUtils.getLogger({ prefix: `MerinoClient [${name}]` })
);
}

View File

@ -63,7 +63,7 @@ let currentBrowser = () =>
let currentTab = () =>
lazy.BrowserWindowTracker.getTopWindow()?.gBrowser.selectedTab;
XPCOMUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
ChromeUtils.defineLazyGetter(lazy, "gFluentStrings", function () {
return new Localization(["branding/brand.ftl", "browser/browser.ftl"], true);
});

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
@ -92,7 +90,7 @@ export class UrlbarController {
options.eventTelemetryCategory
);
XPCOMUtils.defineLazyGetter(this, "logger", () =>
ChromeUtils.defineLazyGetter(this, "logger", () =>
lazy.UrlbarUtils.getLogger({ prefix: "Controller" })
);
}

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
@ -14,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
lazy.UrlbarUtils.getLogger({ prefix: "EventBufferer" })
);

View File

@ -206,11 +206,11 @@ export class UrlbarInput {
this._searchModeLabel = this.querySelector("#urlbar-label-search-mode");
this._toolbar = this.textbox.closest("toolbar");
XPCOMUtils.defineLazyGetter(this, "valueFormatter", () => {
ChromeUtils.defineLazyGetter(this, "valueFormatter", () => {
return new lazy.UrlbarValueFormatter(this);
});
XPCOMUtils.defineLazyGetter(this, "addSearchEngineHelper", () => {
ChromeUtils.defineLazyGetter(this, "addSearchEngineHelper", () => {
return new AddSearchEngineHelper(this);
});

View File

@ -6,8 +6,6 @@
* This module exports a component used to sort results in a UrlbarQueryContext.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import {
UrlbarMuxer,
UrlbarUtils,
@ -26,7 +24,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarSearchUtils: "resource:///modules/UrlbarSearchUtils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
UrlbarUtils.getLogger({ prefix: "MuxerUnifiedComplete" })
);

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import {
UrlbarProvider,
UrlbarUtils,
@ -23,7 +21,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarTokenizer: "resource:///modules/UrlbarTokenizer.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "appUpdater", () => new lazy.AppUpdater());
ChromeUtils.defineLazyGetter(lazy, "appUpdater", () => new lazy.AppUpdater());
// The possible tips to show. These names (except NONE) are used in the names
// of keys in the `urlbar.tips` keyed scalar telemetry (see telemetry.rst).
@ -443,7 +441,7 @@ class ProviderInterventions extends UrlbarProvider {
this.tipsShownInCurrentEngagement = new Set();
// This object is used to match the user's queries to tips.
XPCOMUtils.defineLazyGetter(this, "queryScorer", () => {
ChromeUtils.defineLazyGetter(this, "queryScorer", () => {
let queryScorer = new QueryScorer({
variations: new Map([
// Recognize "fire fox", "fox fire", and "foxfire" as "firefox".

View File

@ -103,8 +103,6 @@ const SQL_SWITCHTAB_QUERY = `SELECT :query_type, t.url, t.url, NULL, NULL, NULL,
// Getters
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import {
UrlbarProvider,
UrlbarUtils,
@ -133,7 +131,7 @@ function setTimeout(callback, ms) {
}
// Maps restriction character types to textual behaviors.
XPCOMUtils.defineLazyGetter(lazy, "typeToBehaviorMap", () => {
ChromeUtils.defineLazyGetter(lazy, "typeToBehaviorMap", () => {
return new Map([
[lazy.UrlbarTokenizer.TYPE.RESTRICT_HISTORY, "history"],
[lazy.UrlbarTokenizer.TYPE.RESTRICT_BOOKMARK, "bookmark"],
@ -145,7 +143,7 @@ XPCOMUtils.defineLazyGetter(lazy, "typeToBehaviorMap", () => {
]);
});
XPCOMUtils.defineLazyGetter(lazy, "sourceToBehaviorMap", () => {
ChromeUtils.defineLazyGetter(lazy, "sourceToBehaviorMap", () => {
return new Map([
[UrlbarUtils.RESULT_SOURCE.HISTORY, "history"],
[UrlbarUtils.RESULT_SOURCE.BOOKMARKS, "bookmark"],

View File

@ -7,8 +7,6 @@ import {
UrlbarUtils,
} from "resource:///modules/UrlbarUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -25,7 +23,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
// `contextId` is a unique identifier used by Contextual Services
const CONTEXT_ID_PREF = "browser.contextual-services.contextId";
XPCOMUtils.defineLazyGetter(lazy, "contextId", () => {
ChromeUtils.defineLazyGetter(lazy, "contextId", () => {
let _contextId = Services.prefs.getStringPref(CONTEXT_ID_PREF, null);
if (!_contextId) {
_contextId = String(Services.uuid.generateUUID());

View File

@ -30,7 +30,7 @@ let _cache = null;
// are found.
const RECENT_REMOTE_TAB_THRESHOLD_MS = 72 * 60 * 60 * 1000; // 72 hours.
XPCOMUtils.defineLazyGetter(lazy, "weaveXPCService", function () {
ChromeUtils.defineLazyGetter(lazy, "weaveXPCService", function () {
try {
return Cc["@mozilla.org/weave/service;1"].getService(
Ci.nsISupports

View File

@ -27,7 +27,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
setTimeout: "resource://gre/modules/Timer.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "updateManager", () => {
ChromeUtils.defineLazyGetter(lazy, "updateManager", () => {
return (
Cc["@mozilla.org/updates/update-manager;1"] &&
Cc["@mozilla.org/updates/update-manager;1"].getService(Ci.nsIUpdateManager)

View File

@ -7,8 +7,6 @@
* the connection between such providers and a UrlbarController.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -23,7 +21,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
lazy.UrlbarUtils.getLogger({ prefix: "ProvidersManager" })
);

View File

@ -8,14 +8,12 @@
* of UrlbarTokenizer.TYPE.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
UrlbarUtils: "resource:///modules/UrlbarUtils.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
lazy.UrlbarUtils.getLogger({ prefix: "Tokenizer" })
);

View File

@ -7,8 +7,6 @@
* helper functions that are useful to all components of the urlbar.
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -1472,11 +1470,11 @@ export var UrlbarUtils = {
},
};
XPCOMUtils.defineLazyGetter(UrlbarUtils.ICON, "DEFAULT", () => {
ChromeUtils.defineLazyGetter(UrlbarUtils.ICON, "DEFAULT", () => {
return lazy.PlacesUtils.favicons.defaultFavicon.spec;
});
XPCOMUtils.defineLazyGetter(UrlbarUtils, "strings", () => {
ChromeUtils.defineLazyGetter(UrlbarUtils, "strings", () => {
return Services.strings.createBundle(
"chrome://global/locale/autocomplete.properties"
);
@ -2151,7 +2149,7 @@ export class UrlbarMuxer {
*/
export class UrlbarProvider {
constructor() {
XPCOMUtils.defineLazyGetter(this, "logger", () =>
ChromeUtils.defineLazyGetter(this, "logger", () =>
UrlbarUtils.getLogger({ prefix: `Provider.${this.name}` })
);
}

View File

@ -2,7 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs";
const lazy = {};
@ -19,7 +18,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
QuarantinedDomains: "resource://gre/modules/ExtensionPermissions.sys.mjs",
});
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"l10n",
() =>

View File

@ -2,11 +2,9 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "l10n", () => {
ChromeUtils.defineLazyGetter(lazy, "l10n", () => {
return new Localization(
["browser/tabbrowser.ftl", "branding/brand.ftl"],
true

View File

@ -21,13 +21,13 @@ XPCOMUtils.defineLazyPreferenceGetter(
const NAMESPACE_CONTEXUAL_SERVICES = "contextual-services";
// PingCentre client to send custom pings
XPCOMUtils.defineLazyGetter(lazy, "pingcentre", () => {
ChromeUtils.defineLazyGetter(lazy, "pingcentre", () => {
return new lazy.PingCentre({ topic: "contextual-services" });
});
// `contextId` is a unique identifier used by Contextual Services
const CONTEXT_ID_PREF = "browser.contextual-services.contextId";
XPCOMUtils.defineLazyGetter(lazy, "contextId", () => {
ChromeUtils.defineLazyGetter(lazy, "contextId", () => {
let _contextId = Services.prefs.getStringPref(CONTEXT_ID_PREF, null);
if (!_contextId) {
_contextId = String(Services.uuid.generateUUID());

View File

@ -86,7 +86,7 @@ XPCOMUtils.defineLazyServiceGetter(
"@mozilla.org/content-pref/service;1",
"nsIContentPrefService2"
);
XPCOMUtils.defineLazyGetter(lazy, "gBrowserBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gBrowserBundle", function () {
return Services.strings.createBundle(
"chrome://browser/locale/browser.properties"
);

View File

@ -2,17 +2,15 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "gStringBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gStringBundle", function () {
return Services.strings.createBundle(
"chrome://browser/locale/siteData.properties"
);
});
XPCOMUtils.defineLazyGetter(lazy, "gBrandBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "gBrandBundle", function () {
return Services.strings.createBundle(
"chrome://branding/locale/brand.properties"
);

View File

@ -5,7 +5,6 @@
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { BrowserUtils } from "resource://gre/modules/BrowserUtils.sys.mjs";
import { PrivateBrowsingUtils } from "resource://gre/modules/PrivateBrowsingUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -14,7 +13,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "ReferrerInfo", () =>
ChromeUtils.defineLazyGetter(lazy, "ReferrerInfo", () =>
Components.Constructor(
"@mozilla.org/referrer-info;1",
"nsIReferrerInfo",

View File

@ -33,11 +33,11 @@ const lazy = {};
* Smart getters
*/
XPCOMUtils.defineLazyGetter(lazy, "_prefs", function () {
ChromeUtils.defineLazyGetter(lazy, "_prefs", function () {
return Services.prefs.getBranch(PREF_TASKBAR_BRANCH);
});
XPCOMUtils.defineLazyGetter(lazy, "_stringBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "_stringBundle", function () {
return Services.strings.createBundle(
"chrome://browser/locale/taskbar.properties"
);

View File

@ -156,7 +156,7 @@ function PreviewController(win, tab) {
this.tab.addEventListener("TabAttrModified", this);
XPCOMUtils.defineLazyGetter(this, "canvasPreview", function () {
ChromeUtils.defineLazyGetter(this, "canvasPreview", function () {
let canvas = lazy.PageThumbs.createCanvas(this.win.win);
canvas.mozOpaque = true;
return canvas;
@ -884,7 +884,7 @@ export var AeroPeek = {
]),
};
XPCOMUtils.defineLazyGetter(AeroPeek, "cacheTimer", () =>
ChromeUtils.defineLazyGetter(AeroPeek, "cacheTimer", () =>
Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
);

View File

@ -11,12 +11,12 @@ ChromeUtils.defineESModuleGetters(lazy, {
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs",
SitePermissions: "resource:///modules/SitePermissions.sys.mjs",
});
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"syncL10n",
() => new Localization(["browser/webrtcIndicator.ftl"], true)
);
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"listFormat",
() => new Services.intl.ListFormat(undefined)

View File

@ -3,14 +3,13 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { setTimeout } from "resource://gre/modules/Timer.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
// Create a new instance of the ConsoleAPI so we can control the maxLogLevel with a pref.
// See LOG_LEVELS in Console.sys.mjs. Common examples: "All", "Info", "Warn", &
// "Error".
const PREF_LOG_LEVEL = "extensions.mozscreenshots@mozilla.org.loglevel";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "log", () => {
ChromeUtils.defineLazyGetter(lazy, "log", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -4,7 +4,6 @@
import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs";
import * as Loader from "resource://devtools/shared/loader/Loader.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -59,7 +58,7 @@ export class DevToolsFrameChild extends JSWindowActorChild {
// If the page we navigate from supports being stored in bfcache,
// the navigation will use a new BrowsingContext. And so force spawning
// a new top-level target.
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
this,
"isBfcacheInParentEnabled",
() =>

View File

@ -15,11 +15,11 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIWorkerDebuggerManager"
);
XPCOMUtils.defineLazyGetter(lazy, "Loader", () =>
ChromeUtils.defineLazyGetter(lazy, "Loader", () =>
ChromeUtils.importESModule("resource://devtools/shared/loader/Loader.sys.mjs")
);
XPCOMUtils.defineLazyGetter(lazy, "DevToolsUtils", () =>
ChromeUtils.defineLazyGetter(lazy, "DevToolsUtils", () =>
lazy.Loader.require("resource://devtools/shared/DevToolsUtils.js")
);
XPCOMUtils.defineLazyModuleGetters(lazy, {

View File

@ -60,8 +60,6 @@
* Mihai Sucan (Mozilla Corp.)
*/
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -73,7 +71,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
// It would make sense to put this in the above
// ChromeUtils.defineESModuleGetters, but that doesn't seem to work.
XPCOMUtils.defineLazyGetter(lazy, "certDecoder", () => {
ChromeUtils.defineLazyGetter(lazy, "certDecoder", () => {
const { parse, pemToDER } = ChromeUtils.importESModule(
"chrome://global/content/certviewer/certDecoder.mjs"
);

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -11,7 +9,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
"resource://devtools/shared/network-observer/NetworkHelper.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "tpFlagsMask", () => {
ChromeUtils.defineLazyGetter(lazy, "tpFlagsMask", () => {
const trackingProtectionLevel2Enabled = Services.prefs
.getStringPref("urlclassifier.trackingTable")
.includes("content-track-digest256");

View File

@ -2,10 +2,8 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "DevToolsStartup", () => {
ChromeUtils.defineLazyGetter(lazy, "DevToolsStartup", () => {
return Cc["@mozilla.org/devtools/startup-clh;1"].getService(
Ci.nsICommandLineHandler
).wrappedJSObject;
@ -13,7 +11,7 @@ XPCOMUtils.defineLazyGetter(lazy, "DevToolsStartup", () => {
// We don't want to spend time initializing the full loader here so we create
// our own lazy require.
XPCOMUtils.defineLazyGetter(lazy, "Telemetry", function () {
ChromeUtils.defineLazyGetter(lazy, "Telemetry", function () {
const { require } = ChromeUtils.importESModule(
"resource://devtools/shared/loader/Loader.sys.mjs"
);

View File

@ -27,8 +27,6 @@ const kDebuggerPrefs = [
const DEVTOOLS_POLICY_DISABLED_PREF = "devtools.policy.disabled";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const lazy = {};
@ -47,7 +45,7 @@ ChromeUtils.defineModuleGetter(
// We don't want to spend time initializing the full loader here so we create
// our own lazy require.
XPCOMUtils.defineLazyGetter(lazy, "Telemetry", function () {
ChromeUtils.defineLazyGetter(lazy, "Telemetry", function () {
const { require } = ChromeUtils.importESModule(
"resource://devtools/shared/loader/Loader.sys.mjs"
);
@ -57,7 +55,7 @@ XPCOMUtils.defineLazyGetter(lazy, "Telemetry", function () {
return Telemetry;
});
XPCOMUtils.defineLazyGetter(lazy, "KeyShortcutsBundle", function () {
ChromeUtils.defineLazyGetter(lazy, "KeyShortcutsBundle", function () {
return new Localization(["devtools/startup/key-shortcuts.ftl"], true);
});
@ -83,7 +81,7 @@ function getLocalizedKeyShortcut(id) {
}
}
XPCOMUtils.defineLazyGetter(lazy, "KeyShortcuts", function () {
ChromeUtils.defineLazyGetter(lazy, "KeyShortcuts", function () {
const isMac = AppConstants.platform == "macosx";
// Common modifier shared by most key shortcuts
@ -291,7 +289,7 @@ export function validateProfilerWebChannelUrl(targetUrl) {
return frontEndUrl;
}
XPCOMUtils.defineLazyGetter(lazy, "ProfilerPopupBackground", function () {
ChromeUtils.defineLazyGetter(lazy, "ProfilerPopupBackground", function () {
return ChromeUtils.import(
"resource://devtools/client/performance-new/shared/background.jsm.js"
);

View File

@ -102,20 +102,20 @@ const COMMON_PROTOCOLS = ["http", "https", "file"];
// Regex used to identify user:password tokens in url strings.
// This is not a strict valid characters check, because we try to fixup this
// part of the url too.
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"userPasswordRegex",
() => /^([a-z+.-]+:\/{0,3})*([^\/@]+@).+/i
);
// Regex used to identify the string that starts with port expression.
XPCOMUtils.defineLazyGetter(lazy, "portRegex", () => /^:\d{1,5}([?#/]|$)/);
ChromeUtils.defineLazyGetter(lazy, "portRegex", () => /^:\d{1,5}([?#/]|$)/);
// Regex used to identify numbers.
XPCOMUtils.defineLazyGetter(lazy, "numberRegex", () => /^[0-9]+(\.[0-9]+)?$/);
ChromeUtils.defineLazyGetter(lazy, "numberRegex", () => /^[0-9]+(\.[0-9]+)?$/);
// Regex used to identify tab separated content (having at least 2 tabs).
XPCOMUtils.defineLazyGetter(lazy, "maxOneTabRegex", () => /^[^\t]*\t?[^\t]*$/);
ChromeUtils.defineLazyGetter(lazy, "maxOneTabRegex", () => /^[^\t]*\t?[^\t]*$/);
// Regex used to test if a string with a protocol might instead be a url
// without a protocol but with a port:
@ -134,20 +134,20 @@ XPCOMUtils.defineLazyGetter(lazy, "maxOneTabRegex", () => /^[^\t]*\t?[^\t]*$/);
//
// Note: Parser could be a lot tighter, tossing out silly hostnames
// such as those containing consecutive dots and so on.
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"possiblyHostPortRegex",
() => /^[a-z0-9-]+(\.[a-z0-9-]+)*:[0-9]{1,5}([/?#]|$)/i
);
// Regex used to strip newlines.
XPCOMUtils.defineLazyGetter(lazy, "newLinesRegex", () => /[\r\n]/g);
ChromeUtils.defineLazyGetter(lazy, "newLinesRegex", () => /[\r\n]/g);
// Regex used to match a possible protocol.
// This resembles the logic in Services.io.extractScheme, thus \t is admitted
// and stripped later. We don't use Services.io.extractScheme because of
// performance bottleneck caused by crossing XPConnect.
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"possibleProtocolRegex",
() => /^([a-z][a-z0-9.+\t-]*)(:|;)?(\/\/)?/i
@ -156,12 +156,12 @@ XPCOMUtils.defineLazyGetter(
// Regex used to match IPs. Note that these are not made to validate IPs, but
// just to detect strings that look like an IP. They also skip protocol.
// For IPv4 this also accepts a shorthand format with just 2 dots.
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"IPv4LikeRegex",
() => /^(?:[a-z+.-]+:\/*(?!\/))?(?:\d{1,3}\.){2,3}\d{1,3}(?::\d+|\/)?/i
);
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
lazy,
"IPv6LikeRegex",
() =>
@ -169,7 +169,7 @@ XPCOMUtils.defineLazyGetter(
);
// Cache of known domains.
XPCOMUtils.defineLazyGetter(lazy, "knownDomains", () => {
ChromeUtils.defineLazyGetter(lazy, "knownDomains", () => {
const branch = "browser.fixup.domainwhitelist.";
let domains = new Set(
Services.prefs
@ -206,7 +206,7 @@ XPCOMUtils.defineLazyGetter(lazy, "knownDomains", () => {
// When searching we can restrict the linear scan based on the last part.
// The ideal structure for this would be a Directed Acyclic Word Graph, but
// since we expect this list to be small it's not worth the complication.
XPCOMUtils.defineLazyGetter(lazy, "knownSuffixes", () => {
ChromeUtils.defineLazyGetter(lazy, "knownSuffixes", () => {
const branch = "browser.fixup.domainsuffixwhitelist.";
let suffixes = new Map();
let prefs = Services.prefs

View File

@ -8,7 +8,7 @@ import { DOMRequestIpcHelper } from "resource://gre/modules/DOMRequestHelper.sys
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
ChromeUtils.defineLazyGetter(lazy, "console", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
JSONFile: "resource://gre/modules/JSONFile.sys.mjs",
@ -14,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
// We are supposed to ignore any updates with this version.
const DUMMY_VERSION_STRING = "____NOP____";
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
ChromeUtils.defineLazyGetter(lazy, "console", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -15,7 +15,7 @@ var isParent =
const lazy = {};
// The default Push service implementation.
XPCOMUtils.defineLazyGetter(lazy, "PushService", function () {
ChromeUtils.defineLazyGetter(lazy, "PushService", function () {
if (Services.prefs.getBoolPref("dom.push.enabled")) {
const { PushService } = ChromeUtils.importESModule(
"resource://gre/modules/PushService.sys.mjs"

View File

@ -2,11 +2,9 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "gDOMBundle", () =>
ChromeUtils.defineLazyGetter(lazy, "gDOMBundle", () =>
Services.strings.createBundle("chrome://global/locale/dom/dom.properties")
);

View File

@ -3,11 +3,10 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
import { IndexedDBHelper } from "resource://gre/modules/IndexedDBHelper.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
ChromeUtils.defineLazyGetter(lazy, "console", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -36,7 +36,7 @@ const CONNECTION_PROTOCOLS = (function () {
return [];
})();
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
ChromeUtils.defineLazyGetter(lazy, "console", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -4,7 +4,6 @@
import { PushDB } from "resource://gre/modules/PushDB.sys.mjs";
import { PushRecord } from "resource://gre/modules/PushRecord.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { NetUtil } from "resource://gre/modules/NetUtil.sys.mjs";
import { clearTimeout, setTimeout } from "resource://gre/modules/Timer.sys.mjs";
@ -13,7 +12,7 @@ import { PushCrypto } from "resource://gre/modules/PushCrypto.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
ChromeUtils.defineLazyGetter(lazy, "console", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { PushDB } from "resource://gre/modules/PushDB.sys.mjs";
import { PushRecord } from "resource://gre/modules/PushRecord.sys.mjs";
import { PushCrypto } from "resource://gre/modules/PushCrypto.sys.mjs";
@ -45,7 +43,7 @@ const kDELIVERY_REASON_TO_CODE = {
const prefs = Services.prefs.getBranch("dom.push.");
XPCOMUtils.defineLazyGetter(lazy, "console", () => {
ChromeUtils.defineLazyGetter(lazy, "console", () => {
let { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"
);

View File

@ -383,7 +383,7 @@ export var XPCOMUtils = {
},
};
XPCOMUtils.defineLazyGetter(XPCOMUtils, "_scriptloader", () => {
ChromeUtils.defineLazyGetter(XPCOMUtils, "_scriptloader", () => {
return Services.scriptloader;
});

View File

@ -3,7 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -12,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
GeckoViewPrompter: "resource://gre/modules/GeckoViewPrompter.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "LoginInfo", () =>
ChromeUtils.defineLazyGetter(lazy, "LoginInfo", () =>
Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1",
"nsILoginInfo",

View File

@ -3,7 +3,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
import { GeckoViewModule } from "resource://gre/modules/GeckoViewModule.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
@ -13,7 +12,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
LoadURIDelegate: "resource://gre/modules/LoadURIDelegate.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "ReferrerInfo", () =>
ChromeUtils.defineLazyGetter(lazy, "ReferrerInfo", () =>
Components.Constructor(
"@mozilla.org/referrer-info;1",
"nsIReferrerInfo",

View File

@ -2,24 +2,23 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { GeckoViewUtils } from "resource://gre/modules/GeckoViewUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "require", () => {
ChromeUtils.defineLazyGetter(lazy, "require", () => {
const { require } = ChromeUtils.importESModule(
"resource://devtools/shared/loader/Loader.sys.mjs"
);
return require;
});
XPCOMUtils.defineLazyGetter(lazy, "DevToolsServer", () => {
ChromeUtils.defineLazyGetter(lazy, "DevToolsServer", () => {
const { DevToolsServer } = lazy.require("devtools/server/devtools-server");
return DevToolsServer;
});
XPCOMUtils.defineLazyGetter(lazy, "SocketListener", () => {
ChromeUtils.defineLazyGetter(lazy, "SocketListener", () => {
const { SocketListener } = lazy.require("devtools/shared/security/socket");
return SocketListener;
});

View File

@ -3,24 +3,23 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
import { GeckoViewModule } from "resource://gre/modules/GeckoViewModule.sys.mjs";
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
XPCOMUtils.defineLazyGetter(lazy, "MOBILE_USER_AGENT", function () {
ChromeUtils.defineLazyGetter(lazy, "MOBILE_USER_AGENT", function () {
return Cc["@mozilla.org/network/protocol;1?name=http"].getService(
Ci.nsIHttpProtocolHandler
).userAgent;
});
XPCOMUtils.defineLazyGetter(lazy, "DESKTOP_USER_AGENT", function () {
ChromeUtils.defineLazyGetter(lazy, "DESKTOP_USER_AGENT", function () {
return lazy.MOBILE_USER_AGENT.replace(
/Android \d.+?; [a-zA-Z]+/,
"X11; Linux x86_64"
).replace(/Gecko\/[0-9\.]+/, "Gecko/20100101");
});
XPCOMUtils.defineLazyGetter(lazy, "VR_USER_AGENT", function () {
ChromeUtils.defineLazyGetter(lazy, "VR_USER_AGENT", function () {
return lazy.MOBILE_USER_AGENT.replace(/Mobile/, "Mobile VR");
});

View File

@ -2,7 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { Log } from "resource://gre/modules/Log.sys.mjs";
const lazy = {};
@ -83,7 +82,7 @@ export var GeckoViewUtils = {
name,
{ service, module, handler, observers, ppmm, mm, ged, init, once }
) {
XPCOMUtils.defineLazyGetter(scope, name, _ => {
ChromeUtils.defineLazyGetter(scope, name, _ => {
let ret = undefined;
if (module) {
ret = ChromeUtils.importESModule(module)[name];
@ -401,7 +400,7 @@ export var GeckoViewUtils = {
const log = (strings, ...exprs) =>
this._log(log.logger, level, strings, exprs);
XPCOMUtils.defineLazyGetter(log, "logger", _ => {
ChromeUtils.defineLazyGetter(log, "logger", _ => {
const logger = Log.repository.getLogger(tag);
logger.parent = this.rootLogger;
return logger;
@ -504,7 +503,7 @@ export var GeckoViewUtils = {
},
};
XPCOMUtils.defineLazyGetter(
ChromeUtils.defineLazyGetter(
GeckoViewUtils,
"IS_PARENT_PROCESS",
_ => Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
@ -14,10 +12,10 @@ ChromeUtils.defineESModuleGetters(lazy, {
TargetList: "chrome://remote/content/cdp/targets/TargetList.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.CDP)
);
XPCOMUtils.defineLazyGetter(lazy, "textEncoder", () => new TextEncoder());
ChromeUtils.defineLazyGetter(lazy, "textEncoder", () => new TextEncoder());
// Map of CDP-specific preferences that should be set via
// RecommendedPreferences.

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { WebSocketConnection } from "chrome://remote/content/shared/WebSocketConnection.sys.mjs";
const lazy = {};
@ -13,7 +11,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
UnknownMethodError: "chrome://remote/content/cdp/Error.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.CDP)
);

View File

@ -2,15 +2,13 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
Log: "chrome://remote/content/shared/Log.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.CDP)
);

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { addDebuggerToGlobal } from "resource://gre/modules/jsdebugger.sys.mjs";
import { ContentProcessDomain } from "chrome://remote/content/cdp/domains/ContentProcessDomain.sys.mjs";
@ -17,7 +15,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
"chrome://remote/content/cdp/domains/content/runtime/ExecutionContext.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "ConsoleAPIStorage", () => {
ChromeUtils.defineLazyGetter(lazy, "ConsoleAPIStorage", () => {
return Cc["@mozilla.org/consoleAPI-storage;1"].getService(
Ci.nsIConsoleAPIStorage
);

View File

@ -24,7 +24,7 @@ XPCOMUtils.defineLazyServiceGetter(
const CC = Components.Constructor;
XPCOMUtils.defineLazyGetter(lazy, "BinaryInputStream", () => {
ChromeUtils.defineLazyGetter(lazy, "BinaryInputStream", () => {
return CC(
"@mozilla.org/binaryinputstream;1",
"nsIBinaryInputStream",
@ -32,7 +32,7 @@ XPCOMUtils.defineLazyGetter(lazy, "BinaryInputStream", () => {
);
});
XPCOMUtils.defineLazyGetter(lazy, "BinaryOutputStream", () => {
ChromeUtils.defineLazyGetter(lazy, "BinaryOutputStream", () => {
return CC(
"@mozilla.org/binaryoutputstream;1",
"nsIBinaryOutputStream",
@ -40,7 +40,7 @@ XPCOMUtils.defineLazyGetter(lazy, "BinaryOutputStream", () => {
);
});
XPCOMUtils.defineLazyGetter(lazy, "StorageStream", () => {
ChromeUtils.defineLazyGetter(lazy, "StorageStream", () => {
return CC("@mozilla.org/storagestream;1", "nsIStorageStream", "init");
});

View File

@ -2,8 +2,6 @@
* 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/. */
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { Session } from "chrome://remote/content/cdp/sessions/Session.sys.mjs";
const lazy = {};
@ -12,7 +10,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
Log: "chrome://remote/content/shared/Log.sys.mjs",
});
XPCOMUtils.defineLazyGetter(lazy, "logger", () =>
ChromeUtils.defineLazyGetter(lazy, "logger", () =>
lazy.Log.get(lazy.Log.TYPES.CDP)
);

Some files were not shown because too many files have changed in this diff Show More