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/.
5 *
6 * This IDL file is related to the WebExtensions browser.runtime's Port.
7 *
8 * You are granted a license to use, reproduce and create derivative works of
9 * this document.
10 */
11
12[Exposed=(ServiceWorker), LegacyNoInterfaceObject]
13interface ExtensionPort {
14  [Replaceable]
15  readonly attribute DOMString name;
16  [Replaceable]
17  readonly attribute any sender;
18  [Replaceable]
19  readonly attribute any error;
20
21  [Throws, WebExtensionStub="NoReturn"]
22  void disconnect();
23  [Throws, WebExtensionStub="NoReturn"]
24  void postMessage(any message);
25
26  [Replaceable, SameObject]
27  readonly attribute ExtensionEventManager onDisconnect;
28  [Replaceable, SameObject]
29  readonly attribute ExtensionEventManager onMessage;
30};
31
32// Dictionary used by ExtensionAPIRequestForwarder and ExtensionCallabck to receive from the
33// mozIExtensionAPIRequestHandler an internal description of a runtime.Port (and then used in
34// the webidl implementation to create an ExtensionPort instance).
35[GenerateInit]
36dictionary ExtensionPortDescriptor {
37  required DOMString portId;
38  DOMString name = "";
39};
40