summaryrefslogtreecommitdiff
path: root/config.js
diff options
context:
space:
mode:
authorgirst <girst@users.noreply.github.com>2024-03-03 12:59:18 +0100
committergirst <girst@users.noreply.github.com>2024-03-03 13:18:04 +0100
commit88413358677fd59dc360076e0a62c2c559f50e38 (patch)
tree376d89eebbd27b452bc30ff7201b46047b32612a /config.js
parent25664f0b2c3238704c7509cc661d52b6b5763599 (diff)
downloadlegacywolf-88413358677fd59dc360076e0a62c2c559f50e38.tar.gz
legacywolf-88413358677fd59dc360076e0a62c2c559f50e38.zip
port legacyfox to ecmascript modules
mozilla calls this 'esm-ification'. the last relevant to us modules were ported in mozilla124[1], so this is our new minimum version. the old version will likely be compatible with firefox up to version 128esr[2]. static imports are not supported in autoconfig scripts. i tried to keep the diff as small as possible w.r.t comm-central's final JSMs. because of this, we don't lazy-load any modules any more, nor provide any lazy getters, as they would need to be loaded into a `lazy` object instead the global (`this`) namespace, causing more churn. other than that, the largest change was removing the now-useless Services.jsm workaround as well as removing globalGetters for objects already loaded automatically. [1]: https://hg.mozilla.org/mozilla-central/rev/68ba071ff6fb9978937496f9adc48e378957f594 [2]: bugzil.la/1881890
Diffstat (limited to 'config.js')
-rw-r--r--config.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/config.js b/config.js
index 993c6ff..07662f7 100644
--- a/config.js
+++ b/config.js
@@ -1,16 +1,15 @@
// keep this comment
try {
- let {XPIDatabase} = Cu.import('resource://gre/modules/addons/XPIDatabase.jsm', {});
+ let {XPIDatabase} = ChromeUtils.importESModule('resource://gre/modules/addons/XPIDatabase.sys.mjs');
XPIDatabase.isDisabledLegacy = (addon) => false;
XPIDatabase.mustSign = (aType) => false;
- const Services = globalThis.Services || Cu.import("resource://gre/modules/Services.jsm").Services;
let manifest = Services.dirsvc.get('GreD', Ci.nsIFile);
manifest.append('legacy.manifest');
Components.manager.QueryInterface(Ci.nsIComponentRegistrar).autoRegister(manifest);
- const {AddonManager} = Cu.import('resource://gre/modules/AddonManager.jsm');
- const {BootstrapLoader} = Cu.import('resource://legacy/BootstrapLoader.jsm');
+ const {AddonManager} = ChromeUtils.importESModule('resource://gre/modules/AddonManager.sys.mjs');
+ const {BootstrapLoader} = ChromeUtils.importESModule('resource://legacy/BootstrapLoader.sys.mjs');
AddonManager.addExternalExtensionLoader(BootstrapLoader);
} catch(ex) {
Components.utils.reportError(ex.message);