forked from mirrors/gecko-dev
		
	Bug 1824612 - Convert toolkit/components/extensions to ES modules. r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D175553
This commit is contained in:
		
							parent
							
								
									1817114384
								
							
						
					
					
						commit
						18318190a5
					
				
					 52 changed files with 198 additions and 474 deletions
				
			
		|  | @ -42,8 +42,8 @@ const known_scripts = { | |||
|     "resource://gre/modules/TelemetryControllerContent.sys.mjs", // bug 1470339
 | ||||
| 
 | ||||
|     // Extensions
 | ||||
|     "resource://gre/modules/ExtensionProcessScript.jsm", | ||||
|     "resource://gre/modules/ExtensionUtils.jsm", | ||||
|     "resource://gre/modules/ExtensionProcessScript.sys.mjs", | ||||
|     "resource://gre/modules/ExtensionUtils.sys.mjs", | ||||
|   ]), | ||||
|   frameScripts: new Set([ | ||||
|     // Test related
 | ||||
|  |  | |||
|  | @ -48,8 +48,8 @@ const known_scripts = { | |||
|     "resource://gre/modules/TelemetryControllerContent.sys.mjs", // bug 1470339
 | ||||
| 
 | ||||
|     // Extensions
 | ||||
|     "resource://gre/modules/ExtensionProcessScript.jsm", | ||||
|     "resource://gre/modules/ExtensionUtils.jsm", | ||||
|     "resource://gre/modules/ExtensionProcessScript.sys.mjs", | ||||
|     "resource://gre/modules/ExtensionUtils.sys.mjs", | ||||
|   ]), | ||||
|   processScripts: new Set([ | ||||
|     "chrome://global/content/process-content.js", | ||||
|  |  | |||
|  | @ -1,7 +1,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * This @file implements the child side of Conduits, an abstraction over | ||||
|  | @ -15,17 +14,11 @@ | |||
|  * @property {object} arg | ||||
|  */ | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = [ | ||||
|   "BaseConduit", | ||||
|   "ConduitsChild", | ||||
|   "ProcessConduitsChild", | ||||
| ]; | ||||
| 
 | ||||
| /** | ||||
|  * Base class for both child (Point) and parent (Broadcast) side of conduits, | ||||
|  * handles setting up send/receive method stubs. | ||||
|  */ | ||||
| class BaseConduit { | ||||
| export class BaseConduit { | ||||
|   /** | ||||
|    * @param {object} subject | ||||
|    * @param {ConduitAddress} address | ||||
|  | @ -154,7 +147,7 @@ class PointConduit extends BaseConduit { | |||
| /** | ||||
|  * Implements the child side of the Conduits actor, manages conduit lifetimes. | ||||
|  */ | ||||
| class ConduitsChild extends JSWindowActorChild { | ||||
| export class ConduitsChild extends JSWindowActorChild { | ||||
|   constructor() { | ||||
|     super(); | ||||
|     this.conduits = new Map(); | ||||
|  | @ -210,7 +203,7 @@ class ConduitsChild extends JSWindowActorChild { | |||
| /** | ||||
|  * Child side of the Conduits process actor.  Same code as JSWindowActor. | ||||
|  */ | ||||
| class ProcessConduitsChild extends JSProcessActorChild { | ||||
| export class ProcessConduitsChild extends JSProcessActorChild { | ||||
|   constructor() { | ||||
|     super(); | ||||
|     this.conduits = new Map(); | ||||
|  | @ -1,13 +1,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = [ | ||||
|   "BroadcastConduit", | ||||
|   "ConduitsParent", | ||||
|   "ProcessConduitsParent", | ||||
| ]; | ||||
| 
 | ||||
| /** | ||||
|  * 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, | ||||
|  * and can target specific child conduits when sending. | ||||
|  */ | ||||
| class BroadcastConduit extends BaseConduit { | ||||
| export class BroadcastConduit extends BaseConduit { | ||||
|   /** | ||||
|    * @param {object} subject | ||||
|    * @param {ConduitAddress} address | ||||
|  | @ -390,7 +383,7 @@ class BroadcastConduit extends BaseConduit { | |||
| /** | ||||
|  * Implements the parent side of the Conduits actor. | ||||
|  */ | ||||
| class ConduitsParent extends JSWindowActorParent { | ||||
| export class ConduitsParent extends JSWindowActorParent { | ||||
|   constructor() { | ||||
|     super(); | ||||
|     this.batchData = []; | ||||
|  | @ -477,7 +470,7 @@ class ConduitsParent extends JSWindowActorParent { | |||
| /** | ||||
|  * Parent side of the Conduits process actor.  Same code as JSWindowActor. | ||||
|  */ | ||||
| class ProcessConduitsParent extends JSProcessActorParent { | ||||
| export class ProcessConduitsParent extends JSProcessActorParent { | ||||
|   receiveMessage = ConduitsParent.prototype.receiveMessage; | ||||
|   willDestroy = ConduitsParent.prototype.willDestroy; | ||||
|   didDestroy = ConduitsParent.prototype.didDestroy; | ||||
|  | @ -3,21 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "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 | ||||
|  | @ -41,12 +26,9 @@ var EXPORTED_SYMBOLS = [ | |||
|  * to run in the same process of the existing addon debugging browser element). | ||||
|  */ | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -192,6 +174,8 @@ var { | |||
|   apiManager: Management, | ||||
| } = ExtensionParent; | ||||
| 
 | ||||
| export { Management }; | ||||
| 
 | ||||
| const { getUniqueId, promiseTimeout } = ExtensionUtils; | ||||
| 
 | ||||
| const { EventEmitter, updateAllowedOrigins } = ExtensionCommon; | ||||
|  | @ -663,7 +647,7 @@ ExtensionAddonObserver.init(); | |||
|  * Observer ExtensionProcess crashes and notify all the extensions | ||||
|  * using a Management event named "extension-process-crash". | ||||
|  */ | ||||
| var ExtensionProcessCrashObserver = { | ||||
| export var ExtensionProcessCrashObserver = { | ||||
|   initialized: false, | ||||
|   // Technically there is at most one child extension process,
 | ||||
|   // 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 | ||||
|  * `loadManifest` has been called, and completed. | ||||
|  */ | ||||
| class ExtensionData { | ||||
| export class ExtensionData { | ||||
|   constructor(rootURI, isPrivileged = false) { | ||||
|     this.rootURI = rootURI; | ||||
|     this.resourceURL = rootURI.spec; | ||||
|  | @ -2682,7 +2666,7 @@ let pendingExtensions = new Map(); | |||
|  * | ||||
|  * @augments ExtensionData | ||||
|  */ | ||||
| class Extension extends ExtensionData { | ||||
| export class Extension extends ExtensionData { | ||||
|   constructor(addonData, startupReason, updateReason) { | ||||
|     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) { | ||||
|     super(addonData.resourceURI); | ||||
|     this.id = addonData.id; | ||||
|  | @ -3760,7 +3744,7 @@ class Dictionary extends ExtensionData { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| class Langpack extends ExtensionData { | ||||
| export class Langpack extends ExtensionData { | ||||
|   constructor(addonData, startupReason) { | ||||
|     super(addonData.resourceURI); | ||||
|     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.
 | ||||
| class SitePermission extends ExtensionData { | ||||
| export class SitePermission extends ExtensionData { | ||||
|   constructor(addonData, startupReason) { | ||||
|     super(addonData.resourceURI); | ||||
|     this.id = addonData.id; | ||||
|  | @ -3958,3 +3942,6 @@ class SitePermission extends ExtensionData { | |||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| // Exported for testing purposes.
 | ||||
| export { ExtensionAddonObserver, PRIVILEGED_PERMS }; | ||||
|  | @ -2,10 +2,6 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["BrowserActionBase", "PageActionBase"]; | ||||
| 
 | ||||
| const { ExtensionUtils } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
| ); | ||||
|  | @ -16,9 +12,7 @@ const { ExtensionParent } = ChromeUtils.import( | |||
| ); | ||||
| const { IconDetails, StartupCache } = ExtensionParent; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -389,7 +383,7 @@ class PanelActionBase { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| class PageActionBase extends PanelActionBase { | ||||
| export class PageActionBase extends PanelActionBase { | ||||
|   constructor(tabContext, extension) { | ||||
|     const options = extension.manifest.page_action; | ||||
|     super(options, tabContext, extension); | ||||
|  | @ -507,7 +501,7 @@ class PageActionBase extends PanelActionBase { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| class BrowserActionBase extends PanelActionBase { | ||||
| export class BrowserActionBase extends PanelActionBase { | ||||
|   constructor(tabContext, extension) { | ||||
|     const options = | ||||
|       extension.manifest.browser_action || extension.manifest.action; | ||||
|  | @ -1,13 +1,9 @@ | |||
| /* 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/. */
 | ||||
| "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( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
| ); | ||||
|  | @ -26,7 +22,7 @@ var { DefaultMap } = ExtensionUtils; | |||
| const MSG_SET_ENABLED = "Extension:ActivityLog:SetEnabled"; | ||||
| const MSG_LOG = "Extension:ActivityLog:DoLog"; | ||||
| 
 | ||||
| const ExtensionActivityLog = { | ||||
| export const ExtensionActivityLog = { | ||||
|   initialized: false, | ||||
| 
 | ||||
|   // id => Set(callbacks)
 | ||||
|  | @ -3,11 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /* exported ExtensionChild */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionChild", "ExtensionActivityLogChild"]; | ||||
| 
 | ||||
| /** | ||||
|  * 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. | ||||
|  */ | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -76,7 +68,7 @@ const { sharedData } = Services.cpmm; | |||
| const MSG_SET_ENABLED = "Extension:ActivityLog:SetEnabled"; | ||||
| const MSG_LOG = "Extension:ActivityLog:DoLog"; | ||||
| 
 | ||||
| const ExtensionActivityLogChild = { | ||||
| export const ExtensionActivityLogChild = { | ||||
|   _initialized: false, | ||||
|   enabledExtensions: new Set(), | ||||
| 
 | ||||
|  | @ -1042,7 +1034,7 @@ class ChildAPIManager { | |||
|   } | ||||
| } | ||||
| 
 | ||||
| var ExtensionChild = { | ||||
| export var ExtensionChild = { | ||||
|   BrowserExtensionContent, | ||||
|   ChildAPIManager, | ||||
|   ChildLocalAPIImplementation, | ||||
|  | @ -3,7 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * @file | ||||
|  | @ -11,11 +10,7 @@ | |||
|  * from the child process. | ||||
|  */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionChildDevToolsUtils"]; | ||||
| 
 | ||||
| const { EventEmitter } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/EventEmitter.sys.mjs" | ||||
| ); | ||||
| import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs"; | ||||
| 
 | ||||
| // Create a variable to hold the cached ThemeChangeObserver which does not
 | ||||
| // 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 | ||||
|    * initializes it with the current themeName. This cached instance is | ||||
|  | @ -3,7 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * This module contains utilities and base classes for logic which is | ||||
|  | @ -11,16 +10,9 @@ | |||
|  * between ExtensionParent.jsm and ExtensionChild.jsm. | ||||
|  */ | ||||
| 
 | ||||
| /* exported ExtensionCommon */ | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionCommon"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -69,7 +61,7 @@ function getConsole() { | |||
| 
 | ||||
| const BACKGROUND_SCRIPTS_VIEW_TYPES = ["background", "background_worker"]; | ||||
| 
 | ||||
| var ExtensionCommon; | ||||
| export var ExtensionCommon; | ||||
| 
 | ||||
| // Run a function and report exceptions.
 | ||||
| function runSafeSyncWithoutClone(f, ...args) { | ||||
|  | @ -3,16 +3,9 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionContent", "ExtensionContentChild"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -1129,7 +1122,7 @@ DocumentManager = { | |||
|   }, | ||||
| }; | ||||
| 
 | ||||
| var ExtensionContent = { | ||||
| export var ExtensionContent = { | ||||
|   BrowserExtensionContent, | ||||
| 
 | ||||
|   contentScripts, | ||||
|  | @ -1306,7 +1299,7 @@ var ExtensionContent = { | |||
| /** | ||||
|  * Child side of the ExtensionContent process actor, handles some tabs.* APIs. | ||||
|  */ | ||||
| class ExtensionContentChild extends JSProcessActorChild { | ||||
| export class ExtensionContentChild extends JSProcessActorChild { | ||||
|   receiveMessage({ name, data }) { | ||||
|     if (!lazy.isContentScriptProcess) { | ||||
|       return; | ||||
|  | @ -3,11 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /* exported ExtensionPageChild */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionPageChild", "getContextChildManagerGetter"]; | ||||
| 
 | ||||
| /** | ||||
|  * This file handles privileged extension page logic that runs in the | ||||
|  | @ -47,7 +42,7 @@ const { BaseContext, CanOfAPIs, SchemaAPIManager, defineLazyGetter } = | |||
| 
 | ||||
| const { ChildAPIManager, Messenger } = ExtensionChild; | ||||
| 
 | ||||
| var ExtensionPageChild; | ||||
| export var ExtensionPageChild; | ||||
| 
 | ||||
| const initializeBackgroundPage = context => { | ||||
|   // Override the `alert()` method inside background windows;
 | ||||
|  | @ -159,7 +154,7 @@ var devtoolsAPIManager = new (class extends SchemaAPIManager { | |||
|   } | ||||
| })(); | ||||
| 
 | ||||
| function getContextChildManagerGetter( | ||||
| export function getContextChildManagerGetter( | ||||
|   { envType }, | ||||
|   ChildAPIManagerClass = ChildAPIManager | ||||
| ) { | ||||
|  | @ -3,7 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * This module contains code for managing APIs that need to run in the | ||||
|  | @ -11,16 +10,9 @@ | |||
|  * to be proxied from ExtensionChild.jsm. | ||||
|  */ | ||||
| 
 | ||||
| /* exported ExtensionParent */ | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionParent"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -2276,7 +2268,7 @@ for (let name of StartupCache.STORE_NAMES) { | |||
|   StartupCache[name] = new CacheStore(name); | ||||
| } | ||||
| 
 | ||||
| var ExtensionParent = { | ||||
| export var ExtensionParent = { | ||||
|   GlobalManager, | ||||
|   HiddenExtensionPage, | ||||
|   IconDetails, | ||||
|  | @ -3,14 +3,9 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -36,17 +31,6 @@ XPCOMUtils.defineLazyGetter( | |||
|   () => 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() { | ||||
|   return { permissions: [], origins: [] }; | ||||
| } | ||||
|  | @ -332,7 +316,7 @@ function createStore(useRkv = AppConstants.NIGHTLY_BUILD) { | |||
| 
 | ||||
| let store = createStore(); | ||||
| 
 | ||||
| var ExtensionPermissions = { | ||||
| export var ExtensionPermissions = { | ||||
|   async _update(extensionId, perms) { | ||||
|     await store.put(extensionId, perms); | ||||
|     return lazy.StartupCache.permissions.set(extensionId, perms); | ||||
|  | @ -501,7 +485,7 @@ var ExtensionPermissions = { | |||
|   }, | ||||
| }; | ||||
| 
 | ||||
| var OriginControls = { | ||||
| export var OriginControls = { | ||||
|   allDomains: new MatchPattern("*://*/*"), | ||||
| 
 | ||||
|   /** | ||||
|  | @ -655,3 +639,12 @@ var OriginControls = { | |||
|     return null; | ||||
|   }, | ||||
| }; | ||||
| 
 | ||||
| // Constants exported for testing purpose.
 | ||||
| export { | ||||
|   OLD_JSON_FILENAME, | ||||
|   OLD_RKV_DIRNAME, | ||||
|   RKV_DIRNAME, | ||||
|   VERSION_KEY, | ||||
|   VERSION_VALUE, | ||||
| }; | ||||
|  | @ -3,7 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * @file | ||||
|  | @ -20,16 +19,13 @@ | |||
|  *              values that correspond to the prefs to be set. | ||||
|  */ | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["ExtensionPreferencesManager"]; | ||||
| let ExtensionPreferencesManager; | ||||
| export let ExtensionPreferencesManager; | ||||
| 
 | ||||
| const { Management } = ChromeUtils.import( | ||||
|   "resource://gre/modules/Extension.jsm" | ||||
| ); | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -1,7 +1,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * 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. | ||||
|  */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionProcessScript", "ExtensionAPIRequestHandler"]; | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -369,7 +363,7 @@ ExtensionManager = { | |||
|   }, | ||||
| }; | ||||
| 
 | ||||
| var ExtensionProcessScript = { | ||||
| export var ExtensionProcessScript = { | ||||
|   extensions, | ||||
| 
 | ||||
|   initExtension(extension) { | ||||
|  | @ -405,7 +399,7 @@ var ExtensionProcessScript = { | |||
|   }, | ||||
| }; | ||||
| 
 | ||||
| var ExtensionAPIRequestHandler = { | ||||
| export var ExtensionAPIRequestHandler = { | ||||
|   initExtensionWorker(policy, serviceWorkerInfo) { | ||||
|     let extension = extensions.get(policy); | ||||
| 
 | ||||
|  | @ -3,7 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const { ExtensionUtils } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
|  | @ -158,7 +157,7 @@ const store = new Store(); | |||
|  * | ||||
|  * @returns {object} | ||||
|  */ | ||||
| const makeInternalContentScript = ( | ||||
| export const makeInternalContentScript = ( | ||||
|   extension, | ||||
|   options, | ||||
|   prependBaseURL = false | ||||
|  | @ -207,7 +206,7 @@ const makeInternalContentScript = ( | |||
|  * | ||||
|  * @returns {object} | ||||
|  */ | ||||
| const makePublicContentScript = (extension, internalScript) => { | ||||
| export const makePublicContentScript = (extension, internalScript) => { | ||||
|   let script = { | ||||
|     id: internalScript.id, | ||||
|     allFrames: internalScript.allFrames, | ||||
|  | @ -235,7 +234,7 @@ const makePublicContentScript = (extension, internalScript) => { | |||
|   return script; | ||||
| }; | ||||
| 
 | ||||
| const ExtensionScriptingStore = { | ||||
| export const ExtensionScriptingStore = { | ||||
|   async initExtension(extension) { | ||||
|     let scripts; | ||||
| 
 | ||||
|  | @ -336,9 +335,3 @@ const ExtensionScriptingStore = { | |||
|     return store; | ||||
|   }, | ||||
| }; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = [ | ||||
|   "ExtensionScriptingStore", | ||||
|   "makeInternalContentScript", | ||||
|   "makePublicContentScript", | ||||
| ]; | ||||
|  | @ -3,7 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * @file | ||||
|  | @ -40,8 +39,6 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionSettingsStore"]; | ||||
| 
 | ||||
| const { ExtensionParent } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionParent.jsm" | ||||
| ); | ||||
|  | @ -334,7 +331,7 @@ function alterSetting(id, type, key, action) { | |||
|   return returnItem; | ||||
| } | ||||
| 
 | ||||
| var ExtensionSettingsStore = { | ||||
| export var ExtensionSettingsStore = { | ||||
|   SETTING_USER_SET, | ||||
| 
 | ||||
|   /** | ||||
|  | @ -1,10 +1,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /* exported ExtensionShortcuts */ | ||||
| const EXPORTED_SYMBOLS = ["ExtensionShortcuts", "ExtensionShortcutKeyMap"]; | ||||
| 
 | ||||
| const { ExtensionCommon } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionCommon.jsm" | ||||
|  | @ -69,7 +65,7 @@ function normalizeShortcut(shortcut) { | |||
|   return shortcut ? shortcut.replace(/\s+/g, "") : ""; | ||||
| } | ||||
| 
 | ||||
| class ExtensionShortcutKeyMap extends DefaultMap { | ||||
| export class ExtensionShortcutKeyMap extends DefaultMap { | ||||
|   async buildForAddonIds(addonIds) { | ||||
|     this.clear(); | ||||
|     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 about:addons manage shortcuts page. | ||||
|  */ | ||||
| class ExtensionShortcuts { | ||||
| export class ExtensionShortcuts { | ||||
|   static async removeCommandsFromStorage(extensionId) { | ||||
|     // Cleanup the updated commands. In some cases the extension is installed
 | ||||
|     // and uninstalled so quickly that `this.commands` hasn't loaded yet. To
 | ||||
|  | @ -3,13 +3,9 @@ | |||
| /* 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/. */
 | ||||
| "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 { | ||||
|   ExtensionUtils: { ExtensionError, DefaultWeakMap }, | ||||
| } = ChromeUtils.import("resource://gre/modules/ExtensionUtils.jsm"); | ||||
|  | @ -97,7 +93,7 @@ function serialize(name, anonymizedName, value) { | |||
|   return value; | ||||
| } | ||||
| 
 | ||||
| var ExtensionStorage = { | ||||
| export var ExtensionStorage = { | ||||
|   // Map<extension-id, Promise<JSONFile>>
 | ||||
|   jsonFilePromises: new Map(), | ||||
| 
 | ||||
|  | @ -492,7 +488,7 @@ XPCOMUtils.defineLazyGetter(ExtensionStorage, "extensionDir", () => | |||
| 
 | ||||
| ExtensionStorage.init(); | ||||
| 
 | ||||
| var extensionStorageSession = { | ||||
| export var extensionStorageSession = { | ||||
|   /** @type {WeakMap<Extension, Map<string, any>>} */ | ||||
|   buckets: new DefaultWeakMap(_extension => new Map()), | ||||
| 
 | ||||
|  | @ -2,17 +2,9 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["ExtensionStorageIDB"]; | ||||
| let ExtensionStorageIDB; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { IndexedDB } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/IndexedDB.sys.mjs" | ||||
| ); | ||||
| export let ExtensionStorageIDB; | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| import { IndexedDB } from "resource://gre/modules/IndexedDB.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -3,15 +3,10 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionStorageSync", "extensionStorageSync"]; | ||||
| 
 | ||||
| const STORAGE_SYNC_ENABLED_PREF = "webextensions.storage.sync.enabled"; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| 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.
 | ||||
| class ExtensionStorageSync { | ||||
| export class ExtensionStorageSync { | ||||
|   constructor() { | ||||
|     this.listeners = new Map(); | ||||
|     // 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(); | ||||
|  | @ -3,22 +3,14 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| // TODO:
 | ||||
| // * find out how the Chrome implementation deals with conflicts
 | ||||
| 
 | ||||
| // TODO bug 1637465: Remove the Kinto-based storage implementation.
 | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = [ | ||||
|   "ExtensionStorageSyncKinto", | ||||
|   "KintoStorageTestUtils", | ||||
|   "extensionStorageSyncKinto", | ||||
| ]; | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| const KINTO_PROD_SERVER_URL = | ||||
|   "https://webextensions.settings.services.mozilla.com/v1"; | ||||
| 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
 | ||||
| const KINTO_REQUEST_TIMEOUT = 30000; | ||||
| 
 | ||||
| const { Log } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/Log.sys.mjs" | ||||
| ); | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { Log } from "resource://gre/modules/Log.sys.mjs"; | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const { ExtensionUtils } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
| ); | ||||
|  | @ -131,7 +120,7 @@ function throwIfNoFxA(fxAccounts, action) { | |||
| // Global ExtensionStorageSyncKinto instance that extensions and Fx Sync use.
 | ||||
| // On Android, because there's no FXAccounts instance, any syncing
 | ||||
| // operations will fail.
 | ||||
| var extensionStorageSyncKinto = null; | ||||
| export var extensionStorageSyncKinto = null; | ||||
| 
 | ||||
| /** | ||||
|  * Utility function to enforce an order of fields when computing an HMAC. | ||||
|  | @ -735,7 +724,7 @@ const openCollection = async function (extension, options = {}) { | |||
|   return coll; | ||||
| }; | ||||
| 
 | ||||
| class ExtensionStorageSyncKinto { | ||||
| export class ExtensionStorageSyncKinto { | ||||
|   /** | ||||
|    * @param {FXAccounts} fxaService (Optional) If not | ||||
|    *    present, trying to sync will fail. | ||||
|  | @ -1376,10 +1365,11 @@ class ExtensionStorageSyncKinto { | |||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| extensionStorageSyncKinto = new ExtensionStorageSyncKinto(_fxaService); | ||||
| 
 | ||||
| // For test use only.
 | ||||
| const KintoStorageTestUtils = { | ||||
| export const KintoStorageTestUtils = { | ||||
|   CollectionKeyEncryptionRemoteTransformer, | ||||
|   CryptoCollection, | ||||
|   EncryptionRemoteTransformer, | ||||
|  | @ -3,13 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = [ | ||||
|   "ExtensionTelemetry", | ||||
|   "getTrimmedString", | ||||
|   "getErrorNameForTelemetry", | ||||
| ]; | ||||
| 
 | ||||
| // Map of the base histogram ids for the metrics recorded for the extensions.
 | ||||
| const histograms = { | ||||
|  | @ -38,7 +31,7 @@ const histograms = { | |||
|  *          The trimmed version of the string when longer than 80 chars, or the given string | ||||
|  *          unmodified otherwise. | ||||
|  */ | ||||
| function getTrimmedString(str) { | ||||
| export function getTrimmedString(str) { | ||||
|   if (str.length <= 80) { | ||||
|     return str; | ||||
|   } | ||||
|  | @ -65,7 +58,7 @@ function getTrimmedString(str) { | |||
|  *          - "NoError" if error is falsey. | ||||
|  *          - "UnkownError" as a fallback. | ||||
|  */ | ||||
| function getErrorNameForTelemetry(error) { | ||||
| export function getErrorNameForTelemetry(error) { | ||||
|   let text = "UnknownError"; | ||||
|   if (!error) { | ||||
|     text = "NoError"; | ||||
|  | @ -201,7 +194,7 @@ const metricsCache = new Map(); | |||
|  *      ExtensionTelemetry.extensionStartup.stopwatchStart(extension); | ||||
|  *      ExtensionTelemetry.browserActionPreloadResult.histogramAdd({category: "Shown", extension}); | ||||
|  */ | ||||
| var ExtensionTelemetry = new Proxy(metricsCache, { | ||||
| export var ExtensionTelemetry = new Proxy(metricsCache, { | ||||
|   get(target, prop, receiver) { | ||||
|     if (!(prop in histograms)) { | ||||
|       throw new Error(`Unknown metric ${prop}`); | ||||
|  | @ -3,20 +3,13 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * This module contains extension testing helper logic which is common | ||||
|  * between all test suites. | ||||
|  */ | ||||
| 
 | ||||
| /* exported ExtensionTestCommon, MockExtension */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionTestCommon", "MockExtension"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -25,9 +18,8 @@ ChromeUtils.defineModuleGetter( | |||
|   "AddonManager", | ||||
|   "resource://gre/modules/AddonManager.jsm" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| ChromeUtils.defineESModuleGetters(lazy, { | ||||
|   Assert: "resource://testing-common/Assert.sys.mjs", | ||||
|   FileUtils: "resource://gre/modules/FileUtils.sys.mjs", | ||||
|  | @ -69,7 +61,7 @@ const { flushJarCache } = ExtensionUtils; | |||
| 
 | ||||
| const { instanceOf } = ExtensionCommon; | ||||
| 
 | ||||
| var ExtensionTestCommon; | ||||
| export var ExtensionTestCommon; | ||||
| 
 | ||||
| /** | ||||
|  * A skeleton Extension-like object, used for testing, which installs an | ||||
|  | @ -81,7 +73,7 @@ var ExtensionTestCommon; | |||
|  * @param {nsIURI} rootURI | ||||
|  * @param {string} installType | ||||
|  */ | ||||
| class MockExtension { | ||||
| export class MockExtension { | ||||
|   constructor(file, rootURI, addonData) { | ||||
|     this.id = null; | ||||
|     this.file = file; | ||||
|  | @ -3,13 +3,8 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionUtils"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -333,7 +328,7 @@ async function makeDataURI(iconUrl) { | |||
|   return `data:${contentType};base64,${btoa(str)}`; | ||||
| } | ||||
| 
 | ||||
| var ExtensionUtils = { | ||||
| export var ExtensionUtils = { | ||||
|   flushJarCache, | ||||
|   getInnerWindowID, | ||||
|   getMessageManager, | ||||
|  | @ -3,11 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /* exported ExtensionWorkerChild */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionWorkerChild"]; | ||||
| 
 | ||||
| /** | ||||
|  * 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>
 | ||||
|   extensionWorkerContexts: new Map(), | ||||
| 
 | ||||
|  | @ -3,16 +3,9 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["ExtensionTestUtils"]; | ||||
| 
 | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| const { XPCShellContentUtils } = ChromeUtils.importESModule( | ||||
|   "resource://testing-common/XPCShellContentUtils.sys.mjs" | ||||
| ); | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| import { XPCShellContentUtils } from "resource://testing-common/XPCShellContentUtils.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -618,7 +611,7 @@ class ExternallyInstalledWrapper extends AOMExtensionWrapper { | |||
|   maybeSetID(uri, id) {} | ||||
| } | ||||
| 
 | ||||
| var ExtensionTestUtils = { | ||||
| export var ExtensionTestUtils = { | ||||
|   BASE_MANIFEST, | ||||
| 
 | ||||
|   get testAssertions() { | ||||
|  | @ -3,21 +3,16 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["FindContent"]; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
| /* exported FindContent */ | ||||
| 
 | ||||
| ChromeUtils.defineESModuleGetters(lazy, { | ||||
|   Finder: "resource://gre/modules/Finder.sys.mjs", | ||||
|   FinderHighlighter: "resource://gre/modules/FinderHighlighter.sys.mjs", | ||||
|   FinderIterator: "resource://gre/modules/FinderIterator.sys.mjs", | ||||
| }); | ||||
| 
 | ||||
| class FindContent { | ||||
| export class FindContent { | ||||
|   constructor(docShell) { | ||||
|     this.finder = new lazy.Finder(docShell); | ||||
|   } | ||||
|  | @ -2,14 +2,8 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /* exported MatchURLFilters */ | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["MatchURLFilters"]; | ||||
| 
 | ||||
| // Match WebNavigation URL Filters.
 | ||||
| class MatchURLFilters { | ||||
| export class MatchURLFilters { | ||||
|   constructor(filters) { | ||||
|     if (!Array.isArray(filters)) { | ||||
|       throw new TypeError("filters should be an array"); | ||||
|  | @ -3,7 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * This module provides wrappers around standard message managers to | ||||
|  | @ -97,12 +96,10 @@ | |||
|  * | ||||
|  */ | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["MessageChannel"]; | ||||
| let MessageChannel; | ||||
| export 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( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
| ); | ||||
|  | @ -3,9 +3,6 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["MessageManagerProxy"]; | ||||
| 
 | ||||
| const { ExtensionUtils } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
|  | @ -22,7 +19,7 @@ const { DefaultMap } = ExtensionUtils; | |||
|  *        The target message manager on which to send messages, or the | ||||
|  *        <browser> element which owns it. | ||||
|  */ | ||||
| class MessageManagerProxy { | ||||
| export class MessageManagerProxy { | ||||
|   constructor(target) { | ||||
|     this.listeners = new DefaultMap(() => new Map()); | ||||
|     this.closed = false; | ||||
|  | @ -3,16 +3,9 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["NativeManifests"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -38,7 +31,7 @@ const NATIVE_MANIFEST_SCHEMA = | |||
| 
 | ||||
| const REGPATH = "Software\\Mozilla"; | ||||
| 
 | ||||
| var NativeManifests = { | ||||
| export var NativeManifests = { | ||||
|   _initializePromise: null, | ||||
|   _lookup: null, | ||||
| 
 | ||||
|  | @ -3,20 +3,10 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["NativeApp"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "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" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| import { EventEmitter } from "resource://gre/modules/EventEmitter.sys.mjs"; | ||||
| 
 | ||||
| const { | ||||
|   ExtensionUtils: { ExtensionError, promiseTimeout }, | ||||
|  | @ -54,7 +44,7 @@ const PREF_MAX_READ = "webextensions.native-messaging.max-input-message-bytes"; | |||
| const PREF_MAX_WRITE = | ||||
|   "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 {string} application The identifier of the native app. | ||||
|  | @ -3,24 +3,16 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| /** | ||||
|  * This module contains a global counter to store API call in the current process. | ||||
|  */ | ||||
| 
 | ||||
| /* exported Counters */ | ||||
| var EXPORTED_SYMBOLS = ["PerformanceCounters"]; | ||||
| 
 | ||||
| const { ExtensionUtils } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
| ); | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| const { DeferredTask } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/DeferredTask.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| import { DeferredTask } from "resource://gre/modules/DeferredTask.sys.mjs"; | ||||
| 
 | ||||
| const { DefaultMap } = ExtensionUtils; | ||||
| 
 | ||||
|  | @ -68,7 +60,7 @@ class CounterMap extends DefaultMap { | |||
| var _performanceCountersSender = null; | ||||
| 
 | ||||
| // Pre-definition of the global Counters instance.
 | ||||
| var PerformanceCounters = null; | ||||
| export var PerformanceCounters = null; | ||||
| 
 | ||||
| function _sendPerformanceCounters(childApiManagerId) { | ||||
|   let counters = PerformanceCounters.flush(); | ||||
|  | @ -3,15 +3,9 @@ | |||
| /* 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/. */
 | ||||
| "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( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
| ); | ||||
|  | @ -278,7 +272,7 @@ function normalizeFilter(filter) { | |||
|   }; | ||||
| } | ||||
| 
 | ||||
| class ProxyChannelFilter { | ||||
| export class ProxyChannelFilter { | ||||
|   constructor(context, extension, listener, filter, extraInfoSpec) { | ||||
|     this.context = context; | ||||
|     this.extension = extension; | ||||
|  | @ -3,14 +3,9 @@ | |||
| /* 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/. */
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const { ExtensionUtils } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
|  | @ -52,8 +47,7 @@ XPCOMUtils.defineLazyPreferenceGetter( | |||
|   false | ||||
| ); | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["SchemaRoot", "Schemas"]; | ||||
| let Schemas; | ||||
| export let Schemas; | ||||
| 
 | ||||
| const KEY_CONTENT_SCHEMAS = "extensions-framework/schemas/content"; | ||||
| 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 | ||||
|  *        populate this root namespace. | ||||
|  */ | ||||
| class SchemaRoot extends Namespace { | ||||
| export class SchemaRoot extends Namespace { | ||||
|   constructor(base, schemaJSON) { | ||||
|     super(null, "", []); | ||||
| 
 | ||||
|  | @ -2,13 +2,7 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["WebNavigation", "WebNavigationManager"]; | ||||
| 
 | ||||
| const { AppConstants } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/AppConstants.sys.mjs" | ||||
| ); | ||||
| import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -36,7 +30,7 @@ function getBrowser(bc) { | |||
|   return bc.top.embedderElement; | ||||
| } | ||||
| 
 | ||||
| var WebNavigationManager = { | ||||
| export var WebNavigationManager = { | ||||
|   // Map[string -> Map[listener -> URLFilter]]
 | ||||
|   listeners: new Map(), | ||||
| 
 | ||||
|  | @ -398,7 +392,7 @@ const EVENTS = [ | |||
|   "onCreatedNavigationTarget", | ||||
| ]; | ||||
| 
 | ||||
| var WebNavigation = {}; | ||||
| export var WebNavigation = {}; | ||||
| 
 | ||||
| for (let event of EVENTS) { | ||||
|   WebNavigation[event] = { | ||||
|  | @ -2,12 +2,6 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["WebNavigationFrames"]; | ||||
| 
 | ||||
| /* exported WebNavigationFrames */ | ||||
| 
 | ||||
| /** | ||||
|  * 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) { | ||||
|     // frameId 0 means the top-level frame; anything else is a child frame.
 | ||||
|     let frame = BrowsingContext.get(frameId || bc.id); | ||||
|  | @ -9,45 +9,45 @@ with Files("**"): | |||
|     BUG_COMPONENT = ("WebExtensions", "General") | ||||
| 
 | ||||
| EXTRA_JS_MODULES += [ | ||||
|     "ConduitsChild.jsm", | ||||
|     "ConduitsParent.jsm", | ||||
|     "Extension.jsm", | ||||
|     "ExtensionActions.jsm", | ||||
|     "ExtensionActivityLog.jsm", | ||||
|     "ExtensionChild.jsm", | ||||
|     "ExtensionChildDevToolsUtils.jsm", | ||||
|     "ExtensionCommon.jsm", | ||||
|     "ExtensionContent.jsm", | ||||
|     "ConduitsChild.sys.mjs", | ||||
|     "ConduitsParent.sys.mjs", | ||||
|     "Extension.sys.mjs", | ||||
|     "ExtensionActions.sys.mjs", | ||||
|     "ExtensionActivityLog.sys.mjs", | ||||
|     "ExtensionChild.sys.mjs", | ||||
|     "ExtensionChildDevToolsUtils.sys.mjs", | ||||
|     "ExtensionCommon.sys.mjs", | ||||
|     "ExtensionContent.sys.mjs", | ||||
|     "ExtensionDNR.sys.mjs", | ||||
|     "ExtensionDNRLimits.sys.mjs", | ||||
|     "ExtensionDNRStore.sys.mjs", | ||||
|     "ExtensionPageChild.jsm", | ||||
|     "ExtensionParent.jsm", | ||||
|     "ExtensionPageChild.sys.mjs", | ||||
|     "ExtensionParent.sys.mjs", | ||||
|     "ExtensionPermissionMessages.sys.mjs", | ||||
|     "ExtensionPermissions.jsm", | ||||
|     "ExtensionPreferencesManager.jsm", | ||||
|     "ExtensionProcessScript.jsm", | ||||
|     "ExtensionPermissions.sys.mjs", | ||||
|     "ExtensionPreferencesManager.sys.mjs", | ||||
|     "ExtensionProcessScript.sys.mjs", | ||||
|     "extensionProcessScriptLoader.js", | ||||
|     "ExtensionScriptingStore.jsm", | ||||
|     "ExtensionSettingsStore.jsm", | ||||
|     "ExtensionShortcuts.jsm", | ||||
|     "ExtensionStorage.jsm", | ||||
|     "ExtensionStorageIDB.jsm", | ||||
|     "ExtensionStorageSync.jsm", | ||||
|     "ExtensionStorageSyncKinto.jsm", | ||||
|     "ExtensionTelemetry.jsm", | ||||
|     "ExtensionUtils.jsm", | ||||
|     "ExtensionWorkerChild.jsm", | ||||
|     "FindContent.jsm", | ||||
|     "MatchURLFilters.jsm", | ||||
|     "MessageManagerProxy.jsm", | ||||
|     "NativeManifests.jsm", | ||||
|     "NativeMessaging.jsm", | ||||
|     "PerformanceCounters.jsm", | ||||
|     "ProxyChannelFilter.jsm", | ||||
|     "Schemas.jsm", | ||||
|     "WebNavigation.jsm", | ||||
|     "WebNavigationFrames.jsm", | ||||
|     "ExtensionScriptingStore.sys.mjs", | ||||
|     "ExtensionSettingsStore.sys.mjs", | ||||
|     "ExtensionShortcuts.sys.mjs", | ||||
|     "ExtensionStorage.sys.mjs", | ||||
|     "ExtensionStorageIDB.sys.mjs", | ||||
|     "ExtensionStorageSync.sys.mjs", | ||||
|     "ExtensionStorageSyncKinto.sys.mjs", | ||||
|     "ExtensionTelemetry.sys.mjs", | ||||
|     "ExtensionUtils.sys.mjs", | ||||
|     "ExtensionWorkerChild.sys.mjs", | ||||
|     "FindContent.sys.mjs", | ||||
|     "MatchURLFilters.sys.mjs", | ||||
|     "MessageManagerProxy.sys.mjs", | ||||
|     "NativeManifests.sys.mjs", | ||||
|     "NativeMessaging.sys.mjs", | ||||
|     "PerformanceCounters.sys.mjs", | ||||
|     "ProxyChannelFilter.sys.mjs", | ||||
|     "Schemas.sys.mjs", | ||||
|     "WebNavigation.sys.mjs", | ||||
|     "WebNavigationFrames.sys.mjs", | ||||
| ] | ||||
| 
 | ||||
| EXTRA_COMPONENTS += [ | ||||
|  | @ -55,11 +55,11 @@ EXTRA_COMPONENTS += [ | |||
| ] | ||||
| 
 | ||||
| TESTING_JS_MODULES += [ | ||||
|     "ExtensionTestCommon.jsm", | ||||
|     "ExtensionXPCShellUtils.jsm", | ||||
|     "MessageChannel.jsm", | ||||
|     "test/xpcshell/data/TestWorkerWatcherChild.jsm", | ||||
|     "test/xpcshell/data/TestWorkerWatcherParent.jsm", | ||||
|     "ExtensionTestCommon.sys.mjs", | ||||
|     "ExtensionXPCShellUtils.sys.mjs", | ||||
|     "MessageChannel.sys.mjs", | ||||
|     "test/xpcshell/data/TestWorkerWatcherChild.sys.mjs", | ||||
|     "test/xpcshell/data/TestWorkerWatcherParent.sys.mjs", | ||||
| ] | ||||
| 
 | ||||
| DIRS += [ | ||||
|  |  | |||
|  | @ -2,8 +2,6 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
| ChromeUtils.defineESModuleGetters(lazy, { | ||||
|  | @ -11,8 +9,6 @@ ChromeUtils.defineESModuleGetters(lazy, { | |||
|   FileUtils: "resource://gre/modules/FileUtils.sys.mjs", | ||||
| }); | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["StorageSyncService"]; | ||||
| 
 | ||||
| const StorageSyncArea = Components.Constructor( | ||||
|   "@mozilla.org/extensions/storage/internal/sync-area;1", | ||||
|   "mozIConfigurableExtensionStorageArea", | ||||
|  | @ -57,7 +53,7 @@ const StorageSyncArea = Components.Constructor( | |||
|  * | ||||
|  * @class | ||||
|  */ | ||||
| function StorageSyncService() { | ||||
| export function StorageSyncService() { | ||||
|   if (StorageSyncService._singleton) { | ||||
|     return StorageSyncService._singleton; | ||||
|   } | ||||
|  | @ -15,7 +15,7 @@ Classes = [ | |||
|     { | ||||
|         'cid': '{5b7047b4-fe17-4661-8e13-871402bc2023}', | ||||
|         'contract_ids': ['@mozilla.org/extensions/storage/sync;1'], | ||||
|         'jsm': 'resource://gre/modules/ExtensionStorageComponents.jsm', | ||||
|         'esModule': 'resource://gre/modules/ExtensionStorageComponents.sys.mjs', | ||||
|         'constructor': 'StorageSyncService', | ||||
|         'singleton': True, | ||||
|     }, | ||||
|  |  | |||
|  | @ -23,7 +23,7 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] != "android": | |||
|     ] | ||||
| 
 | ||||
|     EXTRA_JS_MODULES += [ | ||||
|         "ExtensionStorageComponents.jsm", | ||||
|         "ExtensionStorageComponents.sys.mjs", | ||||
|     ] | ||||
| 
 | ||||
|     XPCOM_MANIFESTS += [ | ||||
|  |  | |||
|  | @ -8,7 +8,7 @@ support-files = | |||
|   file_sample.html | ||||
|   file_with_images.html | ||||
|   webrequest_chromeworker.js | ||||
|   webrequest_test.jsm | ||||
|   webrequest_test.sys.mjs | ||||
| prefs = | ||||
|   security.mixed_content.upgrade_display_content=false | ||||
| tags = webextensions in-process-webextensions | ||||
|  |  | |||
|  | @ -1,8 +1,4 @@ | |||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["webrequest_test"]; | ||||
| 
 | ||||
| var webrequest_test = { | ||||
| export var webrequest_test = { | ||||
|   testFetch(url) { | ||||
|     return fetch(url); | ||||
|   }, | ||||
|  | @ -1,10 +1,4 @@ | |||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["TestWorkerWatcherChild"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -15,7 +9,7 @@ XPCOMUtils.defineLazyServiceGetter( | |||
|   "nsIWorkerDebuggerManager" | ||||
| ); | ||||
| 
 | ||||
| class TestWorkerWatcherChild extends JSProcessActorChild { | ||||
| export class TestWorkerWatcherChild extends JSProcessActorChild { | ||||
|   async receiveMessage(msg) { | ||||
|     switch (msg.name) { | ||||
|       case "Test:StartWatchingWorkers": | ||||
|  | @ -1,8 +1,4 @@ | |||
| "use strict"; | ||||
| 
 | ||||
| var EXPORTED_SYMBOLS = ["TestWorkerWatcherParent"]; | ||||
| 
 | ||||
| class TestWorkerWatcherParent extends JSProcessActorParent { | ||||
| export class TestWorkerWatcherParent extends JSProcessActorParent { | ||||
|   constructor() { | ||||
|     super(); | ||||
|     // This is set by the test helper that does use these process actors.
 | ||||
|  | @ -5,28 +5,28 @@ | |||
| const STARTUP_APIS = ["backgroundPage"]; | ||||
| 
 | ||||
| const STARTUP_MODULES = new Set([ | ||||
|   "resource://gre/modules/Extension.jsm", | ||||
|   "resource://gre/modules/ExtensionCommon.jsm", | ||||
|   "resource://gre/modules/ExtensionParent.jsm", | ||||
|   "resource://gre/modules/Extension.sys.mjs", | ||||
|   "resource://gre/modules/ExtensionCommon.sys.mjs", | ||||
|   "resource://gre/modules/ExtensionParent.sys.mjs", | ||||
|   // FIXME: This is only loaded at startup for new extension installs.
 | ||||
|   // Otherwise the data comes from the startup cache. We should test for
 | ||||
|   // this.
 | ||||
|   "resource://gre/modules/ExtensionPermissions.jsm", | ||||
|   "resource://gre/modules/ExtensionProcessScript.jsm", | ||||
|   "resource://gre/modules/ExtensionUtils.jsm", | ||||
|   "resource://gre/modules/ExtensionTelemetry.jsm", | ||||
|   "resource://gre/modules/ExtensionPermissions.sys.mjs", | ||||
|   "resource://gre/modules/ExtensionProcessScript.sys.mjs", | ||||
|   "resource://gre/modules/ExtensionUtils.sys.mjs", | ||||
|   "resource://gre/modules/ExtensionTelemetry.sys.mjs", | ||||
| ]); | ||||
| 
 | ||||
| if (!Services.prefs.getBoolPref("extensions.webextensions.remote")) { | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.jsm"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.jsm"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.sys.mjs"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.sys.mjs"); | ||||
| } | ||||
| 
 | ||||
| if (AppConstants.MOZ_APP_NAME == "thunderbird") { | ||||
|   // Imported via mail/components/extensions/processScript.js.
 | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.jsm"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionContent.jsm"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.jsm"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionChild.sys.mjs"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionContent.sys.mjs"); | ||||
|   STARTUP_MODULES.add("resource://gre/modules/ExtensionPageChild.sys.mjs"); | ||||
| } | ||||
| 
 | ||||
| AddonTestUtils.init(this); | ||||
|  |  | |||
|  | @ -2,13 +2,7 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["SecurityInfo"]; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const wpl = Ci.nsIWebProgressListener; | ||||
| const lazy = {}; | ||||
|  | @ -30,7 +24,7 @@ XPCOMUtils.defineLazyServiceGetter( | |||
| // to better support the WebRequest api.  The objects returned are formatted specifically
 | ||||
| // to pass through as part of a response to webRequest listeners.
 | ||||
| 
 | ||||
| const SecurityInfo = { | ||||
| export const SecurityInfo = { | ||||
|   /** | ||||
|    * Extracts security information from nsIChannel.securityInfo. | ||||
|    * | ||||
|  | @ -2,19 +2,9 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["WebRequest"]; | ||||
| 
 | ||||
| /* exported WebRequest */ | ||||
| 
 | ||||
| /* globals ChannelWrapper */ | ||||
| 
 | ||||
| const { nsIHttpActivityObserver, nsISocketTransport } = Ci; | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const lazy = {}; | ||||
| 
 | ||||
|  | @ -1306,7 +1296,7 @@ var onResponseStarted = new HttpEvent("onResponseStarted", ["responseHeaders"]); | |||
| var onCompleted = new HttpEvent("onCompleted", ["responseHeaders"]); | ||||
| var onErrorOccurred = new HttpEvent("onErrorOccurred"); | ||||
| 
 | ||||
| var WebRequest = { | ||||
| export var WebRequest = { | ||||
|   setDNRHandlingEnabled: dnrActive => { | ||||
|     HttpObserverManager.setDNRHandlingEnabled(dnrActive); | ||||
|   }, | ||||
|  | @ -2,15 +2,7 @@ | |||
|  * 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/. */
 | ||||
| 
 | ||||
| "use strict"; | ||||
| 
 | ||||
| const EXPORTED_SYMBOLS = ["WebRequestUpload"]; | ||||
| 
 | ||||
| /* exported WebRequestUpload */ | ||||
| 
 | ||||
| const { XPCOMUtils } = ChromeUtils.importESModule( | ||||
|   "resource://gre/modules/XPCOMUtils.sys.mjs" | ||||
| ); | ||||
| import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; | ||||
| 
 | ||||
| const { ExtensionUtils } = ChromeUtils.import( | ||||
|   "resource://gre/modules/ExtensionUtils.jsm" | ||||
|  | @ -38,7 +30,7 @@ const ConverterInputStream = Components.Constructor( | |||
|   "init" | ||||
| ); | ||||
| 
 | ||||
| var WebRequestUpload; | ||||
| export var WebRequestUpload; | ||||
| 
 | ||||
| /** | ||||
|  * Parses the given raw header block, and stores the value of each | ||||
|  | @ -5,9 +5,9 @@ | |||
| # file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||||
| 
 | ||||
| EXTRA_JS_MODULES += [ | ||||
|     "SecurityInfo.jsm", | ||||
|     "WebRequest.jsm", | ||||
|     "WebRequestUpload.jsm", | ||||
|     "SecurityInfo.sys.mjs", | ||||
|     "WebRequest.sys.mjs", | ||||
|     "WebRequestUpload.sys.mjs", | ||||
| ] | ||||
| 
 | ||||
| UNIFIED_SOURCES += [ | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Saira Abdulla
						Saira Abdulla