Bug 1733485 - Lazy load modules in GMPUtils.jsm, UpdateUtils.jsm, GMPProvider.jsm to avoid loading earlier than necessary. r=bytesized

Differential Revision: https://phabricator.services.mozilla.com/D127171
This commit is contained in:
Mark Banner 2021-10-01 08:18:04 +00:00
parent 7ee3993e66
commit aec46f6b9d
3 changed files with 34 additions and 42 deletions

View File

@ -12,11 +12,19 @@ var EXPORTED_SYMBOLS = [
"WIDEVINE_ID",
];
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { AppConstants } = ChromeUtils.import(
ChromeUtils.defineModuleGetter(
this,
"Services",
"resource://gre/modules/Services.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"AppConstants",
"resource://gre/modules/AppConstants.jsm"
);
const { UpdateUtils } = ChromeUtils.import(
ChromeUtils.defineModuleGetter(
this,
"UpdateUtils",
"resource://gre/modules/UpdateUtils.jsm"
);

View File

@ -5,30 +5,22 @@
var EXPORTED_SYMBOLS = ["UpdateUtils"];
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 { FileUtils } = ChromeUtils.import(
"resource://gre/modules/FileUtils.jsm"
);
const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { ctypes } = ChromeUtils.import("resource://gre/modules/ctypes.jsm");
ChromeUtils.defineModuleGetter(
this,
"WindowsVersionInfo",
"resource://gre/modules/components-utils/WindowsVersionInfo.jsm"
);
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]); /* globals fetch */
ChromeUtils.defineModuleGetter(
this,
"WindowsRegistry",
"resource://gre/modules/WindowsRegistry.jsm"
);
XPCOMUtils.defineLazyModuleGetters(this, {
AppConstants: "resource://gre/modules/AppConstants.jsm",
ctypes: "resource://gre/modules/ctypes.jsm",
FileUtils: "resource://gre/modules/FileUtils.jsm",
OS: "resource://gre/modules/osfile.jsm",
Services: "resource://gre/modules/Services.jsm",
WindowsRegistry: "resource://gre/modules/WindowsRegistry.jsm",
WindowsVersionInfo:
"resource://gre/modules/components-utils/WindowsVersionInfo.jsm",
});
XPCOMUtils.defineLazyGlobalGetters(this, ["fetch"]);
const PER_INSTALLATION_PREFS_PLATFORMS = ["win"];

View File

@ -9,30 +9,22 @@ var EXPORTED_SYMBOLS = [];
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
);
const { AddonManager, AddonManagerPrivate } = ChromeUtils.import(
"resource://gre/modules/AddonManager.jsm"
);
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { Log } = ChromeUtils.import("resource://gre/modules/Log.jsm");
XPCOMUtils.defineLazyModuleGetters(this, {
AddonManager: "resource://gre/modules/AddonManager.jsm",
AddonManagerPrivate: "resource://gre/modules/AddonManager.jsm",
AppConstants: "resource://gre/modules/AppConstants.jsm",
Log: "resource://gre/modules/Log.jsm",
GMPInstallManager: "resource://gre/modules/GMPInstallManager.jsm",
Services: "resource://gre/modules/Services.jsm",
setTimeout: "resource://gre/modules/Timer.jsm",
});
// These symbols are, unfortunately, accessed via the module global from
// tests, and therefore cannot be lexical definitions.
var { GMPPrefs, GMPUtils, OPEN_H264_ID, WIDEVINE_ID } = ChromeUtils.import(
"resource://gre/modules/GMPUtils.jsm"
);
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"GMPInstallManager",
"resource://gre/modules/GMPInstallManager.jsm"
);
ChromeUtils.defineModuleGetter(
this,
"setTimeout",
"resource://gre/modules/Timer.jsm"
);
const URI_EXTENSION_STRINGS =
"chrome://mozapps/locale/extensions/extensions.properties";