diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /toolkit/components/extensions/ExtensionChild.sys.mjs | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/ExtensionChild.sys.mjs')
-rw-r--r-- | toolkit/components/extensions/ExtensionChild.sys.mjs | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/toolkit/components/extensions/ExtensionChild.sys.mjs b/toolkit/components/extensions/ExtensionChild.sys.mjs index 70774db395..232d5cc659 100644 --- a/toolkit/components/extensions/ExtensionChild.sys.mjs +++ b/toolkit/components/extensions/ExtensionChild.sys.mjs @@ -15,6 +15,7 @@ import { XPCOMUtils } from "resource://gre/modules/XPCOMUtils.sys.mjs"; import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; +/** @type {Lazy} */ const lazy = {}; XPCOMUtils.defineLazyServiceGetter( @@ -144,7 +145,7 @@ const StrongPromise = { Services.obs.addObserver(StrongPromise, "extensions-onMessage-witness"); // Simple single-event emitter-like helper, exposes the EventManager api. -class SimpleEventAPI extends EventManager { +export class SimpleEventAPI extends EventManager { constructor(context, name) { let fires = new Set(); let register = fire => { @@ -162,7 +163,7 @@ class SimpleEventAPI extends EventManager { } // runtime.OnMessage event helper, handles custom async/sendResponse logic. -class MessageEvent extends SimpleEventAPI { +export class MessageEvent extends SimpleEventAPI { emit(holder, sender) { if (!this.fires.size || !this.context.active) { return { received: false }; @@ -229,7 +230,7 @@ function holdMessage(name, anonymizedName, data, native = null) { } // Implements the runtime.Port extension API object. -class Port { +export class Port { /** * @param {BaseContext} context The context that owns this port. * @param {number} portId Uniquely identifies this port's channel. @@ -310,7 +311,7 @@ class Port { * Each extension context gets its own Messenger object. It handles the * basics of sendMessage, onMessage, connect and onConnect. */ -class Messenger { +export class Messenger { constructor(context) { this.context = context; this.conduit = context.openConduit(this, { @@ -382,8 +383,11 @@ var ExtensionManager = { extensions: new Map(), }; -// Represents a browser extension in the content process. -class BrowserExtensionContent extends EventEmitter { +/** + * Represents an extension instance in the child process. + * Corresponds to the @see {Extension} instance in the parent. + */ +export class ExtensionChild extends EventEmitter { constructor(policy) { super(); @@ -580,7 +584,7 @@ class BrowserExtensionContent extends EventEmitter { /** * An object that runs an remote implementation of an API. */ -class ProxyAPIImplementation extends SchemaAPIInterface { +export class ProxyAPIImplementation extends SchemaAPIInterface { /** * @param {string} namespace The full path to the namespace that contains the * `name` member. This may contain dots, e.g. "storage.local". @@ -680,7 +684,7 @@ class ProxyAPIImplementation extends SchemaAPIInterface { } } -class ChildLocalAPIImplementation extends LocalAPIImplementation { +export class ChildLocalAPIImplementation extends LocalAPIImplementation { constructor(pathObj, namespace, name, childApiManager) { super(pathObj, name, childApiManager.context); this.childApiManagerId = childApiManager.id; @@ -730,7 +734,7 @@ class ChildLocalAPIImplementation extends LocalAPIImplementation { // JSProcessActor Conduits actors (see ConduitsChild.sys.mjs) to communicate // with the ParentAPIManager singleton in ExtensionParent.sys.mjs. // It handles asynchronous function calls as well as event listeners. -class ChildAPIManager { +export class ChildAPIManager { constructor(context, messageManager, localAPICan, contextData) { this.context = context; this.messageManager = messageManager; @@ -1012,14 +1016,3 @@ class ChildAPIManager { this.permissionsChangedCallbacks.add(callback); } } - -export var ExtensionChild = { - BrowserExtensionContent, - ChildAPIManager, - ChildLocalAPIImplementation, - MessageEvent, - Messenger, - Port, - ProxyAPIImplementation, - SimpleEventAPI, -}; |