diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | config.js | 7 | ||||
-rw-r--r-- | legacy/BootstrapLoader.sys.mjs (renamed from legacy/BootstrapLoader.jsm) | 21 | ||||
-rw-r--r-- | legacy/RDFDataSource.sys.mjs (renamed from legacy/RDFDataSource.jsm) | 8 | ||||
-rw-r--r-- | legacy/RDFManifestConverter.sys.mjs (renamed from legacy/RDFManifestConverter.jsm) | 5 |
6 files changed, 19 insertions, 32 deletions
@@ -3,9 +3,9 @@ files := config.js files += defaults/pref/config-prefs.js files += legacy.manifest -files += legacy/BootstrapLoader.jsm -files += legacy/RDFDataSource.jsm -files += legacy/RDFManifestConverter.jsm +files += legacy/BootstrapLoader.sys.mjs +files += legacy/RDFDataSource.sys.mjs +files += legacy/RDFManifestConverter.sys.mjs archive = legacyfox.tar.gz DESTDIR ?= $(wildcard /usr/lib??/firefox/) @@ -8,6 +8,8 @@ Monkeypatching Firefox Quantum to run VimFx 2. Install VimFx from https://github.com/akhodakivskiy/VimFx/releases == Notes == + * LegacyFox is using ESModules and requires Firefox 124 or higher. Check out + the `v3.3` tag for compatibility with Firefox 68 to 128. * Users of firefox-esr on debian need to use the following command: `make DESTDIR=/usr/lib/firefox-esr install` * BootstrapLoader.jsm, RDFDataSource.jsm, RDFManifestConverter.jsm from their @@ -22,4 +24,4 @@ trademark; you are not granted any right to distribute modified binary versions of the software containing the official branding. (C) 2018-2019 Mozilla, MPL v2 -(C) 2019-2023 //gir.st/, MPL v2 +(C) 2019-2024 //gir.st/, MPL v2 @@ -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); diff --git a/legacy/BootstrapLoader.jsm b/legacy/BootstrapLoader.sys.mjs index a4010b3..80fc61d 100644 --- a/legacy/BootstrapLoader.jsm +++ b/legacy/BootstrapLoader.sys.mjs @@ -6,19 +6,12 @@ var EXPORTED_SYMBOLS = ["BootstrapLoader"]; -const {AddonManager} = ChromeUtils.import("resource://gre/modules/AddonManager.jsm"); -const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); +import {AddonManager} from "resource://gre/modules/AddonManager.sys.mjs"; +import {AddonInternal} from "resource://gre/modules/addons/XPIDatabase.sys.mjs"; +import {InstallRDF} from "resource://legacy/RDFManifestConverter.sys.mjs"; +import {XPIProvider} from "resource://gre/modules/addons/XPIProvider.sys.mjs"; -XPCOMUtils.defineLazyModuleGetters(this, { - AddonInternal: "resource://gre/modules/addons/XPIDatabase.jsm", - InstallRDF: "resource://legacy/RDFManifestConverter.jsm", -}); -const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services; - -(ChromeUtils.defineLazyGetter||XPCOMUtils.defineLazyGetter)(this, "BOOTSTRAP_REASONS", () => { - const {XPIProvider} = ChromeUtils.import("resource://gre/modules/addons/XPIProvider.jsm"); - return XPIProvider.BOOTSTRAP_REASONS; -}); +const BOOTSTRAP_REASONS = XPIProvider.BOOTSTRAP_REASONS; var logger = console.createInstance({ prefix: "addons.bootstrap" }); @@ -99,7 +92,7 @@ function buildJarURI(aJarfile, aPath) { return Services.io.newURI(uri); } -var BootstrapLoader = { +export var BootstrapLoader = { name: "bootstrap", manifestFile: "install.rdf", async loadManifest(pkg) { @@ -306,7 +299,7 @@ var BootstrapLoader = { try { Object.assign(sandbox, BOOTSTRAP_REASONS); - (ChromeUtils.defineLazyGetter||XPCOMUtils.defineLazyGetter)(sandbox, "console", () => + ChromeUtils.defineLazyGetter(sandbox, "console", () => console.createInstance({ consoleID: `addon/${addon.id}` })); Services.scriptloader.loadSubScript(uri, sandbox); diff --git a/legacy/RDFDataSource.jsm b/legacy/RDFDataSource.sys.mjs index 579d075..27687ba 100644 --- a/legacy/RDFDataSource.jsm +++ b/legacy/RDFDataSource.sys.mjs @@ -134,12 +134,6 @@ const USE_RDFNS_ATTR = false; var EXPORTED_SYMBOLS = ["RDFLiteral", "RDFIntLiteral", "RDFDateLiteral", "RDFBlankNode", "RDFResource", "RDFDataSource"]; -const {XPCOMUtils} = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); - -XPCOMUtils.defineLazyGlobalGetters(this, ["DOMParser", "Element", "XMLSerializer", "fetch"]); - -const Services = globalThis.Services || ChromeUtils.import("resource://gre/modules/Services.jsm").Services; - function isAttr(obj) { return obj && typeof obj == "object" && ChromeUtils.getClassName(obj) == "Attr"; } @@ -1113,7 +1107,7 @@ class RDFBlankNode extends RDFSubject { * changed as assertions are added and removed to the RDF. Pass a null document * to start with an empty graph. */ -class RDFDataSource { +export class RDFDataSource { constructor(document) { // All known resources, indexed on URI this._resources = {}; diff --git a/legacy/RDFManifestConverter.jsm b/legacy/RDFManifestConverter.sys.mjs index cb01f6a..12abd27 100644 --- a/legacy/RDFManifestConverter.jsm +++ b/legacy/RDFManifestConverter.sys.mjs @@ -5,8 +5,7 @@ var EXPORTED_SYMBOLS = ["InstallRDF"]; -ChromeUtils.defineModuleGetter(this, "RDFDataSource", - "resource://legacy/RDFDataSource.jsm"); +import {RDFDataSource} from "resource://legacy/RDFDataSource.sys.mjs"; const RDFURI_INSTALL_MANIFEST_ROOT = "urn:mozilla:install-manifest"; @@ -40,7 +39,7 @@ class Manifest { } } -class InstallRDF extends Manifest { +export class InstallRDF extends Manifest { _readProps(source, obj, props) { for (let prop of props) { let val = getProperty(source, prop); |