Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / webidl / MessageEvent.webidl
blobe4f4ceac60f7e74a8ae5736cc373c6cd1e98982a
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
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * For more information on this interface, please see
7  * https://html.spec.whatwg.org/#messageevent
8  */
10 [Exposed=(Window,Worker,AudioWorklet), ProbablyShortLivingWrapper]
11 interface MessageEvent : Event {
12   constructor(DOMString type, optional MessageEventInit eventInitDict = {});
14   /**
15    * Custom data associated with this event.
16    */
17   [GetterThrows]
18   readonly attribute any data;
20   /**
21    * The origin of the site from which this event originated, which is the
22    * scheme, ":", and if the URI has a host, "//" followed by the
23    * host, and if the port is not the default for the given scheme,
24    * ":" followed by that port.  This value does not have a trailing slash.
25    */
26   readonly attribute USVString origin;
28   /**
29    * The last event ID string of the event source, for server-sent DOM events; this
30    * value is the empty string for cross-origin messaging.
31    */
32   readonly attribute DOMString lastEventId;
34   /**
35    * The window or port which originated this event.
36    */
37   readonly attribute MessageEventSource? source;
39   [Pure, Cached, Frozen]
40   readonly attribute sequence<MessagePort> ports;
42   /**
43    * Initializes this event with the given data, in a manner analogous to
44    * the similarly-named method on the Event interface, also setting the
45    * data, origin, source, and lastEventId attributes of this appropriately.
46    */
47   undefined initMessageEvent(DOMString type,
48                              optional boolean bubbles = false,
49                              optional boolean cancelable = false,
50                              optional any data = null,
51                              optional DOMString origin = "",
52                              optional DOMString lastEventId = "",
53                              optional MessageEventSource? source = null,
54                              optional sequence<MessagePort> ports = []);
57 dictionary MessageEventInit : EventInit {
58   any data = null;
59   DOMString origin = "";
60   DOMString lastEventId = "";
61   MessageEventSource? source = null;
62   sequence<MessagePort> ports = [];
65 typedef (WindowProxy or MessagePort or ServiceWorker) MessageEventSource;