summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorSimon Parri <simonparri@ganzeria.com>2025-03-19 00:00:30 -0500
committerSimon Parri <simonparri@ganzeria.com>2025-08-13 10:38:07 -0500
commitde25e333e17f05140b82793776dbce51fdec296d (patch)
tree855b403b873e271308c59aaa455d73982552b9ea /legacy
parent312a791ae03bddd725dee063344801f959cfe44d (diff)
downloadlegacywolf-de25e333e17f05140b82793776dbce51fdec296d.tar.gz
legacywolf-de25e333e17f05140b82793776dbce51fdec296d.zip
Turn into an extension
Diffstat (limited to 'legacy')
-rw-r--r--legacy/BootstrapLoader.sys.mjs19
-rw-r--r--legacy/RDFDataSource.sys.mjs6
-rw-r--r--legacy/RDFManifestConverter.sys.mjs6
3 files changed, 15 insertions, 16 deletions
diff --git a/legacy/BootstrapLoader.sys.mjs b/legacy/BootstrapLoader.sys.mjs
index 80fc61d..d28bf22 100644
--- a/legacy/BootstrapLoader.sys.mjs
+++ b/legacy/BootstrapLoader.sys.mjs
@@ -1,19 +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";
+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.
@@ -92,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) {
@@ -294,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);
@@ -359,4 +356,4 @@ export var BootstrapLoader = {
};
},
};
-
+})()
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;
}
}
+})()