Bug 1836657 - Port bug 1824613: Convert consumers of toolkit/mozapps/extensions/AddonManger.sys.mjs to import ES modules directly. r=freaktechnik

Differential Revision: https://phabricator.services.mozilla.com/D179955

--HG--
extra : amend_source : 4ec13163d64f2d33b4a2f5870cb4c391991cce3c
This commit is contained in:
John Bieling 2023-06-06 13:59:18 +00:00
Родитель fcb127c61d
Коммит aa816feba0
20 изменённых файлов: 43 добавлений и 57 удалений

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

@ -15,7 +15,7 @@
refreshEventTree, gCurrentMode, InitMessageMenu, onViewToolbarsPopupShowing,
onCommandCustomize, CustomizeMailToolbar */
var { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
var { AddonManager } = ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs");
var { AppConstants } = ChromeUtils.importESModule("resource://gre/modules/AppConstants.sys.mjs");
var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
var { calendarDeactivator } = ChromeUtils.import(

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

@ -6,7 +6,7 @@
var EXPORTED_SYMBOLS = ["CalCalendarManager"];
const { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
const { AddonManager } = ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs");
const { Preferences } = ChromeUtils.importESModule("resource://gre/modules/Preferences.sys.mjs");
const { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
const { calCachedCalendar } = ChromeUtils.import("resource:///components/calCachedCalendar.js");

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

@ -24,11 +24,12 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
);
ChromeUtils.defineESModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
BrowserToolboxLauncher:
"resource://devtools/client/framework/browser-toolbox/Launcher.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
MailUtils: "resource:///modules/MailUtils.jsm",
MimeParser: "resource:///modules/mimeParser.jsm",
UIDensity: "resource:///modules/UIDensity.jsm",

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

@ -3,8 +3,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/. */
var { AddonManager } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
var { AddonManager } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
var AutoHideMenubar = {

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

@ -12,8 +12,8 @@
var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
var { AddonManager } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
var { AddonManager } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
var { ExtensionParent } = ChromeUtils.import(
"resource://gre/modules/ExtensionParent.jsm"

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

@ -1,6 +1,6 @@
/* eslint-disable mozilla/no-arbitrary-setTimeout */
const { AddonManagerPrivate } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
const { AddonManagerPrivate } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
var { AddonTestUtils } = ChromeUtils.importESModule(

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

@ -1,5 +1,5 @@
const { AddonManagerPrivate } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
const { AddonManagerPrivate } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
var { AddonTestUtils } = ChromeUtils.importESModule(

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

@ -1,5 +1,5 @@
const { AddonManagerPrivate } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
const { AddonManagerPrivate } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
var { AddonTestUtils } = ChromeUtils.importESModule(

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

@ -35,6 +35,7 @@ if (AppConstants.NIGHTLY_BUILD) {
ChromeUtils.defineESModuleGetters(lazy, {
ActorManagerParent: "resource://gre/modules/ActorManagerParent.sys.mjs",
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
ChatCore: "resource:///modules/chatHandler.sys.mjs",
LightweightThemeConsumer:
@ -47,7 +48,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
cal: "resource:///modules/calendar/calUtils.jsm",
ExtensionSupport: "resource:///modules/ExtensionSupport.jsm",
MailMigrator: "resource:///modules/MailMigrator.jsm",
@ -622,8 +622,8 @@ MailGlue.prototype = {
// updates.
let currentVersion = Services.appinfo.version;
if (this.previousVersion != "0" && this.previousVersion != currentVersion) {
let { AddonManager } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
let { AddonManager } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
let { XPIDatabase } = ChromeUtils.import(
"resource://gre/modules/addons/XPIDatabase.jsm"

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

@ -15,8 +15,8 @@ ChromeUtils.defineModuleGetter(
"resource:///modules/accountcreation/Sanitizer.jsm"
);
const { AddonManager } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
const { AddonManager } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
const { ConsoleAPI } = ChromeUtils.importESModule(
"resource://gre/modules/Console.sys.mjs"

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

@ -15,9 +15,12 @@ var { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
ChromeUtils.defineESModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(this, {
AccountConfig: "resource:///modules/accountcreation/AccountConfig.jsm",
AddonManager: "resource://gre/modules/AddonManager.jsm",
cal: "resource:///modules/calendar/calUtils.jsm",
CardDAVUtils: "resource:///modules/CardDAVUtils.jsm",
ConfigVerifier: "resource:///modules/accountcreation/ConfigVerifier.jsm",

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

@ -22,14 +22,11 @@ XPCOMUtils.defineLazyServiceGetters(lazy, {
});
ChromeUtils.defineESModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
ProxyPolicies: "resource:///modules/policies/ProxyPolicies.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
});
const PREF_LOGLEVEL = "browser.policies.loglevel";
const ABOUT_CONTRACT = "@mozilla.org/network/protocol/about;1?what=";

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

@ -7,11 +7,9 @@ ChromeUtils.defineModuleGetter(
"ExtensionSettingsStore",
"resource://gre/modules/ExtensionSettingsStore.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"AddonManager",
"resource://gre/modules/AddonManager.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
});
function enableAddon(addon) {
return new Promise(resolve => {

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

@ -8,8 +8,8 @@ var { getCachedAllowedSpaces, setCachedAllowedSpaces } = ChromeUtils.import(
var { storeState, getState } = ChromeUtils.importESModule(
"resource:///modules/CustomizationState.mjs"
);
const { AddonManager } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
const { AddonManager } = ChromeUtils.importESModule(
"resource://gre/modules/AddonManager.sys.mjs"
);
var { AddonTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/AddonTestUtils.sys.mjs"

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

@ -6,12 +6,8 @@
"use strict";
ChromeUtils.defineModuleGetter(
this,
"AddonManager",
"resource://gre/modules/AddonManager.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
DeferredTask: "resource://gre/modules/DeferredTask.sys.mjs",
});
ChromeUtils.defineModuleGetter(

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

@ -5,12 +5,8 @@
// This is exported by preferences.js but we can't import that in a subdialog.
let { getAvailableLocales } = window.top;
ChromeUtils.defineModuleGetter(
this,
"AddonManager",
"resource://gre/modules/AddonManager.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
AddonRepository: "resource://gre/modules/addons/AddonRepository.sys.mjs",
});

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

@ -30,11 +30,9 @@ var { UIFontSize } = ChromeUtils.import("resource:///modules/UIFontSize.jsm");
var paneDeck = document.getElementById("paneDeck");
var defaultPane = "paneGeneral";
ChromeUtils.defineModuleGetter(
this,
"AddonManager",
"resource://gre/modules/AddonManager.jsm"
);
ChromeUtils.defineESModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
});
XPCOMUtils.defineLazyGetter(this, "gSubDialog", function () {
const { SubDialogManager } = ChromeUtils.importESModule(

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

@ -6,11 +6,9 @@ import CUSTOMIZABLE_ITEMS from "resource:///modules/CustomizableItemsDetails.mjs
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const lazy = {};
ChromeUtils.defineModuleGetter(
lazy,
"AddonManager",
"resource://gre/modules/AddonManager.jsm"
);
ChromeUtils.defineESModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
});
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
"glodaEnabled",

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

@ -15,15 +15,16 @@ const { EventEmitter } = ChromeUtils.importESModule(
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
AMTelemetry: "resource://gre/modules/AddonManager.sys.mjs",
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
AddonManagerPrivate: "resource://gre/modules/AddonManager.sys.mjs",
AppMenuNotifications: "resource://gre/modules/AppMenuNotifications.sys.mjs",
SITEPERMS_ADDON_TYPE:
"resource://gre/modules/addons/siteperms-addon-utils.sys.mjs",
});
XPCOMUtils.defineLazyModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
AMTelemetry: "resource://gre/modules/AddonManager.jsm",
ExtensionData: "resource://gre/modules/Extension.jsm",
ExtensionParent: "resource://gre/modules/ExtensionParent.jsm",
});

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

@ -2,12 +2,10 @@
* 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.defineLazyModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
ChromeUtils.defineESModuleGetters(lazy, {
AddonManager: "resource://gre/modules/AddonManager.sys.mjs",
});
// List of themes built in to the browser. The themes are represented by objects