diff --git a/toolkit/modules/GMPUtils.jsm b/toolkit/modules/GMPUtils.jsm index f0075eabc86f..fca759110f78 100644 --- a/toolkit/modules/GMPUtils.jsm +++ b/toolkit/modules/GMPUtils.jsm @@ -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" ); diff --git a/toolkit/modules/UpdateUtils.jsm b/toolkit/modules/UpdateUtils.jsm index a1a2ac7898fb..360217be87ff 100644 --- a/toolkit/modules/UpdateUtils.jsm +++ b/toolkit/modules/UpdateUtils.jsm @@ -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"]; diff --git a/toolkit/mozapps/extensions/internal/GMPProvider.jsm b/toolkit/mozapps/extensions/internal/GMPProvider.jsm index faeef3f1e7c7..b1ac435e6f75 100644 --- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm +++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm @@ -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";