Bug 1824612 - Convert toolkit/components/extensions to ES modules. r=robwu

Differential Revision: https://phabricator.services.mozilla.com/D175553
This commit is contained in:
Saira Abdulla 2023-05-31 10:21:37 +00:00
parent 1817114384
commit 18318190a5
52 changed files with 198 additions and 474 deletions

View file

@ -42,8 +42,8 @@ const known_scripts = {
"resource://gre/modules/TelemetryControllerContent.sys.mjs", // bug 1470339 "resource://gre/modules/TelemetryControllerContent.sys.mjs", // bug 1470339
// Extensions // Extensions
"resource://gre/modules/ExtensionProcessScript.jsm", "resource://gre/modules/ExtensionProcessScript.sys.mjs",
"resource://gre/modules/ExtensionUtils.jsm", "resource://gre/modules/ExtensionUtils.sys.mjs",
]), ]),
frameScripts: new Set([ frameScripts: new Set([
// Test related // Test related

View file

@ -48,8 +48,8 @@ const known_scripts = {
"resource://gre/modules/TelemetryControllerContent.sys.mjs", // bug 1470339 "resource://gre/modules/TelemetryControllerContent.sys.mjs", // bug 1470339
// Extensions // Extensions
"resource://gre/modules/ExtensionProcessScript.jsm", "resource://gre/modules/ExtensionProcessScript.sys.mjs",
"resource://gre/modules/ExtensionUtils.jsm", "resource://gre/modules/ExtensionUtils.sys.mjs",
]), ]),
processScripts: new Set([ processScripts: new Set([
"chrome://global/content/process-content.js", "chrome://global/content/process-content.js",

View file

@ -1,7 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* This @file implements the child side of Conduits, an abstraction over * This @file implements the child side of Conduits, an abstraction over
@ -15,17 +14,11 @@
* @property {object} arg * @property {object} arg
*/ */
const EXPORTED_SYMBOLS = [
"BaseConduit",
"ConduitsChild",
"ProcessConduitsChild",
];
/** /**
* Base class for both child (Point) and parent (Broadcast) side of conduits, * Base class for both child (Point) and parent (Broadcast) side of conduits,
* handles setting up send/receive method stubs. * handles setting up send/receive method stubs.
*/ */
class BaseConduit { export class BaseConduit {
/** /**
* @param {object} subject * @param {object} subject
* @param {ConduitAddress} address * @param {ConduitAddress} address
@ -154,7 +147,7 @@ class PointConduit extends BaseConduit {
/** /**
* Implements the child side of the Conduits actor, manages conduit lifetimes. * Implements the child side of the Conduits actor, manages conduit lifetimes.
*/ */
class ConduitsChild extends JSWindowActorChild { export class ConduitsChild extends JSWindowActorChild {
constructor() { constructor() {
super(); super();
this.conduits = new Map(); this.conduits = new Map();
@ -210,7 +203,7 @@ class ConduitsChild extends JSWindowActorChild {
/** /**
* Child side of the Conduits process actor. Same code as JSWindowActor. * Child side of the Conduits process actor. Same code as JSWindowActor.
*/ */
class ProcessConduitsChild extends JSProcessActorChild { export class ProcessConduitsChild extends JSProcessActorChild {
constructor() { constructor() {
super(); super();
this.conduits = new Map(); this.conduits = new Map();

View file

@ -1,13 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EXPORTED_SYMBOLS = [
"BroadcastConduit",
"ConduitsParent",
"ProcessConduitsParent",
];
/** /**
* This @file implements the parent side of Conduits, an abstraction over * This @file implements the parent side of Conduits, an abstraction over
@ -255,7 +248,7 @@ const Hub = {
* Parent side conduit, registers as a global listeners for certain messages, * Parent side conduit, registers as a global listeners for certain messages,
* and can target specific child conduits when sending. * and can target specific child conduits when sending.
*/ */
class BroadcastConduit extends BaseConduit { export class BroadcastConduit extends BaseConduit {
/** /**
* @param {object} subject * @param {object} subject
* @param {ConduitAddress} address * @param {ConduitAddress} address
@ -390,7 +383,7 @@ class BroadcastConduit extends BaseConduit {
/** /**
* Implements the parent side of the Conduits actor. * Implements the parent side of the Conduits actor.
*/ */
class ConduitsParent extends JSWindowActorParent { export class ConduitsParent extends JSWindowActorParent {
constructor() { constructor() {
super(); super();
this.batchData = []; this.batchData = [];
@ -477,7 +470,7 @@ class ConduitsParent extends JSWindowActorParent {
/** /**
* Parent side of the Conduits process actor. Same code as JSWindowActor. * Parent side of the Conduits process actor. Same code as JSWindowActor.
*/ */
class ProcessConduitsParent extends JSProcessActorParent { export class ProcessConduitsParent extends JSProcessActorParent {
receiveMessage = ConduitsParent.prototype.receiveMessage; receiveMessage = ConduitsParent.prototype.receiveMessage;
willDestroy = ConduitsParent.prototype.willDestroy; willDestroy = ConduitsParent.prototype.willDestroy;
didDestroy = ConduitsParent.prototype.didDestroy; didDestroy = ConduitsParent.prototype.didDestroy;

View file

@ -3,21 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = [
"Dictionary",
"Extension",
"ExtensionData",
"Langpack",
"Management",
"SitePermission",
"ExtensionAddonObserver",
"ExtensionProcessCrashObserver",
"PRIVILEGED_PERMS",
];
/* exported Extension, ExtensionData */
/* /*
* This file is the main entry point for extensions. When an extension * This file is the main entry point for extensions. When an extension
@ -41,12 +26,9 @@ var EXPORTED_SYMBOLS = [
* to run in the same process of the existing addon debugging browser element). * to run in the same process of the existing addon debugging browser element).
*/ */
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
); import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -192,6 +174,8 @@ var {
apiManager: Management, apiManager: Management,
} = ExtensionParent; } = ExtensionParent;
export { Management };
const { getUniqueId, promiseTimeout } = ExtensionUtils; const { getUniqueId, promiseTimeout } = ExtensionUtils;
const { EventEmitter, updateAllowedOrigins } = ExtensionCommon; const { EventEmitter, updateAllowedOrigins } = ExtensionCommon;
@ -663,7 +647,7 @@ ExtensionAddonObserver.init();
* Observer ExtensionProcess crashes and notify all the extensions * Observer ExtensionProcess crashes and notify all the extensions
* using a Management event named "extension-process-crash". * using a Management event named "extension-process-crash".
*/ */
var ExtensionProcessCrashObserver = { export var ExtensionProcessCrashObserver = {
initialized: false, initialized: false,
// Technically there is at most one child extension process, // Technically there is at most one child extension process,
// but we may need to adjust this assumption to account for more // but we may need to adjust this assumption to account for more
@ -761,7 +745,7 @@ const manifestTypes = new Map([
* No functionality of this class is guaranteed to work before * No functionality of this class is guaranteed to work before
* `loadManifest` has been called, and completed. * `loadManifest` has been called, and completed.
*/ */
class ExtensionData { export class ExtensionData {
constructor(rootURI, isPrivileged = false) { constructor(rootURI, isPrivileged = false) {
this.rootURI = rootURI; this.rootURI = rootURI;
this.resourceURL = rootURI.spec; this.resourceURL = rootURI.spec;
@ -2682,7 +2666,7 @@ let pendingExtensions = new Map();
* *
* @augments ExtensionData * @augments ExtensionData
*/ */
class Extension extends ExtensionData { export class Extension extends ExtensionData {
constructor(addonData, startupReason, updateReason) { constructor(addonData, startupReason, updateReason) {
super(addonData.resourceURI, addonData.isPrivileged); super(addonData.resourceURI, addonData.isPrivileged);
@ -3726,7 +3710,7 @@ class Extension extends ExtensionData {
} }
} }
class Dictionary extends ExtensionData { export class Dictionary extends ExtensionData {
constructor(addonData, startupReason) { constructor(addonData, startupReason) {
super(addonData.resourceURI); super(addonData.resourceURI);
this.id = addonData.id; this.id = addonData.id;
@ -3760,7 +3744,7 @@ class Dictionary extends ExtensionData {
} }
} }
class Langpack extends ExtensionData { export class Langpack extends ExtensionData {
constructor(addonData, startupReason) { constructor(addonData, startupReason) {
super(addonData.resourceURI); super(addonData.resourceURI);
this.startupData = addonData.startupData; this.startupData = addonData.startupData;
@ -3845,7 +3829,7 @@ class Langpack extends ExtensionData {
} }
// TODO(Bug 1789718): Remove after the deprecated XPIProvider-based implementation is also removed. // TODO(Bug 1789718): Remove after the deprecated XPIProvider-based implementation is also removed.
class SitePermission extends ExtensionData { export class SitePermission extends ExtensionData {
constructor(addonData, startupReason) { constructor(addonData, startupReason) {
super(addonData.resourceURI); super(addonData.resourceURI);
this.id = addonData.id; this.id = addonData.id;
@ -3958,3 +3942,6 @@ class SitePermission extends ExtensionData {
} }
} }
} }
// Exported for testing purposes.
export { ExtensionAddonObserver, PRIVILEGED_PERMS };

View file

@ -2,10 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file, * 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/. */ * You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["BrowserActionBase", "PageActionBase"];
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
); );
@ -16,9 +12,7 @@ const { ExtensionParent } = ChromeUtils.import(
); );
const { IconDetails, StartupCache } = ExtensionParent; const { IconDetails, StartupCache } = ExtensionParent;
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -389,7 +383,7 @@ class PanelActionBase {
} }
} }
class PageActionBase extends PanelActionBase { export class PageActionBase extends PanelActionBase {
constructor(tabContext, extension) { constructor(tabContext, extension) {
const options = extension.manifest.page_action; const options = extension.manifest.page_action;
super(options, tabContext, extension); super(options, tabContext, extension);
@ -507,7 +501,7 @@ class PageActionBase extends PanelActionBase {
} }
} }
class BrowserActionBase extends PanelActionBase { export class BrowserActionBase extends PanelActionBase {
constructor(tabContext, extension) { constructor(tabContext, extension) {
const options = const options =
extension.manifest.browser_action || extension.manifest.action; extension.manifest.browser_action || extension.manifest.action;

View file

@ -1,13 +1,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EXPORTED_SYMBOLS = ["ExtensionActivityLog"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
); );
@ -26,7 +22,7 @@ var { DefaultMap } = ExtensionUtils;
const MSG_SET_ENABLED = "Extension:ActivityLog:SetEnabled"; const MSG_SET_ENABLED = "Extension:ActivityLog:SetEnabled";
const MSG_LOG = "Extension:ActivityLog:DoLog"; const MSG_LOG = "Extension:ActivityLog:DoLog";
const ExtensionActivityLog = { export const ExtensionActivityLog = {
initialized: false, initialized: false,
// id => Set(callbacks) // id => Set(callbacks)

View file

@ -3,11 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* exported ExtensionChild */
var EXPORTED_SYMBOLS = ["ExtensionChild", "ExtensionActivityLogChild"];
/** /**
* This file handles addon logic that is independent of the chrome process and * This file handles addon logic that is independent of the chrome process and
@ -16,12 +11,9 @@ var EXPORTED_SYMBOLS = ["ExtensionChild", "ExtensionActivityLogChild"];
* Don't put contentscript logic here, use ExtensionContent.jsm instead. * Don't put contentscript logic here, use ExtensionContent.jsm instead.
*/ */
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
); import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -76,7 +68,7 @@ const { sharedData } = Services.cpmm;
const MSG_SET_ENABLED = "Extension:ActivityLog:SetEnabled"; const MSG_SET_ENABLED = "Extension:ActivityLog:SetEnabled";
const MSG_LOG = "Extension:ActivityLog:DoLog"; const MSG_LOG = "Extension:ActivityLog:DoLog";
const ExtensionActivityLogChild = { export const ExtensionActivityLogChild = {
_initialized: false, _initialized: false,
enabledExtensions: new Set(), enabledExtensions: new Set(),
@ -1042,7 +1034,7 @@ class ChildAPIManager {
} }
} }
var ExtensionChild = { export var ExtensionChild = {
BrowserExtensionContent, BrowserExtensionContent,
ChildAPIManager, ChildAPIManager,
ChildLocalAPIImplementation, ChildLocalAPIImplementation,

View file

@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* @file * @file
@ -11,11 +10,7 @@
* from the child process. * from the child process.
*/ */
var EXPORTED_SYMBOLS = ["ExtensionChildDevToolsUtils"]; import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs";
const { EventEmitter } = ChromeUtils.importESModule(
"resource://gre/modules/EventEmitter.sys.mjs"
);
// Create a variable to hold the cached ThemeChangeObserver which does not // Create a variable to hold the cached ThemeChangeObserver which does not
// get created until a devtools context has been created. // get created until a devtools context has been created.
@ -81,7 +76,7 @@ class ThemeChangeObserver extends EventEmitter {
} }
} }
var ExtensionChildDevToolsUtils = { export var ExtensionChildDevToolsUtils = {
/** /**
* Creates an cached instance of the ThemeChangeObserver class and * Creates an cached instance of the ThemeChangeObserver class and
* initializes it with the current themeName. This cached instance is * initializes it with the current themeName. This cached instance is

View file

@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* This module contains utilities and base classes for logic which is * This module contains utilities and base classes for logic which is
@ -11,16 +10,9 @@
* between ExtensionParent.jsm and ExtensionChild.jsm. * between ExtensionParent.jsm and ExtensionChild.jsm.
*/ */
/* exported ExtensionCommon */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["ExtensionCommon"]; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -69,7 +61,7 @@ function getConsole() {
const BACKGROUND_SCRIPTS_VIEW_TYPES = ["background", "background_worker"]; const BACKGROUND_SCRIPTS_VIEW_TYPES = ["background", "background_worker"];
var ExtensionCommon; export var ExtensionCommon;
// Run a function and report exceptions. // Run a function and report exceptions.
function runSafeSyncWithoutClone(f, ...args) { function runSafeSyncWithoutClone(f, ...args) {

View file

@ -3,16 +3,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["ExtensionContent", "ExtensionContentChild"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -1129,7 +1122,7 @@ DocumentManager = {
}, },
}; };
var ExtensionContent = { export var ExtensionContent = {
BrowserExtensionContent, BrowserExtensionContent,
contentScripts, contentScripts,
@ -1306,7 +1299,7 @@ var ExtensionContent = {
/** /**
* Child side of the ExtensionContent process actor, handles some tabs.* APIs. * Child side of the ExtensionContent process actor, handles some tabs.* APIs.
*/ */
class ExtensionContentChild extends JSProcessActorChild { export class ExtensionContentChild extends JSProcessActorChild {
receiveMessage({ name, data }) { receiveMessage({ name, data }) {
if (!lazy.isContentScriptProcess) { if (!lazy.isContentScriptProcess) {
return; return;

View file

@ -3,11 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* exported ExtensionPageChild */
var EXPORTED_SYMBOLS = ["ExtensionPageChild", "getContextChildManagerGetter"];
/** /**
* This file handles privileged extension page logic that runs in the * This file handles privileged extension page logic that runs in the
@ -47,7 +42,7 @@ const { BaseContext, CanOfAPIs, SchemaAPIManager, defineLazyGetter } =
const { ChildAPIManager, Messenger } = ExtensionChild; const { ChildAPIManager, Messenger } = ExtensionChild;
var ExtensionPageChild; export var ExtensionPageChild;
const initializeBackgroundPage = context => { const initializeBackgroundPage = context => {
// Override the `alert()` method inside background windows; // Override the `alert()` method inside background windows;
@ -159,7 +154,7 @@ var devtoolsAPIManager = new (class extends SchemaAPIManager {
} }
})(); })();
function getContextChildManagerGetter( export function getContextChildManagerGetter(
{ envType }, { envType },
ChildAPIManagerClass = ChildAPIManager ChildAPIManagerClass = ChildAPIManager
) { ) {

View file

@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* This module contains code for managing APIs that need to run in the * This module contains code for managing APIs that need to run in the
@ -11,16 +10,9 @@
* to be proxied from ExtensionChild.jsm. * to be proxied from ExtensionChild.jsm.
*/ */
/* exported ExtensionParent */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["ExtensionParent"]; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -2276,7 +2268,7 @@ for (let name of StartupCache.STORE_NAMES) {
StartupCache[name] = new CacheStore(name); StartupCache[name] = new CacheStore(name);
} }
var ExtensionParent = { export var ExtensionParent = {
GlobalManager, GlobalManager,
HiddenExtensionPage, HiddenExtensionPage,
IconDetails, IconDetails,

View file

@ -3,14 +3,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs" import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -36,17 +31,6 @@ XPCOMUtils.defineLazyGetter(
() => lazy.ExtensionParent.apiManager () => lazy.ExtensionParent.apiManager
); );
var EXPORTED_SYMBOLS = [
"ExtensionPermissions",
"OriginControls",
// Constants exported for testing purpose.
"OLD_JSON_FILENAME",
"OLD_RKV_DIRNAME",
"RKV_DIRNAME",
"VERSION_KEY",
"VERSION_VALUE",
];
function emptyPermissions() { function emptyPermissions() {
return { permissions: [], origins: [] }; return { permissions: [], origins: [] };
} }
@ -332,7 +316,7 @@ function createStore(useRkv = AppConstants.NIGHTLY_BUILD) {
let store = createStore(); let store = createStore();
var ExtensionPermissions = { export var ExtensionPermissions = {
async _update(extensionId, perms) { async _update(extensionId, perms) {
await store.put(extensionId, perms); await store.put(extensionId, perms);
return lazy.StartupCache.permissions.set(extensionId, perms); return lazy.StartupCache.permissions.set(extensionId, perms);
@ -501,7 +485,7 @@ var ExtensionPermissions = {
}, },
}; };
var OriginControls = { export var OriginControls = {
allDomains: new MatchPattern("*://*/*"), allDomains: new MatchPattern("*://*/*"),
/** /**
@ -655,3 +639,12 @@ var OriginControls = {
return null; return null;
}, },
}; };
// Constants exported for testing purpose.
export {
OLD_JSON_FILENAME,
OLD_RKV_DIRNAME,
RKV_DIRNAME,
VERSION_KEY,
VERSION_VALUE,
};

View file

@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* @file * @file
@ -20,16 +19,13 @@
* values that correspond to the prefs to be set. * values that correspond to the prefs to be set.
*/ */
const EXPORTED_SYMBOLS = ["ExtensionPreferencesManager"]; export let ExtensionPreferencesManager;
let ExtensionPreferencesManager;
const { Management } = ChromeUtils.import( const { Management } = ChromeUtils.import(
"resource://gre/modules/Extension.jsm" "resource://gre/modules/Extension.jsm"
); );
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};

View file

@ -1,7 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* This script contains the minimum, skeleton content process code that we need * This script contains the minimum, skeleton content process code that we need
@ -10,14 +9,9 @@
* after startup, in *every* browser process live outside of this file. * after startup, in *every* browser process live outside of this file.
*/ */
var EXPORTED_SYMBOLS = ["ExtensionProcessScript", "ExtensionAPIRequestHandler"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule( import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -369,7 +363,7 @@ ExtensionManager = {
}, },
}; };
var ExtensionProcessScript = { export var ExtensionProcessScript = {
extensions, extensions,
initExtension(extension) { initExtension(extension) {
@ -405,7 +399,7 @@ var ExtensionProcessScript = {
}, },
}; };
var ExtensionAPIRequestHandler = { export var ExtensionAPIRequestHandler = {
initExtensionWorker(policy, serviceWorkerInfo) { initExtensionWorker(policy, serviceWorkerInfo) {
let extension = extensions.get(policy); let extension = extensions.get(policy);

View file

@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
@ -158,7 +157,7 @@ const store = new Store();
* *
* @returns {object} * @returns {object}
*/ */
const makeInternalContentScript = ( export const makeInternalContentScript = (
extension, extension,
options, options,
prependBaseURL = false prependBaseURL = false
@ -207,7 +206,7 @@ const makeInternalContentScript = (
* *
* @returns {object} * @returns {object}
*/ */
const makePublicContentScript = (extension, internalScript) => { export const makePublicContentScript = (extension, internalScript) => {
let script = { let script = {
id: internalScript.id, id: internalScript.id,
allFrames: internalScript.allFrames, allFrames: internalScript.allFrames,
@ -235,7 +234,7 @@ const makePublicContentScript = (extension, internalScript) => {
return script; return script;
}; };
const ExtensionScriptingStore = { export const ExtensionScriptingStore = {
async initExtension(extension) { async initExtension(extension) {
let scripts; let scripts;
@ -336,9 +335,3 @@ const ExtensionScriptingStore = {
return store; return store;
}, },
}; };
var EXPORTED_SYMBOLS = [
"ExtensionScriptingStore",
"makeInternalContentScript",
"makePublicContentScript",
];

View file

@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* @file * @file
@ -40,8 +39,6 @@
* *
*/ */
var EXPORTED_SYMBOLS = ["ExtensionSettingsStore"];
const { ExtensionParent } = ChromeUtils.import( const { ExtensionParent } = ChromeUtils.import(
"resource://gre/modules/ExtensionParent.jsm" "resource://gre/modules/ExtensionParent.jsm"
); );
@ -334,7 +331,7 @@ function alterSetting(id, type, key, action) {
return returnItem; return returnItem;
} }
var ExtensionSettingsStore = { export var ExtensionSettingsStore = {
SETTING_USER_SET, SETTING_USER_SET,
/** /**

View file

@ -1,10 +1,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* exported ExtensionShortcuts */
const EXPORTED_SYMBOLS = ["ExtensionShortcuts", "ExtensionShortcutKeyMap"];
const { ExtensionCommon } = ChromeUtils.import( const { ExtensionCommon } = ChromeUtils.import(
"resource://gre/modules/ExtensionCommon.jsm" "resource://gre/modules/ExtensionCommon.jsm"
@ -69,7 +65,7 @@ function normalizeShortcut(shortcut) {
return shortcut ? shortcut.replace(/\s+/g, "") : ""; return shortcut ? shortcut.replace(/\s+/g, "") : "";
} }
class ExtensionShortcutKeyMap extends DefaultMap { export class ExtensionShortcutKeyMap extends DefaultMap {
async buildForAddonIds(addonIds) { async buildForAddonIds(addonIds) {
this.clear(); this.clear();
for (const addonId of addonIds) { for (const addonId of addonIds) {
@ -178,7 +174,7 @@ class ExtensionShortcutKeyMap extends DefaultMap {
* the list, update and reset APIs for the browser.commands interface and * the list, update and reset APIs for the browser.commands interface and
* the about:addons manage shortcuts page. * the about:addons manage shortcuts page.
*/ */
class ExtensionShortcuts { export class ExtensionShortcuts {
static async removeCommandsFromStorage(extensionId) { static async removeCommandsFromStorage(extensionId) {
// Cleanup the updated commands. In some cases the extension is installed // Cleanup the updated commands. In some cases the extension is installed
// and uninstalled so quickly that `this.commands` hasn't loaded yet. To // and uninstalled so quickly that `this.commands` hasn't loaded yet. To

View file

@ -3,13 +3,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["ExtensionStorage", "extensionStorageSession"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { const {
ExtensionUtils: { ExtensionError, DefaultWeakMap }, ExtensionUtils: { ExtensionError, DefaultWeakMap },
} = ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm"); } = ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm");
@ -97,7 +93,7 @@ function serialize(name, anonymizedName, value) {
return value; return value;
} }
var ExtensionStorage = { export var ExtensionStorage = {
// Map<extension-id, Promise<JSONFile>> // Map<extension-id, Promise<JSONFile>>
jsonFilePromises: new Map(), jsonFilePromises: new Map(),
@ -492,7 +488,7 @@ XPCOMUtils.defineLazyGetter(ExtensionStorage, "extensionDir", () =>
ExtensionStorage.init(); ExtensionStorage.init();
var extensionStorageSession = { export var extensionStorageSession = {
/** @type {WeakMap<Extension, Map<string, any>>} */ /** @type {WeakMap<Extension, Map<string, any>>} */
buckets: new DefaultWeakMap(_extension => new Map()), buckets: new DefaultWeakMap(_extension => new Map()),

View file

@ -2,17 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; export let ExtensionStorageIDB;
import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["ExtensionStorageIDB"]; import { IndexedDB } from "resource://gre/modules/IndexedDB.sys.mjs";
let ExtensionStorageIDB;
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { IndexedDB } = ChromeUtils.importESModule(
"resource://gre/modules/IndexedDB.sys.mjs"
);
const lazy = {}; const lazy = {};

View file

@ -3,15 +3,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["ExtensionStorageSync", "extensionStorageSync"];
const STORAGE_SYNC_ENABLED_PREF = "webextensions.storage.sync.enabled"; const STORAGE_SYNC_ENABLED_PREF = "webextensions.storage.sync.enabled";
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const NS_ERROR_DOM_QUOTA_EXCEEDED_ERR = 0x80530016; const NS_ERROR_DOM_QUOTA_EXCEEDED_ERR = 0x80530016;
@ -82,7 +77,7 @@ ExtensionStorageApiCallback.prototype = {
}; };
// The backing implementation of the browser.storage.sync web extension API. // The backing implementation of the browser.storage.sync web extension API.
class ExtensionStorageSync { export class ExtensionStorageSync {
constructor() { constructor() {
this.listeners = new Map(); this.listeners = new Map();
// We are optimistic :) If we ever see the special nsresult which indicates // We are optimistic :) If we ever see the special nsresult which indicates
@ -207,4 +202,4 @@ class ExtensionStorageSync {
} }
} }
var extensionStorageSync = new ExtensionStorageSync(); export var extensionStorageSync = new ExtensionStorageSync();

View file

@ -3,22 +3,14 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// TODO: // TODO:
// * find out how the Chrome implementation deals with conflicts // * find out how the Chrome implementation deals with conflicts
// TODO bug 1637465: Remove the Kinto-based storage implementation. // TODO bug 1637465: Remove the Kinto-based storage implementation.
var EXPORTED_SYMBOLS = [ import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
"ExtensionStorageSyncKinto",
"KintoStorageTestUtils",
"extensionStorageSyncKinto",
];
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const KINTO_PROD_SERVER_URL = const KINTO_PROD_SERVER_URL =
"https://webextensions.settings.services.mozilla.com/v1"; "https://webextensions.settings.services.mozilla.com/v1";
const KINTO_DEFAULT_SERVER_URL = KINTO_PROD_SERVER_URL; const KINTO_DEFAULT_SERVER_URL = KINTO_PROD_SERVER_URL;
@ -35,12 +27,9 @@ const FXA_OAUTH_OPTIONS = {
// Default is 5sec, which seems a bit aggressive on the open internet // Default is 5sec, which seems a bit aggressive on the open internet
const KINTO_REQUEST_TIMEOUT = 30000; const KINTO_REQUEST_TIMEOUT = 30000;
const { Log } = ChromeUtils.importESModule( import { Log } from "resource://gre/modules/Log.sys.mjs";
"resource://gre/modules/Log.sys.mjs" import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
); );
@ -131,7 +120,7 @@ function throwIfNoFxA(fxAccounts, action) {
// Global ExtensionStorageSyncKinto instance that extensions and Fx Sync use. // Global ExtensionStorageSyncKinto instance that extensions and Fx Sync use.
// On Android, because there's no FXAccounts instance, any syncing // On Android, because there's no FXAccounts instance, any syncing
// operations will fail. // operations will fail.
var extensionStorageSyncKinto = null; export var extensionStorageSyncKinto = null;
/** /**
* Utility function to enforce an order of fields when computing an HMAC. * Utility function to enforce an order of fields when computing an HMAC.
@ -735,7 +724,7 @@ const openCollection = async function (extension, options = {}) {
return coll; return coll;
}; };
class ExtensionStorageSyncKinto { export class ExtensionStorageSyncKinto {
/** /**
* @param {FXAccounts} fxaService (Optional) If not * @param {FXAccounts} fxaService (Optional) If not
* present, trying to sync will fail. * present, trying to sync will fail.
@ -1376,10 +1365,11 @@ class ExtensionStorageSyncKinto {
} }
} }
} }
extensionStorageSyncKinto = new ExtensionStorageSyncKinto(_fxaService); extensionStorageSyncKinto = new ExtensionStorageSyncKinto(_fxaService);
// For test use only. // For test use only.
const KintoStorageTestUtils = { export const KintoStorageTestUtils = {
CollectionKeyEncryptionRemoteTransformer, CollectionKeyEncryptionRemoteTransformer,
CryptoCollection, CryptoCollection,
EncryptionRemoteTransformer, EncryptionRemoteTransformer,

View file

@ -3,13 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = [
"ExtensionTelemetry",
"getTrimmedString",
"getErrorNameForTelemetry",
];
// Map of the base histogram ids for the metrics recorded for the extensions. // Map of the base histogram ids for the metrics recorded for the extensions.
const histograms = { const histograms = {
@ -38,7 +31,7 @@ const histograms = {
* The trimmed version of the string when longer than 80 chars, or the given string * The trimmed version of the string when longer than 80 chars, or the given string
* unmodified otherwise. * unmodified otherwise.
*/ */
function getTrimmedString(str) { export function getTrimmedString(str) {
if (str.length <= 80) { if (str.length <= 80) {
return str; return str;
} }
@ -65,7 +58,7 @@ function getTrimmedString(str) {
* - "NoError" if error is falsey. * - "NoError" if error is falsey.
* - "UnkownError" as a fallback. * - "UnkownError" as a fallback.
*/ */
function getErrorNameForTelemetry(error) { export function getErrorNameForTelemetry(error) {
let text = "UnknownError"; let text = "UnknownError";
if (!error) { if (!error) {
text = "NoError"; text = "NoError";
@ -201,7 +194,7 @@ const metricsCache = new Map();
* ExtensionTelemetry.extensionStartup.stopwatchStart(extension); * ExtensionTelemetry.extensionStartup.stopwatchStart(extension);
* ExtensionTelemetry.browserActionPreloadResult.histogramAdd({category: "Shown", extension}); * ExtensionTelemetry.browserActionPreloadResult.histogramAdd({category: "Shown", extension});
*/ */
var ExtensionTelemetry = new Proxy(metricsCache, { export var ExtensionTelemetry = new Proxy(metricsCache, {
get(target, prop, receiver) { get(target, prop, receiver) {
if (!(prop in histograms)) { if (!(prop in histograms)) {
throw new Error(`Unknown metric ${prop}`); throw new Error(`Unknown metric ${prop}`);

View file

@ -3,20 +3,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* This module contains extension testing helper logic which is common * This module contains extension testing helper logic which is common
* between all test suites. * between all test suites.
*/ */
/* exported ExtensionTestCommon, MockExtension */ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["ExtensionTestCommon", "MockExtension"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -25,9 +18,8 @@ ChromeUtils.defineModuleGetter(
"AddonManager", "AddonManager",
"resource://gre/modules/AddonManager.jsm" "resource://gre/modules/AddonManager.jsm"
); );
const { AppConstants } = ChromeUtils.importESModule( import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
"resource://gre/modules/AppConstants.sys.mjs"
);
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
Assert: "resource://testing-common/Assert.sys.mjs", Assert: "resource://testing-common/Assert.sys.mjs",
FileUtils: "resource://gre/modules/FileUtils.sys.mjs", FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
@ -69,7 +61,7 @@ const { flushJarCache } = ExtensionUtils;
const { instanceOf } = ExtensionCommon; const { instanceOf } = ExtensionCommon;
var ExtensionTestCommon; export var ExtensionTestCommon;
/** /**
* A skeleton Extension-like object, used for testing, which installs an * A skeleton Extension-like object, used for testing, which installs an
@ -81,7 +73,7 @@ var ExtensionTestCommon;
* @param {nsIURI} rootURI * @param {nsIURI} rootURI
* @param {string} installType * @param {string} installType
*/ */
class MockExtension { export class MockExtension {
constructor(file, rootURI, addonData) { constructor(file, rootURI, addonData) {
this.id = null; this.id = null;
this.file = file; this.file = file;

View file

@ -3,13 +3,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["ExtensionUtils"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -333,7 +328,7 @@ async function makeDataURI(iconUrl) {
return `data:${contentType};base64,${btoa(str)}`; return `data:${contentType};base64,${btoa(str)}`;
} }
var ExtensionUtils = { export var ExtensionUtils = {
flushJarCache, flushJarCache,
getInnerWindowID, getInnerWindowID,
getMessageManager, getMessageManager,

View file

@ -3,11 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* exported ExtensionWorkerChild */
var EXPORTED_SYMBOLS = ["ExtensionWorkerChild"];
/** /**
* This file handles extension background service worker logic that runs in the * This file handles extension background service worker logic that runs in the
@ -716,7 +711,7 @@ defineLazyGetter(
) )
); );
var ExtensionWorkerChild = { export var ExtensionWorkerChild = {
// Map<serviceWorkerDescriptorId, ExtensionWorkerContextChild> // Map<serviceWorkerDescriptorId, ExtensionWorkerContextChild>
extensionWorkerContexts: new Map(), extensionWorkerContexts: new Map(),

View file

@ -3,16 +3,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["ExtensionTestUtils"]; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
import { XPCShellContentUtils } from "resource://testing-common/XPCShellContentUtils.sys.mjs";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { XPCShellContentUtils } = ChromeUtils.importESModule(
"resource://testing-common/XPCShellContentUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -618,7 +611,7 @@ class ExternallyInstalledWrapper extends AOMExtensionWrapper {
maybeSetID(uri, id) {} maybeSetID(uri, id) {}
} }
var ExtensionTestUtils = { export var ExtensionTestUtils = {
BASE_MANIFEST, BASE_MANIFEST,
get testAssertions() { get testAssertions() {

View file

@ -3,21 +3,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["FindContent"];
const lazy = {}; const lazy = {};
/* exported FindContent */
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
Finder: "resource://gre/modules/Finder.sys.mjs", Finder: "resource://gre/modules/Finder.sys.mjs",
FinderHighlighter: "resource://gre/modules/FinderHighlighter.sys.mjs", FinderHighlighter: "resource://gre/modules/FinderHighlighter.sys.mjs",
FinderIterator: "resource://gre/modules/FinderIterator.sys.mjs", FinderIterator: "resource://gre/modules/FinderIterator.sys.mjs",
}); });
class FindContent { export class FindContent {
constructor(docShell) { constructor(docShell) {
this.finder = new lazy.Finder(docShell); this.finder = new lazy.Finder(docShell);
} }

View file

@ -2,14 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/* exported MatchURLFilters */
var EXPORTED_SYMBOLS = ["MatchURLFilters"];
// Match WebNavigation URL Filters. // Match WebNavigation URL Filters.
class MatchURLFilters { export class MatchURLFilters {
constructor(filters) { constructor(filters) {
if (!Array.isArray(filters)) { if (!Array.isArray(filters)) {
throw new TypeError("filters should be an array"); throw new TypeError("filters should be an array");

View file

@ -3,7 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* This module provides wrappers around standard message managers to * This module provides wrappers around standard message managers to
@ -97,12 +96,10 @@
* *
*/ */
const EXPORTED_SYMBOLS = ["MessageChannel"]; export let MessageChannel;
let MessageChannel;
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
); );

View file

@ -3,9 +3,6 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["MessageManagerProxy"];
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
@ -22,7 +19,7 @@ const { DefaultMap } = ExtensionUtils;
* The target message manager on which to send messages, or the * The target message manager on which to send messages, or the
* <browser> element which owns it. * <browser> element which owns it.
*/ */
class MessageManagerProxy { export class MessageManagerProxy {
constructor(target) { constructor(target) {
this.listeners = new DefaultMap(() => new Map()); this.listeners = new DefaultMap(() => new Map());
this.closed = false; this.closed = false;

View file

@ -3,16 +3,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["NativeManifests"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -38,7 +31,7 @@ const NATIVE_MANIFEST_SCHEMA =
const REGPATH = "Software\\Mozilla"; const REGPATH = "Software\\Mozilla";
var NativeManifests = { export var NativeManifests = {
_initializePromise: null, _initializePromise: null,
_lookup: null, _lookup: null,

View file

@ -3,20 +3,10 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["NativeApp"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const { XPCOMUtils } = ChromeUtils.importESModule( import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const { EventEmitter } = ChromeUtils.importESModule(
"resource://gre/modules/EventEmitter.sys.mjs"
);
const { const {
ExtensionUtils: { ExtensionError, promiseTimeout }, ExtensionUtils: { ExtensionError, promiseTimeout },
@ -54,7 +44,7 @@ const PREF_MAX_READ = "webextensions.native-messaging.max-input-message-bytes";
const PREF_MAX_WRITE = const PREF_MAX_WRITE =
"webextensions.native-messaging.max-output-message-bytes"; "webextensions.native-messaging.max-output-message-bytes";
var NativeApp = class extends EventEmitter { export var NativeApp = class extends EventEmitter {
/** /**
* @param {BaseContext} context The context that initiated the native app. * @param {BaseContext} context The context that initiated the native app.
* @param {string} application The identifier of the native app. * @param {string} application The identifier of the native app.

View file

@ -3,24 +3,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/** /**
* This module contains a global counter to store API call in the current process. * This module contains a global counter to store API call in the current process.
*/ */
/* exported Counters */
var EXPORTED_SYMBOLS = ["PerformanceCounters"];
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
); );
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs" import { DeferredTask } from "resource://gre/modules/DeferredTask.sys.mjs";
);
const { DeferredTask } = ChromeUtils.importESModule(
"resource://gre/modules/DeferredTask.sys.mjs"
);
const { DefaultMap } = ExtensionUtils; const { DefaultMap } = ExtensionUtils;
@ -68,7 +60,7 @@ class CounterMap extends DefaultMap {
var _performanceCountersSender = null; var _performanceCountersSender = null;
// Pre-definition of the global Counters instance. // Pre-definition of the global Counters instance.
var PerformanceCounters = null; export var PerformanceCounters = null;
function _sendPerformanceCounters(childApiManagerId) { function _sendPerformanceCounters(childApiManagerId) {
let counters = PerformanceCounters.flush(); let counters = PerformanceCounters.flush();

View file

@ -3,15 +3,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
var EXPORTED_SYMBOLS = ["ProxyChannelFilter"]; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
/* exported ProxyChannelFilter */
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
); );
@ -278,7 +272,7 @@ function normalizeFilter(filter) {
}; };
} }
class ProxyChannelFilter { export class ProxyChannelFilter {
constructor(context, extension, listener, filter, extraInfoSpec) { constructor(context, extension, listener, filter, extraInfoSpec) {
this.context = context; this.context = context;
this.extension = extension; this.extension = extension;

View file

@ -3,14 +3,9 @@
/* This Source Code Form is subject to the terms of the Mozilla Public /* 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 * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { AppConstants } = ChromeUtils.importESModule( import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
"resource://gre/modules/AppConstants.sys.mjs" import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
);
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
@ -52,8 +47,7 @@ XPCOMUtils.defineLazyPreferenceGetter(
false false
); );
const EXPORTED_SYMBOLS = ["SchemaRoot", "Schemas"]; export let Schemas;
let Schemas;
const KEY_CONTENT_SCHEMAS = "extensions-framework/schemas/content"; const KEY_CONTENT_SCHEMAS = "extensions-framework/schemas/content";
const KEY_PRIVILEGED_SCHEMAS = "extensions-framework/schemas/privileged"; const KEY_PRIVILEGED_SCHEMAS = "extensions-framework/schemas/privileged";
@ -3478,7 +3472,7 @@ class SchemaRoots extends Namespaces {
* A map of schema URLs and corresponding JSON blobs from which to * A map of schema URLs and corresponding JSON blobs from which to
* populate this root namespace. * populate this root namespace.
*/ */
class SchemaRoot extends Namespace { export class SchemaRoot extends Namespace {
constructor(base, schemaJSON) { constructor(base, schemaJSON) {
super(null, "", []); super(null, "", []);

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs";
const EXPORTED_SYMBOLS = ["WebNavigation", "WebNavigationManager"];
const { AppConstants } = ChromeUtils.importESModule(
"resource://gre/modules/AppConstants.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -36,7 +30,7 @@ function getBrowser(bc) {
return bc.top.embedderElement; return bc.top.embedderElement;
} }
var WebNavigationManager = { export var WebNavigationManager = {
// Map[string -> Map[listener -> URLFilter]] // Map[string -> Map[listener -> URLFilter]]
listeners: new Map(), listeners: new Map(),
@ -398,7 +392,7 @@ const EVENTS = [
"onCreatedNavigationTarget", "onCreatedNavigationTarget",
]; ];
var WebNavigation = {}; export var WebNavigation = {};
for (let event of EVENTS) { for (let event of EVENTS) {
WebNavigation[event] = { WebNavigation[event] = {

View file

@ -2,12 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EXPORTED_SYMBOLS = ["WebNavigationFrames"];
/* exported WebNavigationFrames */
/** /**
* The FrameDetail object which represents a frame in WebExtensions APIs. * The FrameDetail object which represents a frame in WebExtensions APIs.
* *
@ -62,7 +56,7 @@ function getFrameDetail(bc) {
}; };
} }
var WebNavigationFrames = { export var WebNavigationFrames = {
getFrame(bc, frameId) { getFrame(bc, frameId) {
// frameId 0 means the top-level frame; anything else is a child frame. // frameId 0 means the top-level frame; anything else is a child frame.
let frame = BrowsingContext.get(frameId || bc.id); let frame = BrowsingContext.get(frameId || bc.id);

View file

@ -9,45 +9,45 @@ with Files("**"):
BUG_COMPONENT = ("WebExtensions", "General") BUG_COMPONENT = ("WebExtensions", "General")
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"ConduitsChild.jsm", "ConduitsChild.sys.mjs",
"ConduitsParent.jsm", "ConduitsParent.sys.mjs",
"Extension.jsm", "Extension.sys.mjs",
"ExtensionActions.jsm", "ExtensionActions.sys.mjs",
"ExtensionActivityLog.jsm", "ExtensionActivityLog.sys.mjs",
"ExtensionChild.jsm", "ExtensionChild.sys.mjs",
"ExtensionChildDevToolsUtils.jsm", "ExtensionChildDevToolsUtils.sys.mjs",
"ExtensionCommon.jsm", "ExtensionCommon.sys.mjs",
"ExtensionContent.jsm", "ExtensionContent.sys.mjs",
"ExtensionDNR.sys.mjs", "ExtensionDNR.sys.mjs",
"ExtensionDNRLimits.sys.mjs", "ExtensionDNRLimits.sys.mjs",
"ExtensionDNRStore.sys.mjs", "ExtensionDNRStore.sys.mjs",
"ExtensionPageChild.jsm", "ExtensionPageChild.sys.mjs",
"ExtensionParent.jsm", "ExtensionParent.sys.mjs",
"ExtensionPermissionMessages.sys.mjs", "ExtensionPermissionMessages.sys.mjs",
"ExtensionPermissions.jsm", "ExtensionPermissions.sys.mjs",
"ExtensionPreferencesManager.jsm", "ExtensionPreferencesManager.sys.mjs",
"ExtensionProcessScript.jsm", "ExtensionProcessScript.sys.mjs",
"extensionProcessScriptLoader.js", "extensionProcessScriptLoader.js",
"ExtensionScriptingStore.jsm", "ExtensionScriptingStore.sys.mjs",
"ExtensionSettingsStore.jsm", "ExtensionSettingsStore.sys.mjs",
"ExtensionShortcuts.jsm", "ExtensionShortcuts.sys.mjs",
"ExtensionStorage.jsm", "ExtensionStorage.sys.mjs",
"ExtensionStorageIDB.jsm", "ExtensionStorageIDB.sys.mjs",
"ExtensionStorageSync.jsm", "ExtensionStorageSync.sys.mjs",
"ExtensionStorageSyncKinto.jsm", "ExtensionStorageSyncKinto.sys.mjs",
"ExtensionTelemetry.jsm", "ExtensionTelemetry.sys.mjs",
"ExtensionUtils.jsm", "ExtensionUtils.sys.mjs",
"ExtensionWorkerChild.jsm", "ExtensionWorkerChild.sys.mjs",
"FindContent.jsm", "FindContent.sys.mjs",
"MatchURLFilters.jsm", "MatchURLFilters.sys.mjs",
"MessageManagerProxy.jsm", "MessageManagerProxy.sys.mjs",
"NativeManifests.jsm", "NativeManifests.sys.mjs",
"NativeMessaging.jsm", "NativeMessaging.sys.mjs",
"PerformanceCounters.jsm", "PerformanceCounters.sys.mjs",
"ProxyChannelFilter.jsm", "ProxyChannelFilter.sys.mjs",
"Schemas.jsm", "Schemas.sys.mjs",
"WebNavigation.jsm", "WebNavigation.sys.mjs",
"WebNavigationFrames.jsm", "WebNavigationFrames.sys.mjs",
] ]
EXTRA_COMPONENTS += [ EXTRA_COMPONENTS += [
@ -55,11 +55,11 @@ EXTRA_COMPONENTS += [
] ]
TESTING_JS_MODULES += [ TESTING_JS_MODULES += [
"ExtensionTestCommon.jsm", "ExtensionTestCommon.sys.mjs",
"ExtensionXPCShellUtils.jsm", "ExtensionXPCShellUtils.sys.mjs",
"MessageChannel.jsm", "MessageChannel.sys.mjs",
"test/xpcshell/data/TestWorkerWatcherChild.jsm", "test/xpcshell/data/TestWorkerWatcherChild.sys.mjs",
"test/xpcshell/data/TestWorkerWatcherParent.jsm", "test/xpcshell/data/TestWorkerWatcherParent.sys.mjs",
] ]
DIRS += [ DIRS += [

View file

@ -2,8 +2,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const lazy = {}; const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { ChromeUtils.defineESModuleGetters(lazy, {
@ -11,8 +9,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
FileUtils: "resource://gre/modules/FileUtils.sys.mjs", FileUtils: "resource://gre/modules/FileUtils.sys.mjs",
}); });
const EXPORTED_SYMBOLS = ["StorageSyncService"];
const StorageSyncArea = Components.Constructor( const StorageSyncArea = Components.Constructor(
"@mozilla.org/extensions/storage/internal/sync-area;1", "@mozilla.org/extensions/storage/internal/sync-area;1",
"mozIConfigurableExtensionStorageArea", "mozIConfigurableExtensionStorageArea",
@ -57,7 +53,7 @@ const StorageSyncArea = Components.Constructor(
* *
* @class * @class
*/ */
function StorageSyncService() { export function StorageSyncService() {
if (StorageSyncService._singleton) { if (StorageSyncService._singleton) {
return StorageSyncService._singleton; return StorageSyncService._singleton;
} }

View file

@ -15,7 +15,7 @@ Classes = [
{ {
'cid': '{5b7047b4-fe17-4661-8e13-871402bc2023}', 'cid': '{5b7047b4-fe17-4661-8e13-871402bc2023}',
'contract_ids': ['@mozilla.org/extensions/storage/sync;1'], 'contract_ids': ['@mozilla.org/extensions/storage/sync;1'],
'jsm': 'resource://gre/modules/ExtensionStorageComponents.jsm', 'esModule': 'resource://gre/modules/ExtensionStorageComponents.sys.mjs',
'constructor': 'StorageSyncService', 'constructor': 'StorageSyncService',
'singleton': True, 'singleton': True,
}, },

View file

@ -23,7 +23,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] != "android":
] ]
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"ExtensionStorageComponents.jsm", "ExtensionStorageComponents.sys.mjs",
] ]
XPCOM_MANIFESTS += [ XPCOM_MANIFESTS += [

View file

@ -8,7 +8,7 @@ support-files =
file_sample.html file_sample.html
file_with_images.html file_with_images.html
webrequest_chromeworker.js webrequest_chromeworker.js
webrequest_test.jsm webrequest_test.sys.mjs
prefs = prefs =
security.mixed_content.upgrade_display_content=false security.mixed_content.upgrade_display_content=false
tags = webextensions in-process-webextensions tags = webextensions in-process-webextensions

View file

@ -1,8 +1,4 @@
"use strict"; export var webrequest_test = {
var EXPORTED_SYMBOLS = ["webrequest_test"];
var webrequest_test = {
testFetch(url) { testFetch(url) {
return fetch(url); return fetch(url);
}, },

View file

@ -1,10 +1,4 @@
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
var EXPORTED_SYMBOLS = ["TestWorkerWatcherChild"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -15,7 +9,7 @@ XPCOMUtils.defineLazyServiceGetter(
"nsIWorkerDebuggerManager" "nsIWorkerDebuggerManager"
); );
class TestWorkerWatcherChild extends JSProcessActorChild { export class TestWorkerWatcherChild extends JSProcessActorChild {
async receiveMessage(msg) { async receiveMessage(msg) {
switch (msg.name) { switch (msg.name) {
case "Test:StartWatchingWorkers": case "Test:StartWatchingWorkers":

View file

@ -1,8 +1,4 @@
"use strict"; export class TestWorkerWatcherParent extends JSProcessActorParent {
var EXPORTED_SYMBOLS = ["TestWorkerWatcherParent"];
class TestWorkerWatcherParent extends JSProcessActorParent {
constructor() { constructor() {
super(); super();
// This is set by the test helper that does use these process actors. // This is set by the test helper that does use these process actors.

View file

@ -5,28 +5,28 @@
const STARTUP_APIS = ["backgroundPage"]; const STARTUP_APIS = ["backgroundPage"];
const STARTUP_MODULES = new Set([ const STARTUP_MODULES = new Set([
"resource://gre/modules/Extension.jsm", "resource://gre/modules/Extension.sys.mjs",
"resource://gre/modules/ExtensionCommon.jsm", "resource://gre/modules/ExtensionCommon.sys.mjs",
"resource://gre/modules/ExtensionParent.jsm", "resource://gre/modules/ExtensionParent.sys.mjs",
// FIXME: This is only loaded at startup for new extension installs. // FIXME: This is only loaded at startup for new extension installs.
// Otherwise the data comes from the startup cache. We should test for // Otherwise the data comes from the startup cache. We should test for
// this. // this.
"resource://gre/modules/ExtensionPermissions.jsm", "resource://gre/modules/ExtensionPermissions.sys.mjs",
"resource://gre/modules/ExtensionProcessScript.jsm", "resource://gre/modules/ExtensionProcessScript.sys.mjs",
"resource://gre/modules/ExtensionUtils.jsm", "resource://gre/modules/ExtensionUtils.sys.mjs",
"resource://gre/modules/ExtensionTelemetry.jsm", "resource://gre/modules/ExtensionTelemetry.sys.mjs",
]); ]);
if (!Services.prefs.getBoolPref("extensions.webextensions.remote")) { if (!Services.prefs.getBoolPref("extensions.webextensions.remote")) {
STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.jsm"); STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.sys.mjs");
STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.jsm"); STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.sys.mjs");
} }
if (AppConstants.MOZ_APP_NAME == "thunderbird") { if (AppConstants.MOZ_APP_NAME == "thunderbird") {
// Imported via mail/components/extensions/processScript.js. // Imported via mail/components/extensions/processScript.js.
STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.jsm"); STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.sys.mjs");
STARTUP_MODULES.add("resource://gre/modules/ExtensionContent.jsm"); STARTUP_MODULES.add("resource://gre/modules/ExtensionContent.sys.mjs");
STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.jsm"); STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.sys.mjs");
} }
AddonTestUtils.init(this); AddonTestUtils.init(this);

View file

@ -2,13 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["SecurityInfo"];
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const wpl = Ci.nsIWebProgressListener; const wpl = Ci.nsIWebProgressListener;
const lazy = {}; const lazy = {};
@ -30,7 +24,7 @@ XPCOMUtils.defineLazyServiceGetter(
// to better support the WebRequest api. The objects returned are formatted specifically // to better support the WebRequest api. The objects returned are formatted specifically
// to pass through as part of a response to webRequest listeners. // to pass through as part of a response to webRequest listeners.
const SecurityInfo = { export const SecurityInfo = {
/** /**
* Extracts security information from nsIChannel.securityInfo. * Extracts security information from nsIChannel.securityInfo.
* *

View file

@ -2,19 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const EXPORTED_SYMBOLS = ["WebRequest"];
/* exported WebRequest */
/* globals ChannelWrapper */
const { nsIHttpActivityObserver, nsISocketTransport } = Ci; const { nsIHttpActivityObserver, nsISocketTransport } = Ci;
const { XPCOMUtils } = ChromeUtils.importESModule( import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const lazy = {}; const lazy = {};
@ -1306,7 +1296,7 @@ var onResponseStarted = new HttpEvent("onResponseStarted", ["responseHeaders"]);
var onCompleted = new HttpEvent("onCompleted", ["responseHeaders"]); var onCompleted = new HttpEvent("onCompleted", ["responseHeaders"]);
var onErrorOccurred = new HttpEvent("onErrorOccurred"); var onErrorOccurred = new HttpEvent("onErrorOccurred");
var WebRequest = { export var WebRequest = {
setDNRHandlingEnabled: dnrActive => { setDNRHandlingEnabled: dnrActive => {
HttpObserverManager.setDNRHandlingEnabled(dnrActive); HttpObserverManager.setDNRHandlingEnabled(dnrActive);
}, },

View file

@ -2,15 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"; import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs";
const EXPORTED_SYMBOLS = ["WebRequestUpload"];
/* exported WebRequestUpload */
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
const { ExtensionUtils } = ChromeUtils.import( const { ExtensionUtils } = ChromeUtils.import(
"resource://gre/modules/ExtensionUtils.jsm" "resource://gre/modules/ExtensionUtils.jsm"
@ -38,7 +30,7 @@ const ConverterInputStream = Components.Constructor(
"init" "init"
); );
var WebRequestUpload; export var WebRequestUpload;
/** /**
* Parses the given raw header block, and stores the value of each * Parses the given raw header block, and stores the value of each

View file

@ -5,9 +5,9 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXTRA_JS_MODULES += [ EXTRA_JS_MODULES += [
"SecurityInfo.jsm", "SecurityInfo.sys.mjs",
"WebRequest.jsm", "WebRequest.sys.mjs",
"WebRequestUpload.jsm", "WebRequestUpload.sys.mjs",
] ]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [