Use a 1-byte enum class for TextDirection
[WebKit-https.git] / Source / WebCore / dom / MessageEvent.idl
index 74750a3..fa48c8f 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2007 Henry Mason <hmason@mac.com>
  * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  *
  */
 
+#if defined(ENABLE_SERVICE_WORKER) && ENABLE_SERVICE_WORKER
+typedef (WindowProxy or MessagePort or ServiceWorker) MessageEventSource;
+#else
+typedef (WindowProxy or MessagePort) MessageEventSource;
+#endif
+
 [
+    Constructor(DOMString type, optional MessageEventInit eventInitDict),
     Exposed=(Window,Worker),
-    ConstructorTemplate=Event,
+    JSCustomMarkFunction,
 ] interface MessageEvent : Event {
-    [InitializedByEventConstructor] readonly attribute DOMString origin;
-    [InitializedByEventConstructor] readonly attribute DOMString lastEventId;
-    [InitializedByEventConstructor] readonly attribute EventTarget source; // May be a DOMWindow or a MessagePort.
-#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
-    [InitializedByEventConstructor, CachedAttribute, CustomGetter] readonly attribute any data;
-    [InitializedByEventConstructor] readonly attribute MessagePort[] ports;
-
-    [Custom] void initMessageEvent([Default=Undefined] optional DOMString typeArg, 
-                                   [Default=Undefined] optional boolean canBubbleArg, 
-                                   [Default=Undefined] optional boolean cancelableArg, 
-                                   [Default=Undefined] optional any dataArg, 
-                                   [Default=Undefined] optional DOMString originArg, 
-                                   [Default=Undefined] optional DOMString lastEventIdArg, 
-                                   [Default=Undefined] optional DOMWindow sourceArg, 
-                                   [Default=Undefined] optional Array messagePorts);
-
-    [Custom] void webkitInitMessageEvent([Default=Undefined] optional DOMString typeArg,
-                                         [Default=Undefined] optional boolean canBubbleArg,
-                                         [Default=Undefined] optional boolean cancelableArg,
-                                         [Default=Undefined] optional any dataArg,
-                                         [Default=Undefined] optional DOMString originArg,
-                                         [Default=Undefined] optional DOMString lastEventIdArg,
-                                         [Default=Undefined] optional DOMWindow sourceArg,
-                                         [Default=Undefined] optional Array transferables);
-#else
-    // Code generator for ObjC bindings does not support custom bindings, thus there is no good way to
-    // return a variant value. As workaround, expose the data attribute as SerializedScriptValue.
-    readonly attribute SerializedScriptValue data;
-
-    // There's no good way to expose an array via the ObjC bindings, so for now just expose a single port.
-    readonly attribute MessagePort messagePort;
-
-    void initMessageEvent([Default=Undefined] optional DOMString typeArg, 
-                          [Default=Undefined] optional boolean canBubbleArg, 
-                          [Default=Undefined] optional boolean cancelableArg, 
-                          [Default=Undefined] optional SerializedScriptValue dataArg, 
-                          [Default=Undefined] optional DOMString originArg, 
-                          [Default=Undefined] optional DOMString lastEventIdArg, 
-                          [Default=Undefined] optional DOMWindow sourceArg, 
-                          [Default=Undefined] optional MessagePort messagePort);
-#endif
+    readonly attribute USVString origin;
+    readonly attribute DOMString lastEventId;
+    readonly attribute MessageEventSource? source;
+    [CustomGetter] readonly attribute any data;
+    readonly attribute FrozenArray<MessagePort> ports;
 
+    void initMessageEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false,
+        optional any data = null, optional USVString originArg = "", optional DOMString lastEventId = "", optional MessageEventSource? source = null,
+        optional sequence<MessagePort> messagePorts = []);
 };
 
+dictionary MessageEventInit : EventInit {
+    any data = null;
+    USVString origin = "";
+    DOMString lastEventId = "";
+    MessageEventSource? source = null;
+    sequence<MessagePort> ports = [];
+};