1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * You are granted a license to use, reproduce and create derivative works of
9 * This IDL file is related to the WebExtensions browser.runtime's Port.
11 * More info about generating webidl API bindings for WebExtensions API at:
13 * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html
15 * A short summary of the special setup used by these WebIDL files (meant to aid
16 * webidl peers reviews and sign-offs) is available in the following section:
18 * https://firefox-source-docs.mozilla.org/toolkit/components/extensions/webextensions/webidl_bindings.html#review-process-on-changes-to-webidl-definitions
21 [Exposed=(ServiceWorker), LegacyNoInterfaceObject]
22 interface ExtensionPort {
24 readonly attribute DOMString name;
26 readonly attribute any sender;
28 readonly attribute any error;
30 [Throws, WebExtensionStub="NoReturn"]
31 undefined disconnect();
32 [Throws, WebExtensionStub="NoReturn"]
33 undefined postMessage(any message);
35 [Replaceable, SameObject]
36 readonly attribute ExtensionEventManager onDisconnect;
37 [Replaceable, SameObject]
38 readonly attribute ExtensionEventManager onMessage;
41 // Dictionary used by ExtensionAPIRequestForwarder and ExtensionCallabck to receive from the
42 // mozIExtensionAPIRequestHandler an internal description of a runtime.Port (and then used in
43 // the webidl implementation to create an ExtensionPort instance).
45 dictionary ExtensionPortDescriptor {
46 required DOMString portId;