diff options
Diffstat (limited to 'legacy')
-rw-r--r-- | legacy/BootstrapLoader.sys.mjs | 19 | ||||
-rw-r--r-- | legacy/RDFDataSource.sys.mjs | 6 | ||||
-rw-r--r-- | legacy/RDFManifestConverter.sys.mjs | 6 |
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; } } +})() |