From 3195265a713ecb096890db9597d7bd1eabdd3b64 Mon Sep 17 00:00:00 2001 From: Bilal Date: Thu, 23 Mar 2023 03:33:35 +0000 Subject: [PATCH] Bug 1816991 - ESMified installerprefs JSM. r=kpatenio Differential Revision: https://phabricator.services.mozilla.com/D173316 --- .../{InstallerPrefs.jsm => InstallerPrefs.sys.mjs} | 12 +++--------- browser/components/installerprefs/components.conf | 2 +- browser/components/installerprefs/moz.build | 2 +- browser/components/installerprefs/test/unit/head.js | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) rename browser/components/installerprefs/{InstallerPrefs.jsm => InstallerPrefs.sys.mjs} (94%) diff --git a/browser/components/installerprefs/InstallerPrefs.jsm b/browser/components/installerprefs/InstallerPrefs.sys.mjs similarity index 94% rename from browser/components/installerprefs/InstallerPrefs.jsm rename to browser/components/installerprefs/InstallerPrefs.sys.mjs index 668f25c12f1b..042178e80705 100644 --- a/browser/components/installerprefs/InstallerPrefs.jsm +++ b/browser/components/installerprefs/InstallerPrefs.sys.mjs @@ -32,17 +32,13 @@ const INSTALLER_PREFS_BRANCH = "installer."; // any others will be ignored. const INSTALLER_PREFS_LIST = ["installer.taskbarpin.win10.enabled"]; -const { AppConstants } = ChromeUtils.importESModule( - "resource://gre/modules/AppConstants.sys.mjs" -); -const { XPCOMUtils } = ChromeUtils.importESModule( - "resource://gre/modules/XPCOMUtils.sys.mjs" -); +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 // to leave the parameter omitted/undefined. -function InstallerPrefs(prefsList) { +export function InstallerPrefs(prefsList) { this.prefsList = prefsList || INSTALLER_PREFS_LIST; // Each pref to be reflected will get a value created under this key, in HKCU. @@ -144,5 +140,3 @@ InstallerPrefs.prototype = { return key; }, }; - -var EXPORTED_SYMBOLS = ["InstallerPrefs"]; diff --git a/browser/components/installerprefs/components.conf b/browser/components/installerprefs/components.conf index 2bd525f0b00b..35be4ec2e310 100644 --- a/browser/components/installerprefs/components.conf +++ b/browser/components/installerprefs/components.conf @@ -8,7 +8,7 @@ Classes = [ { 'cid': '{cd8a6995-1f19-4cdd-9ed1-d6263302f594}', 'contract_ids': ['@mozilla.org/installerprefs;1'], - 'jsm': 'resource:///modules/InstallerPrefs.jsm', + 'esModule': 'resource:///modules/InstallerPrefs.sys.mjs', 'constructor': 'InstallerPrefs', 'categories': {'profile-after-change': 'InstallerPrefs'}, 'processes': ProcessSelector.MAIN_PROCESS_ONLY, diff --git a/browser/components/installerprefs/moz.build b/browser/components/installerprefs/moz.build index 853f2d888a80..a93c41fdeaa5 100644 --- a/browser/components/installerprefs/moz.build +++ b/browser/components/installerprefs/moz.build @@ -10,7 +10,7 @@ with Files("**"): XPCSHELL_TESTS_MANIFESTS += ["test/unit/xpcshell.ini"] EXTRA_JS_MODULES += [ - "InstallerPrefs.jsm", + "InstallerPrefs.sys.mjs", ] XPCOM_MANIFESTS += [ diff --git a/browser/components/installerprefs/test/unit/head.js b/browser/components/installerprefs/test/unit/head.js index 3d00a2437f86..5c989fb309cf 100644 --- a/browser/components/installerprefs/test/unit/head.js +++ b/browser/components/installerprefs/test/unit/head.js @@ -7,8 +7,8 @@ const { AppConstants } = ChromeUtils.importESModule( "resource://gre/modules/AppConstants.sys.mjs" ); -const { InstallerPrefs } = ChromeUtils.import( - "resource:///modules/InstallerPrefs.jsm" +const { InstallerPrefs } = ChromeUtils.importESModule( + "resource:///modules/InstallerPrefs.sys.mjs" ); let gRegistryKeyPath = "";