<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[207016] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/207016">207016</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-10-10 13:21:30 -0700 (Mon, 10 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update MessageEvent to stop using legacy [ConstructorTemplate=Event]
https://bugs.webkit.org/show_bug.cgi?id=163187
Reviewed by Darin Adler.
Source/WebCore:
Update MessageEvent to stop using legacy [ConstructorTemplate=Event] and
use a regular constructor as in the specification:
- https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces
No new tests, updated existing test.
* bindings/js/JSDOMBinding.h:
(WebCore::toRefPtrNativeArray):
* bindings/js/JSDOMConvert.h:
(WebCore::convertWrapperTypeSequence):
(WebCore::convertWrapperType): Deleted.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDefaultValue):
(GenerateDictionaryImplementationContent):
(GetNativeType):
* dom/MessageEvent.cpp:
(WebCore::MessageEvent::MessageEvent):
(WebCore::MessageEvent::create):
(WebCore::MessageEvent::trySerializeData):
(WebCore::MessageEvent::createForBindings): Deleted.
(WebCore::MessageEvent::initMessageEvent): Deleted.
* dom/MessageEvent.h:
* dom/MessageEvent.idl:
LayoutTests:
Rebaseline existing test now that:
- Exception messages are sometimes a bit different
- We properly use the default member value when input is an explicit undefined
- We throw in more cases of bad input
* fast/events/constructors/message-event-constructor-expected.txt:
* fast/events/constructors/message-event-constructor.html:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfasteventsconstructorsmessageeventconstructorexpectedtxt">trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsconstructorsmessageeventconstructorhtml">trunk/LayoutTests/fast/events/constructors/message-event-constructor.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMConverth">trunk/Source/WebCore/bindings/js/JSDOMConvert.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCoredomMessageEventcpp">trunk/Source/WebCore/dom/MessageEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomMessageEventh">trunk/Source/WebCore/dom/MessageEvent.h</a></li>
<li><a href="#trunkSourceWebCoredomMessageEventidl">trunk/Source/WebCore/dom/MessageEvent.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/LayoutTests/ChangeLog        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-10-10 Chris Dumez <cdumez@apple.com>
+
+ Update MessageEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163187
+
+ Reviewed by Darin Adler.
+
+ Rebaseline existing test now that:
+ - Exception messages are sometimes a bit different
+ - We properly use the default member value when input is an explicit undefined
+ - We throw in more cases of bad input
+
+ * fast/events/constructors/message-event-constructor-expected.txt:
+ * fast/events/constructors/message-event-constructor.html:
+
</ins><span class="cx"> 2016-10-10 Antoine Quint <graouts@apple.com>
</span><span class="cx">
</span><span class="cx"> [Modern Media Controls] Buttons
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsconstructorsmessageeventconstructorexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/LayoutTests/fast/events/constructors/message-event-constructor-expected.txt        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -16,7 +16,7 @@
</span><span class="cx"> PASS new MessageEvent('eventType', { cancelable: true }).cancelable is true
</span><span class="cx"> PASS new MessageEvent('eventType', { data: test_object }).data is test_object
</span><span class="cx"> PASS new MessageEvent('eventType', { data: document }).data is document
</span><del>-PASS new MessageEvent('eventType', { data: undefined }).data is undefined
</del><ins>+PASS new MessageEvent('eventType', { data: undefined }).data is null
</ins><span class="cx"> PASS new MessageEvent('eventType', { data: null }).data is null
</span><span class="cx"> PASS new MessageEvent('eventType', { data: false }).data is false
</span><span class="cx"> PASS new MessageEvent('eventType', { data: true }).data is true
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> PASS new MessageEvent('eventType', { get data() { throw 'MessageEvent Error'; } }) threw exception MessageEvent Error.
</span><span class="cx"> PASS new MessageEvent('eventType', { origin: 'melancholy' }).origin is "melancholy"
</span><span class="cx"> PASS new MessageEvent('eventType', { origin: '' }).origin is ""
</span><del>-PASS new MessageEvent('eventType', { origin: undefined }).origin is "undefined"
</del><ins>+PASS new MessageEvent('eventType', { origin: undefined }).origin is ""
</ins><span class="cx"> PASS new MessageEvent('eventType', { origin: null }).origin is "null"
</span><span class="cx"> PASS new MessageEvent('eventType', { origin: false }).origin is "false"
</span><span class="cx"> PASS new MessageEvent('eventType', { origin: true }).origin is "true"
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> PASS new MessageEvent('eventType', { get origin() { throw 'MessageEvent Error'; } }) threw exception MessageEvent Error.
</span><span class="cx"> PASS new MessageEvent('eventType', { lastEventId: 'melancholy' }).lastEventId is "melancholy"
</span><span class="cx"> PASS new MessageEvent('eventType', { lastEventId: '' }).lastEventId is ""
</span><del>-PASS new MessageEvent('eventType', { lastEventId: undefined }).lastEventId is "undefined"
</del><ins>+PASS new MessageEvent('eventType', { lastEventId: undefined }).lastEventId is ""
</ins><span class="cx"> PASS new MessageEvent('eventType', { lastEventId: null }).lastEventId is "null"
</span><span class="cx"> PASS new MessageEvent('eventType', { lastEventId: false }).lastEventId is "false"
</span><span class="cx"> PASS new MessageEvent('eventType', { lastEventId: true }).lastEventId is "true"
</span><span class="lines">@@ -61,20 +61,20 @@
</span><span class="cx"> PASS new MessageEvent('eventType', { source: window }).source is window
</span><span class="cx"> PASS new MessageEvent('eventType', { source: this }).source is this
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: [channel.port1], source: channel.port1 }).source is channel.port1
</span><del>-PASS new MessageEvent('eventType', { source: test_object }).source is null
</del><ins>+PASS new MessageEvent('eventType', { source: test_object }).source threw exception TypeError: Type error.
</ins><span class="cx"> PASS new MessageEvent('eventType', { source: document }).source is null
</span><span class="cx"> PASS new MessageEvent('eventType', { source: document.body }).source is null
</span><span class="cx"> PASS new MessageEvent('eventType', { source: undefined }).source is null
</span><span class="cx"> PASS new MessageEvent('eventType', { source: null }).source is null
</span><del>-PASS new MessageEvent('eventType', { source: false }).source is null
-PASS new MessageEvent('eventType', { source: true }).source is null
-PASS new MessageEvent('eventType', { source: '' }).source is null
-PASS new MessageEvent('eventType', { source: 'chocolate' }).source is null
-PASS new MessageEvent('eventType', { source: 12345 }).source is null
-PASS new MessageEvent('eventType', { source: 18446744073709551615 }).source is null
-PASS new MessageEvent('eventType', { source: NaN }).source is null
-PASS new MessageEvent('eventType', { source: {valueOf: function () { return window; } } }).source == window is false
-PASS new MessageEvent('eventType', { get source() { return 123; } }).source is null
</del><ins>+PASS new MessageEvent('eventType', { source: false }).source threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { source: true }).source threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { source: '' }).source threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { source: 'chocolate' }).source threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { source: 12345 }).source threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { source: 18446744073709551615 }).source threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { source: NaN }).source threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { source: {valueOf: function () { return window; } } }) threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { get source() { return 123; } }).source threw exception TypeError: Type error.
</ins><span class="cx"> PASS new MessageEvent('eventType', { get source() { throw 'MessageEvent Error'; } }) threw exception MessageEvent Error.
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[0] is channel.port1
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[1] is channel.port2
</span><span class="lines">@@ -81,10 +81,10 @@
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[2] is channel2.port1
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: [] }).ports is []
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: undefined }).ports is []
</span><del>-PASS new MessageEvent('eventType', { ports: null }).ports is []
-PASS new MessageEvent('eventType', { ports: [1, 2, 3] }).ports[2] threw exception TypeError: Type error.
-PASS new MessageEvent('eventType', { ports: test_object }).ports threw exception TypeError: Value is not a sequence.
-PASS new MessageEvent('eventType', { ports: document }).ports threw exception TypeError: Value is not a sequence.
</del><ins>+PASS new MessageEvent('eventType', { ports: [1, 2, 3] }).ports[2] threw exception TypeError: Invalid Array element type.
+PASS new MessageEvent('eventType', { ports: test_object }).ports threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { ports: document }).ports threw exception TypeError: Type error.
+PASS new MessageEvent('eventType', { ports: null }).ports threw exception TypeError: Value is not a sequence.
</ins><span class="cx"> PASS new MessageEvent('eventType', { ports: false }).ports threw exception TypeError: Value is not a sequence.
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: true }).ports threw exception TypeError: Value is not a sequence.
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: '' }).ports threw exception TypeError: Value is not a sequence.
</span><span class="lines">@@ -93,8 +93,8 @@
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: 18446744073709551615 }).ports threw exception TypeError: Value is not a sequence.
</span><span class="cx"> PASS new MessageEvent('eventType', { ports: NaN }).ports threw exception TypeError: Value is not a sequence.
</span><span class="cx"> PASS new MessageEvent('eventType', { get ports() { return 123; } }).ports threw exception TypeError: Value is not a sequence.
</span><del>-PASS new MessageEvent('eventType', { get ports() { throw 'MessageEvent Error'; } }) threw exception MessageEvent Error.
-PASS new MessageEvent('eventType', { ports: {valueOf: function () { return [channel.port1, channel.port2, channel.port2]; } } }).ports[0] threw exception TypeError: Value is not a sequence.
</del><ins>+PASS new MessageEvent('eventType', { get ports() { throw 'MessageEvent Error'; } }) threw exception TypeError: Value is not a sequence.
+PASS new MessageEvent('eventType', { ports: {valueOf: function () { return [channel.port1, channel.port2, channel.port2]; } } }).ports[0] threw exception TypeError: Type error.
</ins><span class="cx"> PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel2.port1] }).bubbles is true
</span><span class="cx"> PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel2.port1] }).cancelable is true
</span><span class="cx"> PASS new MessageEvent('eventType', { bubbles: true, cancelable: true, data: test_object, origin: 'wonderful', lastEventId: 'excellent', source: window, ports: [channel.port1, channel.port2, channel2.port1] }).data is test_object
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsconstructorsmessageeventconstructorhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/constructors/message-event-constructor.html (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/constructors/message-event-constructor.html        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/LayoutTests/fast/events/constructors/message-event-constructor.html        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -30,8 +30,8 @@
</span><span class="cx"> // data is passed.
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { data: test_object }).data", "test_object");
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { data: document }).data", "document");
</span><del>-shouldBe("new MessageEvent('eventType', { data: undefined }).data", "undefined");
-shouldBe("new MessageEvent('eventType', { data: null }).data", "null");
</del><ins>+shouldBeNull("new MessageEvent('eventType', { data: undefined }).data");
+shouldBeNull("new MessageEvent('eventType', { data: null }).data");
</ins><span class="cx"> shouldBe("new MessageEvent('eventType', { data: false }).data", "false");
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { data: true }).data", "true");
</span><span class="cx"> shouldBeEqualToString("new MessageEvent('eventType', { data: '' }).data", "");
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": '' })." + attr, "");
</span><span class="cx">
</span><span class="cx"> // Non-strings.
</span><del>- shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": undefined })." + attr, "undefined");
</del><ins>+ shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": undefined })." + attr, "");
</ins><span class="cx"> shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": null })." + attr, "null");
</span><span class="cx"> shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": false })." + attr, "false");
</span><span class="cx"> shouldBeEqualToString("new MessageEvent('eventType', { " + attr + ": true })." + attr, "true");
</span><span class="lines">@@ -76,21 +76,21 @@
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { ports: [channel.port1], source: channel.port1 }).source", "channel.port1");
</span><span class="cx">
</span><span class="cx"> // Unacceptable source objects (not a Window or a MessagePort).
</span><del>-shouldBe("new MessageEvent('eventType', { source: test_object }).source", "null");
</del><ins>+shouldThrowErrorName("new MessageEvent('eventType', { source: test_object }).source", "TypeError");
</ins><span class="cx"> shouldBe("new MessageEvent('eventType', { source: document }).source", "null");
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { source: document.body }).source", "null");
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { source: undefined }).source", "null");
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { source: null }).source", "null");
</span><del>-shouldBe("new MessageEvent('eventType', { source: false }).source", "null");
-shouldBe("new MessageEvent('eventType', { source: true }).source", "null");
-shouldBe("new MessageEvent('eventType', { source: '' }).source", "null");
-shouldBe("new MessageEvent('eventType', { source: 'chocolate' }).source", "null");
-shouldBe("new MessageEvent('eventType', { source: 12345 }).source", "null");
-shouldBe("new MessageEvent('eventType', { source: 18446744073709551615 }).source", "null");
-shouldBe("new MessageEvent('eventType', { source: NaN }).source", "null");
</del><ins>+shouldThrowErrorName("new MessageEvent('eventType', { source: false }).source", "TypeError");
+shouldThrowErrorName("new MessageEvent('eventType', { source: true }).source", "TypeError");
+shouldThrowErrorName("new MessageEvent('eventType', { source: '' }).source", "TypeError");
+shouldThrowErrorName("new MessageEvent('eventType', { source: 'chocolate' }).source", "TypeError");
+shouldThrowErrorName("new MessageEvent('eventType', { source: 12345 }).source", "TypeError");
+shouldThrowErrorName("new MessageEvent('eventType', { source: 18446744073709551615 }).source", "TypeError");
+shouldThrowErrorName("new MessageEvent('eventType', { source: NaN }).source", "TypeError");
</ins><span class="cx"> // Note that valueOf() is not called, when the left hand side is evaluated.
</span><del>-shouldBeFalse("new MessageEvent('eventType', { source: {valueOf: function () { return window; } } }).source == window");
-shouldBe("new MessageEvent('eventType', { get source() { return 123; } }).source", "null");
</del><ins>+shouldThrowErrorName("new MessageEvent('eventType', { source: {valueOf: function () { return window; } } })", "TypeError");
+shouldThrowErrorName("new MessageEvent('eventType', { get source() { return 123; } }).source", "TypeError");
</ins><span class="cx"> shouldThrow("new MessageEvent('eventType', { get source() { throw 'MessageEvent Error'; } })");
</span><span class="cx">
</span><span class="cx"> // ports is passed.
</span><span class="lines">@@ -101,12 +101,12 @@
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { ports: [channel.port1, channel.port2, channel2.port1] }).ports[2]", "channel2.port1");
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { ports: [] }).ports", "[]");
</span><span class="cx"> shouldBe("new MessageEvent('eventType', { ports: undefined }).ports", "[]");
</span><del>-shouldBe("new MessageEvent('eventType', { ports: null }).ports", "[]");
</del><span class="cx">
</span><span class="cx"> // Invalid message ports.
</span><span class="cx"> shouldThrow("new MessageEvent('eventType', { ports: [1, 2, 3] }).ports[2]");
</span><span class="cx"> shouldThrow("new MessageEvent('eventType', { ports: test_object }).ports");
</span><span class="cx"> shouldThrow("new MessageEvent('eventType', { ports: document }).ports");
</span><ins>+shouldThrow("new MessageEvent('eventType', { ports: null }).ports")
</ins><span class="cx"> shouldThrow("new MessageEvent('eventType', { ports: false }).ports");
</span><span class="cx"> shouldThrow("new MessageEvent('eventType', { ports: true }).ports");
</span><span class="cx"> shouldThrow("new MessageEvent('eventType', { ports: '' }).ports");
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/Source/WebCore/ChangeLog        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-10-10 Chris Dumez <cdumez@apple.com>
+
+ Update MessageEvent to stop using legacy [ConstructorTemplate=Event]
+ https://bugs.webkit.org/show_bug.cgi?id=163187
+
+ Reviewed by Darin Adler.
+
+ Update MessageEvent to stop using legacy [ConstructorTemplate=Event] and
+ use a regular constructor as in the specification:
+ - https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces
+
+ No new tests, updated existing test.
+
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::toRefPtrNativeArray):
+ * bindings/js/JSDOMConvert.h:
+ (WebCore::convertWrapperTypeSequence):
+ (WebCore::convertWrapperType): Deleted.
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateDefaultValue):
+ (GenerateDictionaryImplementationContent):
+ (GetNativeType):
+ * dom/MessageEvent.cpp:
+ (WebCore::MessageEvent::MessageEvent):
+ (WebCore::MessageEvent::create):
+ (WebCore::MessageEvent::trySerializeData):
+ (WebCore::MessageEvent::createForBindings): Deleted.
+ (WebCore::MessageEvent::initMessageEvent): Deleted.
+ * dom/MessageEvent.h:
+ * dom/MessageEvent.idl:
+
</ins><span class="cx"> 2016-10-10 Antoine Quint <graouts@apple.com>
</span><span class="cx">
</span><span class="cx"> [Modern Media Controls] Buttons
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -297,7 +297,7 @@
</span><span class="cx"> RefPtr<JSC::Float64Array> toFloat64Array(JSC::JSValue);
</span><span class="cx">
</span><span class="cx"> template<typename T, typename JSType> Vector<Ref<T>> toRefNativeArray(JSC::ExecState&, JSC::JSValue);
</span><del>-template<typename T, typename JSType> Vector<RefPtr<T>> toRefPtrNativeArray(JSC::ExecState&, JSC::JSValue);
</del><ins>+template<typename T, typename JSType, typename VectorType = Vector<RefPtr<T>>> VectorType toRefPtrNativeArray(JSC::ExecState&, JSC::JSValue);
</ins><span class="cx"> template<typename T> Vector<T> toNativeArray(JSC::ExecState&, JSC::JSValue);
</span><span class="cx"> bool hasIteratorMethod(JSC::ExecState&, JSC::JSValue);
</span><span class="cx">
</span><span class="lines">@@ -835,18 +835,18 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-template<typename T, typename JST> Vector<RefPtr<T>> toRefPtrNativeArray(JSC::ExecState& exec, JSC::JSValue value)
</del><ins>+template<typename T, typename JST, typename VectorType> VectorType toRefPtrNativeArray(JSC::ExecState& state, JSC::JSValue value)
</ins><span class="cx"> {
</span><del>- JSC::VM& vm = exec.vm();
</del><ins>+ JSC::VM& vm = state.vm();
</ins><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx">
</span><span class="cx"> if (!value.isObject()) {
</span><del>- throwSequenceTypeError(exec, scope);
</del><ins>+ throwSequenceTypeError(state, scope);
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><del>- Vector<RefPtr<T>> result;
- forEachInIterable(&exec, value, [&result](JSC::VM& vm, JSC::ExecState* state, JSC::JSValue jsValue) {
</del><ins>+ VectorType result;
+ forEachInIterable(&state, value, [&result](JSC::VM& vm, JSC::ExecState* state, JSC::JSValue jsValue) {
</ins><span class="cx"> auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx">
</span><span class="cx"> if (jsValue.inherits(JST::info()))
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">
</span><span class="cx"> enum class IsNullable { No, Yes };
</span><span class="cx"> template<typename T, typename JST> T* convertWrapperType(JSC::ExecState&, JSC::JSValue, IsNullable);
</span><ins>+template<typename T, typename JST, typename VectorType> VectorType convertWrapperTypeSequence(JSC::ExecState&, JSC::JSValue);
</ins><span class="cx">
</span><span class="cx"> // This is where the implementation of the things declared above begins:
</span><span class="cx">
</span><span class="lines">@@ -77,6 +78,11 @@
</span><span class="cx"> return object;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template<typename T, typename JST, typename VectorType> inline VectorType convertWrapperTypeSequence(JSC::ExecState& state, JSC::JSValue value)
+{
+ return toRefPtrNativeArray<T, JST, VectorType>(state, value);
+}
+
</ins><span class="cx"> template<typename T> struct DefaultConverter {
</span><span class="cx"> using OptionalValue = Optional<T>;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -986,6 +986,7 @@
</span><span class="cx"> if ($value eq "null") {
</span><span class="cx"> $value = $member->type eq "any" ? "jsNull()" : "nullptr";
</span><span class="cx"> }
</span><ins>+ $value = "{ }" if $value eq "[]";
</ins><span class="cx"> $value = "jsUndefined()" if $value eq "undefined";
</span><span class="cx">
</span><span class="cx"> return $value;
</span><span class="lines">@@ -1120,6 +1121,14 @@
</span><span class="cx"> $result .= " Optional<${nativeType}> $key = convertDictionary<${nativeType}>(state, ${key}Value).value();\n";
</span><span class="cx"> $result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
</span><span class="cx"> $result .= " result.$key = $key.value();\n";
</span><ins>+ } elsif ($codeGenerator->IsSequenceOrFrozenArrayType($type)) {
+ my $innerType = $codeGenerator->GetSequenceOrFrozenArrayInnerType($type);
+ if ($codeGenerator->IsWrapperType($innerType)) {
+ $result .= " result.$key = convertWrapperTypeSequence<$innerType, JS$innerType, $nativeType>(state, ${key}Value);\n";
+ } else {
+ $result .= " result.$key = convert<${nativeType}>(state, ${key}Value);\n";
+ }
+ $result .= " RETURN_IF_EXCEPTION(throwScope, Nullopt);\n";
</ins><span class="cx"> } else {
</span><span class="cx"> my $conversionRuleWithLeadingComma = GenerateConversionRuleWithLeadingComma($interface, $member);
</span><span class="cx"> $result .= " result.$key = convert<${nativeType}>(state, ${key}Value${conversionRuleWithLeadingComma});\n";
</span><span class="lines">@@ -4778,14 +4787,15 @@
</span><span class="cx"> "unsigned short" => "uint16_t",
</span><span class="cx"> );
</span><span class="cx">
</span><del>-sub GetVariadicType
</del><ins>+sub GetNativeVectorType
</ins><span class="cx"> {
</span><span class="cx"> my ($interface, $type) = @_;
</span><span class="cx">
</span><del>- my $wrappedType = IsNativeType($type) ? GetNativeType($interface, $type) : $type;
- my $wrapperType = IsNativeType($type) ? "JSC::JSValue" : "JS$wrappedType";
</del><ins>+ die "This should only be called for sequence or array types" unless $codeGenerator->IsSequenceOrFrozenArrayType($type);
</ins><span class="cx">
</span><del>- return ($wrapperType, $wrappedType);
</del><ins>+ my $innerType = $codeGenerator->GetSequenceOrFrozenArrayInnerType($type);
+ return "MessagePortArray" if $innerType eq "MessagePort";
+ return "Vector<" . GetNativeVectorInnerType($innerType) . ">";
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> sub GetNativeType
</span><span class="lines">@@ -4802,7 +4812,7 @@
</span><span class="cx">
</span><span class="cx"> return "RefPtr<${type}>" if $codeGenerator->IsTypedArrayType($type) and $type ne "ArrayBuffer";
</span><span class="cx">
</span><del>- return "Vector<" . GetNativeVectorInnerType($codeGenerator->GetSequenceOrFrozenArrayInnerType($type)) . ">" if $codeGenerator->IsSequenceOrFrozenArrayType($type);
</del><ins>+ return GetNativeVectorType($interface, $type) if $codeGenerator->IsSequenceOrFrozenArrayType($type);
</ins><span class="cx">
</span><span class="cx"> return "${type}*";
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessageEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessageEvent.cpp (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessageEvent.cpp        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/Source/WebCore/dom/MessageEvent.cpp        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+using namespace JSC;
+
</ins><span class="cx"> static inline bool isValidSource(EventTarget* source)
</span><span class="cx"> {
</span><span class="cx"> return !source || source->toDOMWindow() || source->isMessagePort();
</span><span class="lines">@@ -45,10 +47,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><del>-inline MessageEvent::MessageEvent(const AtomicString& type, const MessageEventInit& initializer)
- : Event(type, initializer)
</del><ins>+inline MessageEvent::MessageEvent(ExecState& state, const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
+ : Event(type, initializer, isTrusted)
</ins><span class="cx"> , m_dataType(DataTypeScriptValue)
</span><del>- , m_dataAsScriptValue(initializer.data)
</del><ins>+ , m_dataAsScriptValue(state.vm(), initializer.data)
</ins><span class="cx"> , m_origin(initializer.origin)
</span><span class="cx"> , m_lastEventId(initializer.lastEventId)
</span><span class="cx"> , m_source(isValidSource(initializer.source.get()) ? initializer.source : nullptr)
</span><span class="lines">@@ -131,9 +133,9 @@
</span><span class="cx"> return adoptRef(*new MessageEvent);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-Ref<MessageEvent> MessageEvent::createForBindings(const AtomicString& type, const MessageEventInit& initializer)
</del><ins>+Ref<MessageEvent> MessageEvent::create(ExecState& state, const AtomicString& type, const Init& initializer, IsTrusted isTrusted)
</ins><span class="cx"> {
</span><del>- return adoptRef(*new MessageEvent(type, initializer));
</del><ins>+ return adoptRef(*new MessageEvent(state, type, initializer, isTrusted));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> MessageEvent::~MessageEvent()
</span><span class="lines">@@ -172,7 +174,7 @@
</span><span class="cx"> m_ports = WTFMove(ports);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<SerializedScriptValue> MessageEvent::trySerializeData(JSC::ExecState* exec)
</del><ins>+RefPtr<SerializedScriptValue> MessageEvent::trySerializeData(ExecState* exec)
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(!m_dataAsScriptValue.hasNoValue());
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessageEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessageEvent.h (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessageEvent.h        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/Source/WebCore/dom/MessageEvent.h        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -36,14 +36,6 @@
</span><span class="cx">
</span><span class="cx"> class Blob;
</span><span class="cx">
</span><del>-struct MessageEventInit : public EventInit {
- Deprecated::ScriptValue data;
- String origin;
- String lastEventId;
- RefPtr<EventTarget> source;
- MessagePortArray ports;
-};
-
</del><span class="cx"> class MessageEvent final : public Event {
</span><span class="cx"> public:
</span><span class="cx"> static Ref<MessageEvent> create(std::unique_ptr<MessagePortArray>, RefPtr<SerializedScriptValue>&&, const String& origin = { }, const String& lastEventId = { }, EventTarget* source = nullptr);
</span><span class="lines">@@ -52,7 +44,16 @@
</span><span class="cx"> static Ref<MessageEvent> create(Ref<Blob>&& data, const String& origin);
</span><span class="cx"> static Ref<MessageEvent> create(Ref<ArrayBuffer>&& data, const String& origin = { });
</span><span class="cx"> static Ref<MessageEvent> createForBindings();
</span><del>- static Ref<MessageEvent> createForBindings(const AtomicString& type, const MessageEventInit&);
</del><ins>+
+ struct Init : EventInit {
+ JSC::JSValue data;
+ String origin;
+ String lastEventId;
+ RefPtr<EventTarget> source;
+ MessagePortArray ports;
+ };
+ static Ref<MessageEvent> create(JSC::ExecState&, const AtomicString& type, const Init&, IsTrusted = IsTrusted::No);
+
</ins><span class="cx"> virtual ~MessageEvent();
</span><span class="cx">
</span><span class="cx"> void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const Deprecated::ScriptValue& data, const String& origin, const String& lastEventId, DOMWindow* source, std::unique_ptr<MessagePortArray>);
</span><span class="lines">@@ -86,7 +87,7 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> MessageEvent();
</span><del>- MessageEvent(const AtomicString&, const MessageEventInit&);
</del><ins>+ MessageEvent(JSC::ExecState&, const AtomicString&, const Init&, IsTrusted);
</ins><span class="cx"> MessageEvent(RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortArray>);
</span><span class="cx"> MessageEvent(const AtomicString& type, RefPtr<SerializedScriptValue>&& data, const String& origin, const String& lastEventId);
</span><span class="cx"> MessageEvent(const String& data, const String& origin);
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessageEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessageEvent.idl (207015 => 207016)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessageEvent.idl        2016-10-10 20:14:43 UTC (rev 207015)
+++ trunk/Source/WebCore/dom/MessageEvent.idl        2016-10-10 20:21:30 UTC (rev 207016)
</span><span class="lines">@@ -26,16 +26,16 @@
</span><span class="cx"> */
</span><span class="cx">
</span><span class="cx"> [
</span><del>- ConstructorTemplate=Event,
</del><ins>+ Constructor(DOMString type, optional MessageEventInit eventInitDict),
+ ConstructorCallWith=ScriptState,
</ins><span class="cx"> Exposed=(Window,Worker),
</span><span class="cx"> ] interface MessageEvent : Event {
</span><del>- [InitializedByEventConstructor] readonly attribute USVString origin;
- [InitializedByEventConstructor] readonly attribute DOMString lastEventId;
- [InitializedByEventConstructor] readonly attribute EventTarget source; // May be a DOMWindow or a MessagePort.
</del><ins>+ readonly attribute USVString origin;
+ readonly attribute DOMString lastEventId;
+ readonly attribute EventTarget? source; // May be a DOMWindow or a MessagePort.
+ [CachedAttribute, CustomGetter] readonly attribute any data;
+ readonly attribute FrozenArray<MessagePort> ports;
</ins><span class="cx">
</span><del>- [InitializedByEventConstructor, CachedAttribute, CustomGetter] readonly attribute any data;
- [InitializedByEventConstructor] readonly attribute sequence<MessagePort> ports;
-
</del><span class="cx"> [Custom] void initMessageEvent(optional DOMString typeArg, optional boolean canBubbleArg, optional boolean cancelableArg,
</span><span class="cx"> optional any dataArg, optional USVString originArg, optional DOMString lastEventIdArg, optional DOMWindow sourceArg,
</span><span class="cx"> optional Array messagePorts);
</span><span class="lines">@@ -44,3 +44,11 @@
</span><span class="cx"> optional any dataArg, optional USVString originArg, optional DOMString lastEventIdArg, optional DOMWindow sourceArg,
</span><span class="cx"> optional Array transferables);
</span><span class="cx"> };
</span><ins>+
+dictionary MessageEventInit : EventInit {
+ any data = null;
+ USVString origin = "";
+ DOMString lastEventId = "";
+ EventTarget? source = null;
+ sequence<MessagePort> ports = [];
+};
</ins></span></pre>
</div>
</div>
</body>
</html>