summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
Diffstat (limited to 'legacy')
-rw-r--r--legacy/BootstrapLoader.sys.mjs20
-rw-r--r--legacy/LegacyFoxUtils.sys.mjs5
-rw-r--r--legacy/RDFDataSource.sys.mjs6
-rw-r--r--legacy/RDFManifestConverter.sys.mjs6
4 files changed, 18 insertions, 19 deletions
diff --git a/legacy/BootstrapLoader.sys.mjs b/legacy/BootstrapLoader.sys.mjs
index 7285ca5..bd53689 100644
--- a/legacy/BootstrapLoader.sys.mjs
+++ b/legacy/BootstrapLoader.sys.mjs
@@ -1,20 +1,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
+var BootstrapLoader = (function() {
"use strict";
var EXPORTED_SYMBOLS = ["BootstrapLoader"];
-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";
-import {LegacyFoxUtils} from "resource://legacy/LegacyFoxUtils.sys.mjs";
+let {AddonManager} = ChromeUtils.importESModule("resource://gre/modules/AddonManager.sys.mjs");
+let {AddonInternal} = ChromeUtils.importESModule("resource://gre/modules/addons/XPIDatabase.sys.mjs");
+let {XPIProvider} = ChromeUtils.importESModule("resource://gre/modules/addons/XPIProvider.sys.mjs");
const BOOTSTRAP_REASONS = XPIProvider.BOOTSTRAP_REASONS;
-var logger = console.createInstance({ prefix: "addons.bootstrap" });
+var logger = console;
/**
* Valid IDs fit this pattern.
@@ -93,7 +91,7 @@ function buildJarURI(aJarfile, aPath) {
return Services.io.newURI(uri);
}
-export var BootstrapLoader = {
+return BootstrapLoader = {
name: "bootstrap",
manifestFile: "install.rdf",
async loadManifest(pkg) {
@@ -295,14 +293,12 @@ export var BootstrapLoader = {
addonId: addon.id,
wantGlobalProperties: ["ChromeUtils"],
metadata: { addonID: addon.id, URI: uri },
+ console,
});
try {
Object.assign(sandbox, BOOTSTRAP_REASONS);
- ChromeUtils.defineLazyGetter(sandbox, "console", () =>
- console.createInstance({ consoleID: `addon/${addon.id}` }));
-
Services.scriptloader.loadSubScript(uri, sandbox);
} catch (e) {
logger.warn(`Error loading bootstrap.js for ${addon.id}`, e);
@@ -368,4 +364,4 @@ export var BootstrapLoader = {
};
},
};
-
+})()
diff --git a/legacy/LegacyFoxUtils.sys.mjs b/legacy/LegacyFoxUtils.sys.mjs
index 8e101d0..6d13c2c 100644
--- a/legacy/LegacyFoxUtils.sys.mjs
+++ b/legacy/LegacyFoxUtils.sys.mjs
@@ -3,7 +3,7 @@
* Components.manager.removeBootstrappedManifestLocation, which have been nixed
* in mozilla142. Copyright 2025 Tobias Girstmair <https://gir.st/>, MPLv2.
*/
-
+var LegacyFoxUtils = (function() {
const ZipReader = Components.Constructor(
"@mozilla.org/libjar/zip-reader;1",
"nsIZipReader",
@@ -22,7 +22,7 @@ const FileOutputStream = Components.Constructor(
"init"
);
-export class LegacyFoxUtils {
+return class LegacyFoxUtils {
static addBootstrappedManifestLocation(file, addon, uriMaker) {
// read chrome.manifest from .jar (or unpacked addon)
let zipReader = new ZipReader(file);
@@ -80,3 +80,4 @@ function absolutizePaths(uriMaker, file, line) {
return line;
}
+})()
diff --git a/legacy/RDFDataSource.sys.mjs b/legacy/RDFDataSource.sys.mjs
index 27687ba..67f087e 100644
--- a/legacy/RDFDataSource.sys.mjs
+++ b/legacy/RDFDataSource.sys.mjs
@@ -21,7 +21,8 @@
* property element. If a resource is first added as the subject of an assertion
* then it will be serialised at the top level of the XML.
*/
-
+var RDFDataSource = (function() {
+XPCOMUtils.defineLazyGlobalGetters(this, ["DOMParser", "Element"]);
const NS_XML = "http://www.w3.org/XML/1998/namespace";
const NS_XMLNS = "http://www.w3.org/2000/xmlns/";
const NS_RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
@@ -1107,7 +1108,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.
*/
-export class RDFDataSource {
+return class RDFDataSource {
constructor(document) {
// All known resources, indexed on URI
this._resources = {};
@@ -1509,3 +1510,4 @@ export class RDFDataSource {
return IOUtils.writeUTF8(file, this.serializeToString());
}
}
+})()
diff --git a/legacy/RDFManifestConverter.sys.mjs b/legacy/RDFManifestConverter.sys.mjs
index 12abd27..dc8df42 100644
--- a/legacy/RDFManifestConverter.sys.mjs
+++ b/legacy/RDFManifestConverter.sys.mjs
@@ -1,12 +1,11 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+var InstallRDF = (function() {
"use strict";
var EXPORTED_SYMBOLS = ["InstallRDF"];
-import {RDFDataSource} from "resource://legacy/RDFDataSource.sys.mjs";
-
const RDFURI_INSTALL_MANIFEST_ROOT = "urn:mozilla:install-manifest";
function EM_R(aProperty) {
@@ -39,7 +38,7 @@ class Manifest {
}
}
-export class InstallRDF extends Manifest {
+return class InstallRDF extends Manifest {
_readProps(source, obj, props) {
for (let prop of props) {
let val = getProperty(source, prop);
@@ -107,3 +106,4 @@ export class InstallRDF extends Manifest {
return result;
}
}
+})()