<!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>[209303] 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/209303">209303</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2016-12-03 12:22:43 -0800 (Sat, 03 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>optional sequence values not handled correctly by binding generator
https://bugs.webkit.org/show_bug.cgi?id=142562
Source/WebCore:
Also fixes:
Remove non-standard postMessage overload
https://bugs.webkit.org/show_bug.cgi?id=161911
and
Wrong argument order in window.postMessage
https://bugs.webkit.org/show_bug.cgi?id=63141
Reviewed by Darin Adler.
* WebCore.xcodeproj/project.pbxproj:
Remove no longer needed files.
* bindings/generic/IDLTypes.h:
* bindings/js/JSDOMConvert.h:
(WebCore::Converter<IDLObject>::convert):
Add support for the WebIDL object type.
* bindings/js/JSDOMBinding.cpp:
(WebCore::createDOMException):
Add support for throwing stack overflow errors.
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::handlePostMessage): Deleted.
(WebCore::JSDOMWindow::postMessage): Deleted.
* bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp: Removed.
* bindings/js/JSMessagePortCustom.cpp:
(WebCore::JSMessagePort::postMessage): Deleted.
(WebCore::extractTransferables): Deleted.
* bindings/js/JSMessagePortCustom.h: Removed.
* bindings/js/JSWorkerCustom.cpp:
(WebCore::JSWorker::postMessage): Deleted.
Remove custom bindings for postMessage.
* bindings/js/SerializedScriptValue.h:
Switch to using enum class.
* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::transferArrayBuffers):
(WebCore::SerializedScriptValue::create):
Add new create function that takes the transfer list, processes it, and returns
MessagePorts and SerializedScriptValue / exception.
(WebCore::CloneBase::throwStackOverflow): Deleted.
(WebCore::CloneDeserializer::throwValidationError): Deleted.
Remove uncalled functions.
* bindings/scripts/CodeGenerator.pm:
(IsRefPtrType):
(IsBuiltinType):
* bindings/scripts/CodeGeneratorJS.pm:
(AddToIncludesForIDLType):
(GetBaseIDLType):
Add support for the WebIDL 'object' type.
* bindings/scripts/test/JS/JSTestObj.cpp:
* bindings/scripts/test/TestObj.idl:
Add tests for 'object'.
* dom/ExceptionCode.h:
Add two new ExceptionCodes:
- ExistingExceptionError, to indicate that implementation code threw a JS exception.
- StackOverflowError, to indicate that a stack overflow exception should be thrown.
* dom/MessagePort.cpp:
(WebCore::MessagePort::postMessage):
* dom/MessagePort.h:
* dom/MessagePort.idl:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::postMessage):
* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerGlobalScope.idl:
* workers/Worker.cpp:
(WebCore::Worker::postMessage):
* workers/Worker.h:
* workers/Worker.idl:
Update to call new SerializedScriptValue create function.
LayoutTests:
Reviewed by Darin Adler.
* fast/canvas/webgl/resources/typed-array-worker.js:
* fast/dom/Window/window-postmessage-args-expected.txt:
* fast/dom/Window/window-postmessage-args.html:
* fast/events/message-port-deleted-document.html:
* fast/events/message-port-deleted-frame.html:
* fast/events/message-port-inactive-document.html:
* fast/events/message-port-multi-expected.txt:
* fast/events/message-port.html:
* fast/workers/worker-context-multi-port-expected.txt:
* fast/workers/worker-multi-port-expected.txt:
* webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js:
* webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js:
Update for new exceptions and stricter enforcement of the postMessage signature. </pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcanvaswebglresourcestypedarrayworkerjs">trunk/LayoutTests/fast/canvas/webgl/resources/typed-array-worker.js</a></li>
<li><a href="#trunkLayoutTestsfastdomWindowwindowpostmessageargsexpectedtxt">trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomWindowwindowpostmessageargshtml">trunk/LayoutTests/fast/dom/Window/window-postmessage-args.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsmessageportdeleteddocumenthtml">trunk/LayoutTests/fast/events/message-port-deleted-document.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsmessageportdeletedframehtml">trunk/LayoutTests/fast/events/message-port-deleted-frame.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsmessageportinactivedocumenthtml">trunk/LayoutTests/fast/events/message-port-inactive-document.html</a></li>
<li><a href="#trunkLayoutTestsfasteventsmessageportmultiexpectedtxt">trunk/LayoutTests/fast/events/message-port-multi-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsmessageporthtml">trunk/LayoutTests/fast/events/message-port.html</a></li>
<li><a href="#trunkLayoutTestsfastworkersworkercontextmultiportexpectedtxt">trunk/LayoutTests/fast/workers/worker-context-multi-port-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastworkersworkermultiportexpectedtxt">trunk/LayoutTests/fast/workers/worker-multi-port-expected.txt</a></li>
<li><a href="#trunkLayoutTestswebgl102resourceswebgl_test_filesconformancetypedarraysresourcestypedarrayworkerjs">trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js</a></li>
<li><a href="#trunkLayoutTestswebgl103resourceswebgl_test_filesconformancetypedarraysresourcestypedarrayworkerjs">trunk/LayoutTests/webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsgenericIDLTypesh">trunk/Source/WebCore/bindings/generic/IDLTypes.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp">trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingcpp">trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMConverth">trunk/Source/WebCore/bindings/js/JSDOMConvert.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp">trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMessagePortCustomcpp">trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSWorkerCustomcpp">trunk/Source/WebCore/bindings/js/JSWorkerCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValuecpp">trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValueh">trunk/Source/WebCore/bindings/js/SerializedScriptValue.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorpm">trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCoredomExceptionCodeh">trunk/Source/WebCore/dom/ExceptionCode.h</a></li>
<li><a href="#trunkSourceWebCoredomMessagePortcpp">trunk/Source/WebCore/dom/MessagePort.cpp</a></li>
<li><a href="#trunkSourceWebCoredomMessagePorth">trunk/Source/WebCore/dom/MessagePort.h</a></li>
<li><a href="#trunkSourceWebCoredomMessagePortidl">trunk/Source/WebCore/dom/MessagePort.idl</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowcpp">trunk/Source/WebCore/page/DOMWindow.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowh">trunk/Source/WebCore/page/DOMWindow.h</a></li>
<li><a href="#trunkSourceWebCorepageDOMWindowidl">trunk/Source/WebCore/page/DOMWindow.idl</a></li>
<li><a href="#trunkSourceWebCoreworkersDedicatedWorkerGlobalScopecpp">trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersDedicatedWorkerGlobalScopeh">trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h</a></li>
<li><a href="#trunkSourceWebCoreworkersDedicatedWorkerGlobalScopeidl">trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkercpp">trunk/Source/WebCore/workers/Worker.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerh">trunk/Source/WebCore/workers/Worker.h</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkeridl">trunk/Source/WebCore/workers/Worker.idl</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorebindingsjsJSDedicatedWorkerGlobalScopeCustomcpp">trunk/Source/WebCore/bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMessagePortCustomh">trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/ChangeLog        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-12-02 Sam Weinig <sam@webkit.org>
+
+ optional sequence values not handled correctly by binding generator
+ https://bugs.webkit.org/show_bug.cgi?id=142562
+
+ Reviewed by Darin Adler.
+
+ * fast/canvas/webgl/resources/typed-array-worker.js:
+ * fast/dom/Window/window-postmessage-args-expected.txt:
+ * fast/dom/Window/window-postmessage-args.html:
+ * fast/events/message-port-deleted-document.html:
+ * fast/events/message-port-deleted-frame.html:
+ * fast/events/message-port-inactive-document.html:
+ * fast/events/message-port-multi-expected.txt:
+ * fast/events/message-port.html:
+ * fast/workers/worker-context-multi-port-expected.txt:
+ * fast/workers/worker-multi-port-expected.txt:
+ * webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js:
+ * webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js:
+ Update for new exceptions and stricter enforcement of the postMessage signature.
+
</ins><span class="cx"> 2016-12-02 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Improve the behavior of scroll-into-view when the target is inside position:fixed
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvaswebglresourcestypedarrayworkerjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/webgl/resources/typed-array-worker.js (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/webgl/resources/typed-array-worker.js        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/canvas/webgl/resources/typed-array-worker.js        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> valueToSend = view.buffer;
</span><span class="cx"> }
</span><del>- var transferablesToSend = null;
</del><ins>+ var transferablesToSend = [];
</ins><span class="cx"> if (message.command == 'transfer' ||
</span><span class="cx"> message.command == 'transferBuffer') {
</span><span class="cx"> transferablesToSend = [ view.buffer ];
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowwindowpostmessageargsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/dom/Window/window-postmessage-args-expected.txt        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -2,13 +2,13 @@
</span><span class="cx">
</span><span class="cx"> PASS: Posting message ('1', 1): threw exception TypeError: Value is not a sequence
</span><span class="cx"> PASS: Posting message ('2', c): threw exception TypeError: Value is not a sequence
</span><del>-PASS: Posting message ('3', [object Object]): threw exception TypeError: Value is not a sequence
-PASS: Posting message ('4', [object Window]) did not throw an exception
-PASS: Posting message ('4a', *) did not throw an exception
</del><ins>+PASS: Posting message ('3', [object Object]): threw exception TypeError: Type error
+PASS: Posting message ('4', [object Window]): threw exception TypeError: Type error
+PASS: Posting message ('4a', *): threw exception TypeError: Value is not a sequence
</ins><span class="cx"> PASS: Posting message ('5', null) did not throw an exception
</span><span class="cx"> PASS: Posting message ('6', undefined) did not throw an exception
</span><span class="cx"> PASS: Posting message ('7', [object MessagePort],[object MessagePort]) did not throw an exception
</span><del>-PASS: Posting message ('7a', *) did not throw an exception
</del><ins>+PASS: Posting message ('7a', *): threw exception TypeError: Value is not a sequence
</ins><span class="cx"> PASS: Posting message ('7', [object MessagePort],[object MessagePort]) did not throw an exception
</span><span class="cx"> PASS: Posting message ('2147483648', null) did not throw an exception
</span><span class="cx"> PASS: Posting message ('[object MessagePort]', [object MessagePort],[object MessagePort]) did not throw an exception
</span><span class="lines">@@ -18,12 +18,9 @@
</span><span class="cx"> PASS: arrayBuffer neutered
</span><span class="cx"> PASS: view neutered
</span><span class="cx"> PASS: Posting message ('done', undefined) did not throw an exception
</span><del>-Received message '4' with 0 ports.
-Received message '4a' with 0 ports.
</del><span class="cx"> Received message '5' with 0 ports.
</span><span class="cx"> Received message '6' with 0 ports.
</span><span class="cx"> Received message '7' with 2 ports.
</span><del>-Received message '7a' with 2 ports.
</del><span class="cx"> Received message '7' with 2 ports.
</span><span class="cx"> Received message '2147483648' with 0 ports.
</span><span class="cx"> Received message '[object MessagePort]' with 2 ports.
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomWindowwindowpostmessageargshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/dom/Window/window-postmessage-args.html (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/Window/window-postmessage-args.html        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/dom/Window/window-postmessage-args.html        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -44,14 +44,14 @@
</span><span class="cx"> tryPostMessage('1', '*', 1, true);
</span><span class="cx"> tryPostMessage('2', '*', 'c', true);
</span><span class="cx"> tryPostMessage('3', '*', { x: 1 }, true);
</span><del>-tryPostMessage('4', '*', window); // Passes because window has a "length" attribute of value '0', so it looks like an array
-tryPostMessage('4a', window, '*'); // Legacy argument order.
</del><ins>+tryPostMessage('4', '*', window, true);
+tryPostMessage('4a', window, '*', true); // Legacy argument order.
</ins><span class="cx"> tryPostMessage('5', '*', null);
</span><span class="cx"> tryPostMessage('6', '*', void 0);
</span><span class="cx"> var channel1 = new MessageChannel;
</span><span class="cx"> tryPostMessageFunction(window.postMessage, '7', '*', [channel1.port1, channel1.port2]);
</span><span class="cx"> var channel1a = new MessageChannel;
</span><del>-tryPostMessageFunction(window.postMessage, '7a', [channel1a.port1, channel1a.port2], '*');
</del><ins>+tryPostMessageFunction(window.postMessage, '7a', [channel1a.port1, channel1a.port2], '*', true);
</ins><span class="cx"> var channel2 = new MessageChannel;
</span><span class="cx"> tryPostMessageFunction(window.postMessage, '7', '*', [channel2.port1, channel2.port2]);
</span><span class="cx"> var channel3 = new MessageChannel;
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsmessageportdeleteddocumenthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/message-port-deleted-document.html (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/message-port-deleted-document.html        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/events/message-port-deleted-document.html        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="cx"> var channel = new MessageChannel;
</span><del>- window.frames[0].postMessage("msg", [channel.port2], "*");
</del><ins>+ window.frames[0].postMessage("msg", "*", [channel.port2]);
</ins><span class="cx"> mainPort = channel.port1;
</span><span class="cx"> mainPort.start();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsmessageportdeletedframehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/message-port-deleted-frame.html (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/message-port-deleted-frame.html        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/events/message-port-deleted-frame.html        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> {
</span><span class="cx"> frameDoc = window.frames[0].document;
</span><span class="cx"> var channel = new MessageChannel;
</span><del>- window.frames[0].postMessage("msg", [channel.port2], "*");
</del><ins>+ window.frames[0].postMessage("msg", "*", [channel.port2]);
</ins><span class="cx"> mainPort = channel.port1;
</span><span class="cx"> mainPort.start();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsmessageportinactivedocumenthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/message-port-inactive-document.html (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/message-port-inactive-document.html        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/events/message-port-inactive-document.html        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -29,7 +29,7 @@
</span><span class="cx"> {
</span><span class="cx"> otherDocument = window.frames[0].document;
</span><span class="cx"> var channel = new MessageChannel;
</span><del>- window.frames[0].postMessage("msg", [channel.port2], "*");
</del><ins>+ window.frames[0].postMessage("msg", "*", [channel.port2]);
</ins><span class="cx"> mainPort = channel.port1;
</span><span class="cx"> mainPort.start();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsmessageportmultiexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/message-port-multi-expected.txt (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/message-port-multi-expected.txt        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/events/message-port-multi-expected.txt        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -5,12 +5,12 @@
</span><span class="cx">
</span><span class="cx"> PASS channel.port1.postMessage("same port", [channel.port1]) threw exception DataCloneError (DOM Exception 25): The object can not be cloned..
</span><span class="cx"> PASS channel.port1.postMessage("entangled port", [channel.port2]) threw exception DataCloneError (DOM Exception 25): The object can not be cloned..
</span><del>-PASS channel.port1.postMessage("null port", [channel3.port1, null, channel3.port2]) threw exception InvalidStateError (DOM Exception 11): The object is in an invalid state..
-PASS channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception TypeError: Type error.
-PASS channel.port1.postMessage("duplicate port", [channel3.port1, channel3.port1]) threw exception InvalidStateError (DOM Exception 11): The object is in an invalid state..
-PASS channel.port1.postMessage("notAnArray", channel3.port1) threw exception TypeError: Value is not a sequence.
-PASS channel.port1.postMessage("notASequence", [{length: 3}]) threw exception TypeError: Type error.
-PASS channel.port1.postMessage("largeSequence", largePortArray) threw exception InvalidStateError (DOM Exception 11): The object is in an invalid state..
</del><ins>+PASS channel.port1.postMessage("null port", [channel3.port1, null, channel3.port2]) threw exception TypeError: Type error.
+PASS channel.port1.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception DataCloneError (DOM Exception 25): The object can not be cloned..
+PASS channel.port1.postMessage("duplicate port", [channel3.port1, channel3.port1]) threw exception DataCloneError (DOM Exception 25): The object can not be cloned..
+PASS channel.port1.postMessage("notAnArray", channel3.port1) threw exception TypeError: Type error.
+PASS channel.port1.postMessage("notASequence", [{length: 3}]) threw exception DataCloneError (DOM Exception 25): The object can not be cloned..
+PASS channel.port1.postMessage("largeSequence", largePortArray) threw exception TypeError: Type error.
</ins><span class="cx"> PASS event.ports is non-null and zero length when no port sent
</span><span class="cx"> PASS event.ports is non-null and zero length when empty array sent
</span><span class="cx"> PASS event.ports contains two ports when two ports sent
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsmessageporthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/events/message-port.html (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/message-port.html        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/events/message-port.html        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -38,7 +38,7 @@
</span><span class="cx"> {
</span><span class="cx"> var channel = new MessageChannel;
</span><span class="cx">
</span><del>- window.frames[0][postMessageFun]("msg", [channel.port2], "*");
</del><ins>+ window.frames[0][postMessageFun]("msg", "*", [channel.port2]);
</ins><span class="cx"> mainPort = channel.port1;
</span><span class="cx"> mainPort[postMessageFun]("ping");
</span><span class="cx"> mainPort.onmessage = function(evt) {
</span></span></pre></div>
<a id="trunkLayoutTestsfastworkersworkercontextmultiportexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/workers/worker-context-multi-port-expected.txt (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/worker-context-multi-port-expected.txt        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/workers/worker-context-multi-port-expected.txt        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -6,11 +6,11 @@
</span><span class="cx"> PASS event.ports is non-null and zero length when no port sent
</span><span class="cx"> PASS event.ports is non-null and zero length when empty array sent
</span><span class="cx"> PASS event.ports contains two ports when two ports sent
</span><del>-PASS posting a null port did throw: InvalidStateError (DOM Exception 11): The object is in an invalid state.
-PASS posting a non-port did throw: TypeError: Type error
</del><ins>+PASS posting a null port did throw: TypeError: Type error
+PASS posting a non-port did throw: DataCloneError (DOM Exception 25): The object can not be cloned.
</ins><span class="cx"> PASS event.ports contains two ports when two ports re-sent after error
</span><del>-PASS posting a non-array did throw: TypeError: Value is not a sequence
-PASS posting a non-sequence did throw: TypeError: Type error
</del><ins>+PASS posting a non-array did throw: TypeError: Type error
+PASS posting a non-sequence did throw: DataCloneError (DOM Exception 25): The object can not be cloned.
</ins><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span><span class="cx">
</span></span></pre></div>
<a id="trunkLayoutTestsfastworkersworkermultiportexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/workers/worker-multi-port-expected.txt (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/workers/worker-multi-port-expected.txt        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/fast/workers/worker-multi-port-expected.txt        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -3,10 +3,10 @@
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx">
</span><span class="cx">
</span><del>-PASS worker.postMessage("null port", [channel3.port1, null, channel3.port2]) threw exception InvalidStateError (DOM Exception 11): The object is in an invalid state..
-PASS worker.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception TypeError: Type error.
-PASS worker.postMessage("notAnArray", channel3.port1) threw exception TypeError: Value is not a sequence.
-PASS worker.postMessage("notASequence", [{length: 3}]) threw exception TypeError: Type error.
</del><ins>+PASS worker.postMessage("null port", [channel3.port1, null, channel3.port2]) threw exception TypeError: Type error.
+PASS worker.postMessage("notAPort", [channel3.port1, {}, channel3.port2]) threw exception DataCloneError (DOM Exception 25): The object can not be cloned..
+PASS worker.postMessage("notAnArray", channel3.port1) threw exception TypeError: Type error.
+PASS worker.postMessage("notASequence", [{length: 3}]) threw exception DataCloneError (DOM Exception 25): The object can not be cloned..
</ins><span class="cx"> PASS event.ports is non-null and zero length when no port sent
</span><span class="cx"> PASS event.ports is non-null and zero length when empty array sent
</span><span class="cx"> PASS event.ports contains two ports when two ports sent
</span></span></pre></div>
<a id="trunkLayoutTestswebgl102resourceswebgl_test_filesconformancetypedarraysresourcestypedarrayworkerjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/webgl/1.0.2/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> valueToSend = view.buffer;
</span><span class="cx"> }
</span><del>- var transferablesToSend = null;
</del><ins>+ var transferablesToSend = [];
</ins><span class="cx"> if (message.command == 'transfer' ||
</span><span class="cx"> message.command == 'transferBuffer') {
</span><span class="cx"> transferablesToSend = [ view.buffer ];
</span></span></pre></div>
<a id="trunkLayoutTestswebgl103resourceswebgl_test_filesconformancetypedarraysresourcestypedarrayworkerjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/LayoutTests/webgl/1.0.3/resources/webgl_test_files/conformance/typedarrays/resources/typed-array-worker.js        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -74,7 +74,7 @@
</span><span class="cx"> } else {
</span><span class="cx"> valueToSend = view.buffer;
</span><span class="cx"> }
</span><del>- var transferablesToSend = null;
</del><ins>+ var transferablesToSend = [];
</ins><span class="cx"> if (message.command == 'transfer' ||
</span><span class="cx"> message.command == 'transferBuffer') {
</span><span class="cx"> transferablesToSend = [ view.buffer ];
</span></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -1129,7 +1129,6 @@
</span><span class="cx"> bindings/js/JSDOMWrapper.cpp
</span><span class="cx"> bindings/js/JSDataCueCustom.cpp
</span><span class="cx"> bindings/js/JSDataTransferCustom.cpp
</span><del>- bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp
</del><span class="cx"> bindings/js/JSDeviceMotionEventCustom.cpp
</span><span class="cx"> bindings/js/JSDeviceOrientationEventCustom.cpp
</span><span class="cx"> bindings/js/JSDictionary.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/ChangeLog        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -1,3 +1,89 @@
</span><ins>+2016-12-02 Sam Weinig <sam@webkit.org>
+
+ optional sequence values not handled correctly by binding generator
+ https://bugs.webkit.org/show_bug.cgi?id=142562
+
+ Also fixes:
+ Remove non-standard postMessage overload
+ https://bugs.webkit.org/show_bug.cgi?id=161911
+ and
+ Wrong argument order in window.postMessage
+ https://bugs.webkit.org/show_bug.cgi?id=63141
+
+ Reviewed by Darin Adler.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Remove no longer needed files.
+
+ * bindings/generic/IDLTypes.h:
+ * bindings/js/JSDOMConvert.h:
+ (WebCore::Converter<IDLObject>::convert):
+ Add support for the WebIDL object type.
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::createDOMException):
+ Add support for throwing stack overflow errors.
+
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::handlePostMessage): Deleted.
+ (WebCore::JSDOMWindow::postMessage): Deleted.
+ * bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp: Removed.
+ * bindings/js/JSMessagePortCustom.cpp:
+ (WebCore::JSMessagePort::postMessage): Deleted.
+ (WebCore::extractTransferables): Deleted.
+ * bindings/js/JSMessagePortCustom.h: Removed.
+ * bindings/js/JSWorkerCustom.cpp:
+ (WebCore::JSWorker::postMessage): Deleted.
+ Remove custom bindings for postMessage.
+
+ * bindings/js/SerializedScriptValue.h:
+ Switch to using enum class.
+
+ * bindings/js/SerializedScriptValue.cpp:
+ (WebCore::SerializedScriptValue::transferArrayBuffers):
+ (WebCore::SerializedScriptValue::create):
+ Add new create function that takes the transfer list, processes it, and returns
+ MessagePorts and SerializedScriptValue / exception.
+
+ (WebCore::CloneBase::throwStackOverflow): Deleted.
+ (WebCore::CloneDeserializer::throwValidationError): Deleted.
+ Remove uncalled functions.
+
+ * bindings/scripts/CodeGenerator.pm:
+ (IsRefPtrType):
+ (IsBuiltinType):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (AddToIncludesForIDLType):
+ (GetBaseIDLType):
+ Add support for the WebIDL 'object' type.
+
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ * bindings/scripts/test/TestObj.idl:
+ Add tests for 'object'.
+
+ * dom/ExceptionCode.h:
+ Add two new ExceptionCodes:
+ - ExistingExceptionError, to indicate that implementation code threw a JS exception.
+ - StackOverflowError, to indicate that a stack overflow exception should be thrown.
+
+ * dom/MessagePort.cpp:
+ (WebCore::MessagePort::postMessage):
+ * dom/MessagePort.h:
+ * dom/MessagePort.idl:
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::postMessage):
+ * page/DOMWindow.h:
+ * page/DOMWindow.idl:
+ * workers/DedicatedWorkerGlobalScope.cpp:
+ (WebCore::DedicatedWorkerGlobalScope::postMessage):
+ * workers/DedicatedWorkerGlobalScope.h:
+ * workers/DedicatedWorkerGlobalScope.idl:
+ * workers/Worker.cpp:
+ (WebCore::Worker::postMessage):
+ * workers/Worker.h:
+ * workers/Worker.idl:
+ Update to call new SerializedScriptValue create function.
+
</ins><span class="cx"> 2016-12-03 Dave Hyatt <hyatt@apple.com>
</span><span class="cx">
</span><span class="cx"> [CSS Parser] Support Dashboard Regions
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -1584,7 +1584,6 @@
</span><span class="cx">                 41614A791DA64241004AD06F /* HTTPHeaderValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 41614A771DA64236004AD06F /* HTTPHeaderValues.h */; };
</span><span class="cx">                 4162A450101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A44D101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp */; };
</span><span class="cx">                 4162A451101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A44E101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h */; };
</span><del>-                4162A454101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A453101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp */; };
</del><span class="cx">                 4162A4571011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A4551011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp */; };
</span><span class="cx">                 4162A4581011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A4561011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h */; };
</span><span class="cx">                 416E29A6102FA962007FC14E /* WorkerReportingProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */; };
</span><span class="lines">@@ -1641,7 +1640,6 @@
</span><span class="cx">                 41F54F8B1C50C50300338488 /* FetchBody.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F7D1C50C4F600338488 /* FetchBody.cpp */; };
</span><span class="cx">                 41F54F8D1C50C50800338488 /* FetchHeaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F821C50C4F600338488 /* FetchHeaders.cpp */; };
</span><span class="cx">                 41F54F8E1C50C50C00338488 /* FetchRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41F54F871C50C4F600338488 /* FetchRequest.cpp */; };
</span><del>-                41F584C7104652CB009CAA64 /* JSMessagePortCustom.h in Headers */ = {isa = PBXBuildFile; fileRef = 41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */; };
</del><span class="cx">                 41FA303E1316C29C00C0BFC5 /* RenderMediaControls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */; };
</span><span class="cx">                 41FA303F1316C29C00C0BFC5 /* RenderMediaControls.h in Headers */ = {isa = PBXBuildFile; fileRef = 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */; };
</span><span class="cx">                 4306E4E614955543007F17AC /* KillRingNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4306E4E514955543007F17AC /* KillRingNone.cpp */; };
</span><span class="lines">@@ -8737,7 +8735,6 @@
</span><span class="cx">                 4162A44D101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorkerGlobalScope.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 4162A44E101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DedicatedWorkerGlobalScope.h; sourceTree = "<group>"; };
</span><span class="cx">                 4162A44F101145AE00DFF3ED /* DedicatedWorkerGlobalScope.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DedicatedWorkerGlobalScope.idl; sourceTree = "<group>"; };
</span><del>-                4162A453101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorkerGlobalScopeCustom.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 4162A4551011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDedicatedWorkerGlobalScope.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 4162A4561011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDedicatedWorkerGlobalScope.h; sourceTree = "<group>"; };
</span><span class="cx">                 416E29A5102FA962007FC14E /* WorkerReportingProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerReportingProxy.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -8811,7 +8808,6 @@
</span><span class="cx">                 41F54F871C50C4F600338488 /* FetchRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchRequest.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 41F54F881C50C4F600338488 /* FetchRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchRequest.h; sourceTree = "<group>"; };
</span><span class="cx">                 41F54F891C50C4F600338488 /* FetchRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FetchRequest.idl; sourceTree = "<group>"; };
</span><del>-                41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMessagePortCustom.h; sourceTree = "<group>"; };
</del><span class="cx">                 41FA303C1316C29C00C0BFC5 /* RenderMediaControls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMediaControls.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 41FA303D1316C29C00C0BFC5 /* RenderMediaControls.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMediaControls.h; sourceTree = "<group>"; };
</span><span class="cx">                 4306E4E514955543007F17AC /* KillRingNone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KillRingNone.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -22065,7 +22061,6 @@
</span><span class="cx">                                 DEC2975D1B4DEB2A005F5945 /* JSCustomEventCustom.cpp */,
</span><span class="cx">                                 07FBDE2B18FED178001A7CFF /* JSDataCueCustom.cpp */,
</span><span class="cx">                                 BCA83E510D7CE205003421A8 /* JSDataTransferCustom.cpp */,
</span><del>-                                4162A453101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp */,
</del><span class="cx">                                 31FB1A6B120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp */,
</span><span class="cx">                                 590E1B4A11E4EF700069F784 /* JSDeviceOrientationEventCustom.cpp */,
</span><span class="cx">                                 49C7BA8C1042F5B10009D447 /* JSDocumentCustom.cpp */,
</span><span class="lines">@@ -22121,7 +22116,6 @@
</span><span class="cx">                                 E1A5F99A0E7EAA2500AF85EA /* JSMessageChannelCustom.cpp */,
</span><span class="cx">                                 410B7E711045FAB000D8224F /* JSMessageEventCustom.cpp */,
</span><span class="cx">                                 E1ADED460E76B8DD004A1A5E /* JSMessagePortCustom.cpp */,
</span><del>-                                41F584C6104652CB009CAA64 /* JSMessagePortCustom.h */,
</del><span class="cx">                                 A1E5B31D1AAD1DA4006EBEFB /* JSMockContentFilterSettingsCustom.cpp */,
</span><span class="cx">                                 C6F0917E143A2BB900685849 /* JSMutationObserverCustom.cpp */,
</span><span class="cx">                                 BCD9C25F0C17AA67005C90A2 /* JSNamedNodeMapCustom.cpp */,
</span><span class="lines">@@ -26339,7 +26333,6 @@
</span><span class="cx">                                 E107400E0E77BDC00033AF24 /* JSMessageChannel.h in Headers */,
</span><span class="cx">                                 75793EC90D0CE72D007FC0AC /* JSMessageEvent.h in Headers */,
</span><span class="cx">                                 E1ADEDDA0E76BD93004A1A5E /* JSMessagePort.h in Headers */,
</span><del>-                                41F584C7104652CB009CAA64 /* JSMessagePortCustom.h in Headers */,
</del><span class="cx">                                 2D6F3E951C1F85550061DBD4 /* JSMockPageOverlay.h in Headers */,
</span><span class="cx">                                 A86629D109DA2B48009633A5 /* JSMouseEvent.h in Headers */,
</span><span class="cx">                                 830A36BD1DAC5FAD006D7D09 /* JSMouseEventInit.h in Headers */,
</span><span class="lines">@@ -29857,7 +29850,6 @@
</span><span class="cx">                                 BCA83E4F0D7CE1E9003421A8 /* JSDataTransfer.cpp in Sources */,
</span><span class="cx">                                 BCA83E520D7CE205003421A8 /* JSDataTransferCustom.cpp in Sources */,
</span><span class="cx">                                 4162A4571011464700DFF3ED /* JSDedicatedWorkerGlobalScope.cpp in Sources */,
</span><del>-                                4162A454101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp in Sources */,
</del><span class="cx">                                 FDA15ED112B03F94003A583A /* JSDelayNode.cpp in Sources */,
</span><span class="cx">                                 31FB1A65120A5D3F00DC02A0 /* JSDeviceMotionEvent.cpp in Sources */,
</span><span class="cx">                                 31FB1A6C120A5D6900DC02A0 /* JSDeviceMotionEventCustom.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsgenericIDLTypesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/generic/IDLTypes.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/generic/IDLTypes.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> class ArrayBuffer;
</span><span class="cx"> class ArrayBufferView;
</span><span class="cx"> class JSValue;
</span><ins>+class JSObject;
+template<typename T> class Strong;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -94,7 +96,7 @@
</span><span class="cx"> struct IDLByteString : IDLString { };
</span><span class="cx"> struct IDLUSVString : IDLString { };
</span><span class="cx">
</span><del>-struct IDLObject : IDLUnsupportedType { };
</del><ins>+struct IDLObject : IDLType<JSC::Strong<JSC::JSObject>> { };
</ins><span class="cx">
</span><span class="cx"> template<typename T> struct IDLWrapper : IDLType<RefPtr<T>> {
</span><span class="cx"> using RawType = T;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSBindingsAllInOnecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -64,7 +64,6 @@
</span><span class="cx"> #include "JSDOMWrapper.cpp"
</span><span class="cx"> #include "JSDataCueCustom.cpp"
</span><span class="cx"> #include "JSDataTransferCustom.cpp"
</span><del>-#include "JSDedicatedWorkerGlobalScopeCustom.cpp"
</del><span class="cx"> #include "JSDeviceOrientationEventCustom.cpp"
</span><span class="cx"> #include "JSDictionary.cpp"
</span><span class="cx"> #include "JSDocumentCustom.cpp"
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -270,7 +270,7 @@
</span><span class="cx">
</span><span class="cx"> static JSValue createDOMException(ExecState* exec, ExceptionCode ec, const String* message = nullptr)
</span><span class="cx"> {
</span><del>- if (!ec)
</del><ins>+ if (!ec || ec == ExistingExceptionError)
</ins><span class="cx"> return jsUndefined();
</span><span class="cx">
</span><span class="cx"> // FIXME: Handle other WebIDL exception types.
</span><span class="lines">@@ -286,6 +286,9 @@
</span><span class="cx"> return createRangeError(exec, *message);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ if (ec == StackOverflowError)
+ return createStackOverflowError(exec);
+
</ins><span class="cx"> // FIXME: All callers to setDOMException need to pass in the right global object
</span><span class="cx"> // for now, we're going to assume the lexicalGlobalObject. Which is wrong in cases like this:
</span><span class="cx"> // frames[0].document.createElement(null, null); // throws an exception which should have the subframes prototypes.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMConverth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMConvert.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSDOMConvert.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -813,6 +813,25 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> // MARK: -
</span><ins>+// MARK: Object type
+
+template<> struct Converter<IDLObject> : DefaultConverter<IDLObject> {
+ template<typename ExceptionThrower = DefaultExceptionThrower>
+ static JSC::Strong<JSC::JSObject> convert(JSC::ExecState& state, JSC::JSValue value, ExceptionThrower&& exceptionThrower = ExceptionThrower())
+ {
+ JSC::VM& vm = state.vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ if (!value.isObject()) {
+ exceptionThrower(state, scope);
+ return { };
+ }
+
+ return { vm, JSC::asObject(value) };
+ }
+};
+
+// MARK: -
</ins><span class="cx"> // MARK: Array-like types
</span><span class="cx">
</span><span class="cx"> namespace Detail {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -32,12 +32,12 @@
</span><span class="cx"> #include "JSHTMLOptionElement.h"
</span><span class="cx"> #include "JSIDBFactory.h"
</span><span class="cx"> #include "JSImageConstructor.h"
</span><del>-#include "JSMessagePortCustom.h"
</del><span class="cx"> #include "JSWorker.h"
</span><span class="cx"> #include "Location.h"
</span><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><span class="cx"> #include "ScheduledAction.h"
</span><span class="cx"> #include "Settings.h"
</span><ins>+#include <runtime/JSCInlines.h>
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(USER_MESSAGE_HANDLERS)
</span><span class="cx"> #include "JSWebKitNamespace.h"
</span><span class="lines">@@ -489,50 +489,6 @@
</span><span class="cx"> return handler.returnValue();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static JSValue handlePostMessage(DOMWindow& impl, ExecState& state)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (UNLIKELY(state.argumentCount() < 2))
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- Vector<RefPtr<MessagePort>> messagePorts;
- Vector<RefPtr<JSC::ArrayBuffer>> arrayBuffers;
-
- // This function has variable arguments and can be:
- // Per current spec:
- // postMessage(message, targetOrigin)
- // postMessage(message, targetOrigin, {sequence of transferrables})
- // Legacy non-standard implementations in webkit allowed:
- // postMessage(message, {sequence of transferrables}, targetOrigin);
- int targetOriginArgIndex = 1;
- if (state.argumentCount() > 2) {
- int transferablesArgIndex = 2;
- if (state.uncheckedArgument(2).isString()) {
- targetOriginArgIndex = 2;
- transferablesArgIndex = 1;
- }
- extractTransferables(state, state.argument(transferablesArgIndex), messagePorts, arrayBuffers);
- }
- RETURN_IF_EXCEPTION(scope, JSValue());
-
- auto message = SerializedScriptValue::create(state, state.uncheckedArgument(0), messagePorts, WTFMove(arrayBuffers));
- RETURN_IF_EXCEPTION(scope, JSValue());
-
- String targetOrigin = convert<IDLNullable<IDLUSVString>>(state, state.uncheckedArgument(targetOriginArgIndex));
- RETURN_IF_EXCEPTION(scope, JSValue());
-
- propagateException(state, scope, impl.postMessage(message.releaseNonNull(), WTFMove(messagePorts), targetOrigin, callerDOMWindow(&state)));
-
- return jsUndefined();
-}
-
-JSValue JSDOMWindow::postMessage(ExecState& state)
-{
- return handlePostMessage(wrapped(), state);
-}
-
</del><span class="cx"> JSValue JSDOMWindow::setTimeout(ExecState& state)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state.vm();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDedicatedWorkerGlobalScopeCustomcpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSDedicatedWorkerGlobalScopeCustom.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -1,47 +0,0 @@
</span><del>-/*
- * Copyright (C) 2009 Apple, Inc. All rights reserved.
- * Copyright (C) 2009, 2011 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "JSDedicatedWorkerGlobalScope.h"
-
-#include "JSDOMBinding.h"
-#include "JSMessagePortCustom.h"
-
-using namespace JSC;
-
-namespace WebCore {
-
-JSC::JSValue JSDedicatedWorkerGlobalScope::postMessage(JSC::ExecState& state)
-{
- return handlePostMessage(state, wrapped());
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMessagePortCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -27,20 +27,6 @@
</span><span class="cx"> #include "config.h"
</span><span class="cx"> #include "JSMessagePort.h"
</span><span class="cx">
</span><del>-#include "Event.h"
-#include "ExceptionCode.h"
-#include "Frame.h"
-#include "JSDOMBinding.h"
-#include "JSDOMGlobalObject.h"
-#include "JSEvent.h"
-#include "JSEventListener.h"
-#include "JSMessagePortCustom.h"
-#include "MessagePort.h"
-#include <heap/SlotVisitorInlines.h>
-#include <runtime/Error.h>
-#include <runtime/JSArrayBuffer.h>
-#include <wtf/text/AtomicString.h>
-
</del><span class="cx"> using namespace JSC;
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -52,53 +38,4 @@
</span><span class="cx"> visitor.addOpaqueRoot(port);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-JSC::JSValue JSMessagePort::postMessage(JSC::ExecState& state)
-{
- return handlePostMessage(state, wrapped());
-}
-
-void extractTransferables(JSC::ExecState& state, JSC::JSValue value, Vector<RefPtr<MessagePort>>& portArray, Vector<RefPtr<JSC::ArrayBuffer>>& arrayBuffers)
-{
- VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (value.isUndefinedOrNull()) {
- portArray.resize(0);
- arrayBuffers.resize(0);
- return;
- }
-
- // Validation of sequence types, per WebIDL spec 4.1.13.
- unsigned length = 0;
- JSObject* object = toJSSequence(state, value, length);
- RETURN_IF_EXCEPTION(scope, void());
-
- for (unsigned i = 0 ; i < length; ++i) {
- JSValue value = object->get(&state, i);
- RETURN_IF_EXCEPTION(scope, void());
-
- if (value.isUndefinedOrNull()) {
- setDOMException(&state, INVALID_STATE_ERR);
- return;
- }
-
- // Validation of Objects implementing an interface, per WebIDL spec 4.1.15.
- if (RefPtr<MessagePort> port = JSMessagePort::toWrapped(value)) {
- // Check for duplicate ports.
- if (portArray.contains(port)) {
- setDOMException(&state, INVALID_STATE_ERR);
- return;
- }
- portArray.append(WTFMove(port));
- } else {
- if (RefPtr<ArrayBuffer> arrayBuffer = toPossiblySharedArrayBuffer(value))
- arrayBuffers.append(WTFMove(arrayBuffer));
- else {
- throwTypeError(&state, scope);
- return;
- }
- }
- }
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMessagePortCustomh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2009 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 are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#include "MessagePort.h"
-#include <runtime/Error.h>
-#include <runtime/JSCInlines.h>
-#include <runtime/JSCJSValue.h>
-#include <wtf/Forward.h>
-
-namespace WebCore {
-
-void extractTransferables(JSC::ExecState&, JSC::JSValue, Vector<RefPtr<MessagePort>>&, Vector<RefPtr<JSC::ArrayBuffer>>&);
-
-// Helper function to convert from JS postMessage arguments to WebCore postMessage arguments.
-template<typename T> inline JSC::JSValue handlePostMessage(JSC::ExecState& state, T& object)
-{
- JSC::VM& vm = state.vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (UNLIKELY(state.argumentCount() < 1))
- return throwException(&state, scope, createNotEnoughArgumentsError(&state));
-
- Vector<RefPtr<MessagePort>> messagePortArray;
- Vector<RefPtr<JSC::ArrayBuffer>> arrayBufferArray;
- extractTransferables(state, state.argument(1), messagePortArray, arrayBufferArray);
-
- auto message = SerializedScriptValue::create(state, state.uncheckedArgument(0), messagePortArray, WTFMove(arrayBufferArray));
- RETURN_IF_EXCEPTION(scope, JSC::JSValue());
-
- propagateException(state, scope, object.postMessage(WTFMove(message), WTFMove(messagePortArray)));
- return JSC::jsUndefined();
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSWorkerCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSWorkerCustom.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSWorkerCustom.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/JSWorkerCustom.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "JSDOMBinding.h"
</span><span class="cx"> #include "JSDOMGlobalObject.h"
</span><span class="cx"> #include "JSDOMWindowCustom.h"
</span><del>-#include "JSMessagePortCustom.h"
</del><span class="cx"> #include "Worker.h"
</span><span class="cx"> #include <runtime/Error.h>
</span><span class="cx">
</span><span class="lines">@@ -39,11 +38,6 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><del>-JSC::JSValue JSWorker::postMessage(JSC::ExecState& state)
-{
- return handlePostMessage(state, wrapped());
-}
-
</del><span class="cx"> EncodedJSValue JSC_HOST_CALL constructJSWorker(ExecState& state)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state.vm();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -92,6 +92,16 @@
</span><span class="cx">
</span><span class="cx"> static const unsigned maximumFilterRecursion = 40000;
</span><span class="cx">
</span><ins>+enum class SerializationReturnCode {
+ SuccessfullyCompleted,
+ StackOverflowError,
+ InterruptedExecutionError,
+ ValidationError,
+ ExistingExceptionError,
+ DataCloneError,
+ UnspecifiedError
+};
+
</ins><span class="cx"> enum WalkerState { StateUnknown, ArrayStartState, ArrayStartVisitMember, ArrayEndVisitMember,
</span><span class="cx"> ObjectStartState, ObjectStartVisitMember, ObjectEndVisitMember,
</span><span class="cx"> MapDataStartVisitEntry, MapDataEndVisitKey, MapDataEndVisitValue,
</span><span class="lines">@@ -374,7 +384,7 @@
</span><span class="cx"> * <factorSize:uint32_t> <factor:byte{factorSize}> <crtExponentSize:uint32_t> <crtExponent:byte{crtExponentSize}> <crtCoefficientSize:uint32_t> <crtCoefficient:byte{crtCoefficientSize}>
</span><span class="cx"> */
</span><span class="cx">
</span><del>-typedef std::pair<JSC::JSValue, SerializationReturnCode> DeserializationResult;
</del><ins>+using DeserializationResult = std::pair<JSC::JSValue, SerializationReturnCode>;
</ins><span class="cx">
</span><span class="cx"> class CloneBase {
</span><span class="cx"> protected:
</span><span class="lines">@@ -391,13 +401,6 @@
</span><span class="cx"> return scope.exception();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void throwStackOverflow()
- {
- VM& vm = m_exec->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- throwException(m_exec, scope, createStackOverflowError(m_exec));
- }
-
</del><span class="cx"> void fail()
</span><span class="cx"> {
</span><span class="cx"> m_failed = true;
</span><span class="lines">@@ -731,7 +734,7 @@
</span><span class="cx"> write(static_cast<uint32_t>(arrayBufferView->byteLength()));
</span><span class="cx"> RefPtr<ArrayBuffer> arrayBuffer = arrayBufferView->possiblySharedBuffer();
</span><span class="cx"> if (!arrayBuffer) {
</span><del>- code = ValidationError;
</del><ins>+ code = SerializationReturnCode::ValidationError;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> JSValue bufferObj = toJS(m_exec, jsCast<JSDOMGlobalObject*>(m_exec->lexicalGlobalObject()), arrayBuffer.get());
</span><span class="lines">@@ -841,12 +844,12 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> // MessagePort object could not be found in transferred message ports
</span><del>- code = ValidationError;
</del><ins>+ code = SerializationReturnCode::ValidationError;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> if (ArrayBuffer* arrayBuffer = toPossiblySharedArrayBuffer(obj)) {
</span><span class="cx"> if (arrayBuffer->isNeutered()) {
</span><del>- code = ValidationError;
</del><ins>+ code = SerializationReturnCode::ValidationError;
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx"> ObjectPool::iterator index = m_transferredArrayBuffers.find(obj);
</span><span class="lines">@@ -1234,7 +1237,7 @@
</span><span class="cx"> case ArrayStartState: {
</span><span class="cx"> ASSERT(isArray(inValue));
</span><span class="cx"> if (inputObjectStack.size() > maximumFilterRecursion)
</span><del>- return StackOverflowError;
</del><ins>+ return SerializationReturnCode::StackOverflowError;
</ins><span class="cx">
</span><span class="cx"> JSArray* inArray = asArray(inValue);
</span><span class="cx"> unsigned length = inArray->length();
</span><span class="lines">@@ -1273,9 +1276,9 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> write(index);
</span><del>- SerializationReturnCode terminalCode = SuccessfullyCompleted;
</del><ins>+ auto terminalCode = SerializationReturnCode::SuccessfullyCompleted;
</ins><span class="cx"> if (dumpIfTerminal(inValue, terminalCode)) {
</span><del>- if (terminalCode != SuccessfullyCompleted)
</del><ins>+ if (terminalCode != SerializationReturnCode::SuccessfullyCompleted)
</ins><span class="cx"> return terminalCode;
</span><span class="cx"> indexStack.last()++;
</span><span class="cx"> goto arrayStartVisitMember;
</span><span class="lines">@@ -1291,7 +1294,7 @@
</span><span class="cx"> case ObjectStartState: {
</span><span class="cx"> ASSERT(inValue.isObject());
</span><span class="cx"> if (inputObjectStack.size() > maximumFilterRecursion)
</span><del>- return StackOverflowError;
</del><ins>+ return SerializationReturnCode::StackOverflowError;
</ins><span class="cx"> JSObject* inObject = asObject(inValue);
</span><span class="cx"> if (!startObject(inObject))
</span><span class="cx"> break;
</span><span class="lines">@@ -1300,7 +1303,7 @@
</span><span class="cx"> // the input is not an Object object then we should throw
</span><span class="cx"> // a DataCloneError.
</span><span class="cx"> if (inObject->classInfo() != JSFinalObject::info())
</span><del>- return DataCloneError;
</del><ins>+ return SerializationReturnCode::DataCloneError;
</ins><span class="cx"> inputObjectStack.append(inObject);
</span><span class="cx"> indexStack.append(0);
</span><span class="cx"> propertyStack.append(PropertyNameArray(m_exec, PropertyNameMode::Strings));
</span><span class="lines">@@ -1321,7 +1324,7 @@
</span><span class="cx"> }
</span><span class="cx"> inValue = getProperty(object, properties[index]);
</span><span class="cx"> if (shouldTerminate())
</span><del>- return ExistingExceptionError;
</del><ins>+ return SerializationReturnCode::ExistingExceptionError;
</ins><span class="cx">
</span><span class="cx"> if (!inValue) {
</span><span class="cx"> // Property was removed during serialisation
</span><span class="lines">@@ -1331,20 +1334,20 @@
</span><span class="cx"> write(properties[index]);
</span><span class="cx">
</span><span class="cx"> if (shouldTerminate())
</span><del>- return ExistingExceptionError;
</del><ins>+ return SerializationReturnCode::ExistingExceptionError;
</ins><span class="cx">
</span><del>- SerializationReturnCode terminalCode = SuccessfullyCompleted;
</del><ins>+ auto terminalCode = SerializationReturnCode::SuccessfullyCompleted;
</ins><span class="cx"> if (!dumpIfTerminal(inValue, terminalCode)) {
</span><span class="cx"> stateStack.append(ObjectEndVisitMember);
</span><span class="cx"> goto stateUnknown;
</span><span class="cx"> }
</span><del>- if (terminalCode != SuccessfullyCompleted)
</del><ins>+ if (terminalCode != SerializationReturnCode::SuccessfullyCompleted)
</ins><span class="cx"> return terminalCode;
</span><span class="cx"> FALLTHROUGH;
</span><span class="cx"> }
</span><span class="cx"> case ObjectEndVisitMember: {
</span><span class="cx"> if (shouldTerminate())
</span><del>- return ExistingExceptionError;
</del><ins>+ return SerializationReturnCode::ExistingExceptionError;
</ins><span class="cx">
</span><span class="cx"> indexStack.last()++;
</span><span class="cx"> goto objectStartVisitMember;
</span><span class="lines">@@ -1352,7 +1355,7 @@
</span><span class="cx"> mapStartState: {
</span><span class="cx"> ASSERT(inValue.isObject());
</span><span class="cx"> if (inputObjectStack.size() > maximumFilterRecursion)
</span><del>- return StackOverflowError;
</del><ins>+ return SerializationReturnCode::StackOverflowError;
</ins><span class="cx"> JSMap* inMap = jsCast<JSMap*>(inValue);
</span><span class="cx"> if (!startMap(inMap))
</span><span class="cx"> break;
</span><span class="lines">@@ -1396,7 +1399,7 @@
</span><span class="cx"> setStartState: {
</span><span class="cx"> ASSERT(inValue.isObject());
</span><span class="cx"> if (inputObjectStack.size() > maximumFilterRecursion)
</span><del>- return StackOverflowError;
</del><ins>+ return SerializationReturnCode::StackOverflowError;
</ins><span class="cx"> JSSet* inSet = jsCast<JSSet*>(inValue);
</span><span class="cx"> if (!startSet(inSet))
</span><span class="cx"> break;
</span><span class="lines">@@ -1431,9 +1434,9 @@
</span><span class="cx">
</span><span class="cx"> stateUnknown:
</span><span class="cx"> case StateUnknown: {
</span><del>- SerializationReturnCode terminalCode = SuccessfullyCompleted;
</del><ins>+ auto terminalCode = SerializationReturnCode::SuccessfullyCompleted;
</ins><span class="cx"> if (dumpIfTerminal(inValue, terminalCode)) {
</span><del>- if (terminalCode != SuccessfullyCompleted)
</del><ins>+ if (terminalCode != SerializationReturnCode::SuccessfullyCompleted)
</ins><span class="cx"> return terminalCode;
</span><span class="cx"> break;
</span><span class="cx"> }
</span><span class="lines">@@ -1454,13 +1457,11 @@
</span><span class="cx"> stateStack.removeLast();
</span><span class="cx"> }
</span><span class="cx"> if (m_failed)
</span><del>- return UnspecifiedError;
</del><ins>+ return SerializationReturnCode::UnspecifiedError;
</ins><span class="cx">
</span><del>- return SuccessfullyCompleted;
</del><ins>+ return SerializationReturnCode::SuccessfullyCompleted;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-typedef Vector<JSC::ArrayBufferContents> ArrayBufferContentsArray;
-
</del><span class="cx"> class CloneDeserializer : CloneBase {
</span><span class="cx"> public:
</span><span class="cx"> static String deserializeString(const Vector<uint8_t>& buffer)
</span><span class="lines">@@ -1489,10 +1490,10 @@
</span><span class="cx"> static DeserializationResult deserialize(ExecState* exec, JSGlobalObject* globalObject, Vector<RefPtr<MessagePort>>& messagePorts, ArrayBufferContentsArray* arrayBufferContentsArray, const Vector<uint8_t>& buffer, const Vector<String>& blobURLs, const Vector<String> blobFilePaths)
</span><span class="cx"> {
</span><span class="cx"> if (!buffer.size())
</span><del>- return std::make_pair(jsNull(), UnspecifiedError);
</del><ins>+ return std::make_pair(jsNull(), SerializationReturnCode::UnspecifiedError);
</ins><span class="cx"> CloneDeserializer deserializer(exec, globalObject, messagePorts, arrayBufferContentsArray, buffer, blobURLs, blobFilePaths);
</span><span class="cx"> if (!deserializer.isValid())
</span><del>- return std::make_pair(JSValue(), ValidationError);
</del><ins>+ return std::make_pair(JSValue(), SerializationReturnCode::ValidationError);
</ins><span class="cx"> return deserializer.deserialize();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -1569,13 +1570,6 @@
</span><span class="cx">
</span><span class="cx"> DeserializationResult deserialize();
</span><span class="cx">
</span><del>- void throwValidationError()
- {
- VM& vm = m_exec->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
- throwTypeError(m_exec, scope, ASCIILiteral("Unable to deserialize data."));
- }
-
</del><span class="cx"> bool isValid() const { return m_version <= CurrentVersion; }
</span><span class="cx">
</span><span class="cx"> template <typename T> bool readLittleEndian(T& value)
</span><span class="lines">@@ -2528,7 +2522,7 @@
</span><span class="cx"> objectStartState:
</span><span class="cx"> case ObjectStartState: {
</span><span class="cx"> if (outputObjectStack.size() > maximumFilterRecursion)
</span><del>- return std::make_pair(JSValue(), StackOverflowError);
</del><ins>+ return std::make_pair(JSValue(), SerializationReturnCode::StackOverflowError);
</ins><span class="cx"> JSObject* outObject = constructEmptyObject(m_exec, m_globalObject->objectPrototype());
</span><span class="cx"> m_gcBuffer.append(outObject);
</span><span class="cx"> outputObjectStack.append(outObject);
</span><span class="lines">@@ -2563,7 +2557,7 @@
</span><span class="cx"> }
</span><span class="cx"> mapObjectStartState: {
</span><span class="cx"> if (outputObjectStack.size() > maximumFilterRecursion)
</span><del>- return std::make_pair(JSValue(), StackOverflowError);
</del><ins>+ return std::make_pair(JSValue(), SerializationReturnCode::StackOverflowError);
</ins><span class="cx"> JSMap* map = JSMap::create(m_exec, m_exec->vm(), m_globalObject->mapStructure());
</span><span class="cx"> if (UNLIKELY(scope.exception()))
</span><span class="cx"> goto error;
</span><span class="lines">@@ -2594,7 +2588,7 @@
</span><span class="cx">
</span><span class="cx"> setObjectStartState: {
</span><span class="cx"> if (outputObjectStack.size() > maximumFilterRecursion)
</span><del>- return std::make_pair(JSValue(), StackOverflowError);
</del><ins>+ return std::make_pair(JSValue(), SerializationReturnCode::StackOverflowError);
</ins><span class="cx"> JSSet* set = JSSet::create(m_exec, m_exec->vm(), m_globalObject->setStructure());
</span><span class="cx"> if (UNLIKELY(scope.exception()))
</span><span class="cx"> goto error;
</span><span class="lines">@@ -2643,10 +2637,10 @@
</span><span class="cx"> }
</span><span class="cx"> ASSERT(outValue);
</span><span class="cx"> ASSERT(!m_failed);
</span><del>- return std::make_pair(outValue, SuccessfullyCompleted);
</del><ins>+ return std::make_pair(outValue, SerializationReturnCode::SuccessfullyCompleted);
</ins><span class="cx"> error:
</span><span class="cx"> fail();
</span><del>- return std::make_pair(JSValue(), ValidationError);
</del><ins>+ return std::make_pair(JSValue(), SerializationReturnCode::ValidationError);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> SerializedScriptValue::~SerializedScriptValue()
</span><span class="lines">@@ -2669,19 +2663,12 @@
</span><span class="cx"> m_blobURLs.append(url.isolatedCopy());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-std::unique_ptr<SerializedScriptValue::ArrayBufferContentsArray> SerializedScriptValue::transferArrayBuffers(
- ExecState* exec, Vector<RefPtr<JSC::ArrayBuffer>>& arrayBuffers, SerializationReturnCode& code)
</del><ins>+static ExceptionOr<std::unique_ptr<ArrayBufferContentsArray>> transferArrayBuffers(const Vector<RefPtr<JSC::ArrayBuffer>>& arrayBuffers)
</ins><span class="cx"> {
</span><del>- for (size_t i = 0; i < arrayBuffers.size(); i++) {
- if (arrayBuffers[i]->isNeutered()) {
- code = ValidationError;
- return nullptr;
- }
- }
</del><ins>+ if (arrayBuffers.isEmpty())
+ return nullptr;
</ins><span class="cx">
</span><span class="cx"> auto contents = std::make_unique<ArrayBufferContentsArray>(arrayBuffers.size());
</span><del>- Vector<Ref<DOMWrapperWorld>> worlds;
- static_cast<JSVMClientData*>(exec->vm().clientData)->getAllWorlds(worlds);
</del><span class="cx">
</span><span class="cx"> HashSet<JSC::ArrayBuffer*> visited;
</span><span class="cx"> for (size_t arrayBufferIndex = 0; arrayBufferIndex < arrayBuffers.size(); arrayBufferIndex++) {
</span><span class="lines">@@ -2690,39 +2677,113 @@
</span><span class="cx"> visited.add(arrayBuffers[arrayBufferIndex].get());
</span><span class="cx">
</span><span class="cx"> bool result = arrayBuffers[arrayBufferIndex]->transferTo(contents->at(arrayBufferIndex));
</span><del>- if (!result) {
- code = ValidationError;
- return nullptr;
- }
</del><ins>+ if (!result)
+ return Exception { TypeError };
</ins><span class="cx"> }
</span><del>- return contents;
</del><ins>+
+ return WTFMove(contents);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<SerializedScriptValue> SerializedScriptValue::create(ExecState& exec, JSValue value, SerializationErrorMode throwExceptions)
</del><ins>+static void maybeThrowExceptionIfSerializationFailed(ExecState* exec, SerializationReturnCode code)
</ins><span class="cx"> {
</span><del>- Vector<RefPtr<MessagePort>> messagePorts;
- return SerializedScriptValue::create(exec, value, messagePorts, { }, throwExceptions);
</del><ins>+ auto& vm = exec->vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ if (code == SerializationReturnCode::SuccessfullyCompleted)
+ return;
+
+ switch (code) {
+ case SerializationReturnCode::StackOverflowError:
+ throwException(exec, scope, createStackOverflowError(exec));
+ break;
+ case SerializationReturnCode::ValidationError:
+ throwTypeError(exec, scope, ASCIILiteral("Unable to deserialize data."));
+ break;
+ case SerializationReturnCode::DataCloneError:
+ setDOMException(exec, DATA_CLONE_ERR);
+ break;
+ case SerializationReturnCode::ExistingExceptionError:
+ case SerializationReturnCode::UnspecifiedError:
+ break;
+ break;
+ case SerializationReturnCode::SuccessfullyCompleted:
+ case SerializationReturnCode::InterruptedExecutionError:
+ ASSERT_NOT_REACHED();
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<SerializedScriptValue> SerializedScriptValue::create(ExecState& exec, JSValue value, Vector<RefPtr<MessagePort>>& messagePorts, Vector<RefPtr<JSC::ArrayBuffer>>&& arrayBuffers, SerializationErrorMode throwExceptions)
</del><ins>+static Exception exceptionForSerializationFailure(SerializationReturnCode code)
</ins><span class="cx"> {
</span><ins>+ ASSERT(code != SerializationReturnCode::SuccessfullyCompleted);
+
+ switch (code) {
+ case SerializationReturnCode::StackOverflowError:
+ return Exception { StackOverflowError };
+ case SerializationReturnCode::ValidationError:
+ return Exception { TypeError };
+ case SerializationReturnCode::DataCloneError:
+ return Exception { DATA_CLONE_ERR };
+ case SerializationReturnCode::ExistingExceptionError:
+ return Exception { ExistingExceptionError };
+ case SerializationReturnCode::UnspecifiedError:
+ return Exception { TypeError };
+ case SerializationReturnCode::SuccessfullyCompleted:
+ case SerializationReturnCode::InterruptedExecutionError:
+ ASSERT_NOT_REACHED();
+ return Exception { TypeError };
+ }
+}
+
+RefPtr<SerializedScriptValue> SerializedScriptValue::create(ExecState& exec, JSValue value, SerializationErrorMode throwExceptions)
+{
</ins><span class="cx"> Vector<uint8_t> buffer;
</span><span class="cx"> Vector<String> blobURLs;
</span><del>- SerializationReturnCode code = CloneSerializer::serialize(&exec, value, messagePorts, arrayBuffers, blobURLs, buffer);
</del><ins>+ Vector<RefPtr<MessagePort>> dummyMessagePorts;
+ Vector<RefPtr<JSC::ArrayBuffer>> dummyArrayBuffers;
+ auto code = CloneSerializer::serialize(&exec, value, dummyMessagePorts, dummyArrayBuffers, blobURLs, buffer);
</ins><span class="cx">
</span><del>- std::unique_ptr<ArrayBufferContentsArray> arrayBufferContentsArray;
- if (!arrayBuffers.isEmpty() && serializationDidCompleteSuccessfully(code))
- arrayBufferContentsArray = transferArrayBuffers(&exec, arrayBuffers, code);
-
</del><span class="cx"> if (throwExceptions == Throwing)
</span><span class="cx"> maybeThrowExceptionIfSerializationFailed(&exec, code);
</span><span class="cx">
</span><del>- if (!serializationDidCompleteSuccessfully(code))
</del><ins>+ if (code != SerializationReturnCode::SuccessfullyCompleted)
</ins><span class="cx"> return nullptr;
</span><span class="cx">
</span><del>- return adoptRef(*new SerializedScriptValue(WTFMove(buffer), blobURLs, WTFMove(arrayBufferContentsArray)));
</del><ins>+ return adoptRef(*new SerializedScriptValue(WTFMove(buffer), blobURLs, nullptr));
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ExceptionOr<Ref<SerializedScriptValue>> SerializedScriptValue::create(ExecState& state, JSValue value, Vector<JSC::Strong<JSC::JSObject>>&& transferList, Vector<RefPtr<MessagePort>>& messagePorts)
+{
+ Vector<RefPtr<JSC::ArrayBuffer>> arrayBuffers;
+ for (auto& transferable : transferList) {
+ if (auto arrayBuffer = toPossiblySharedArrayBuffer(transferable.get())) {
+ if (arrayBuffer->isNeutered())
+ return Exception { DATA_CLONE_ERR };
+ arrayBuffers.append(WTFMove(arrayBuffer));
+ continue;
+ }
+ if (auto port = JSMessagePort::toWrapped(transferable.get())) {
+ // FIXME: This should check if the port is detached as per https://html.spec.whatwg.org/multipage/infrastructure.html#istransferable.
+ messagePorts.append(WTFMove(port));
+ continue;
+ }
+
+ return Exception { DATA_CLONE_ERR };
+ }
+
+ Vector<uint8_t> buffer;
+ Vector<String> blobURLs;
+ auto code = CloneSerializer::serialize(&state, value, messagePorts, arrayBuffers, blobURLs, buffer);
+
+ if (code != SerializationReturnCode::SuccessfullyCompleted)
+ return exceptionForSerializationFailure(code);
+
+ auto arrayBufferContentsArray = transferArrayBuffers(arrayBuffers);
+ if (arrayBufferContentsArray.hasException())
+ return arrayBufferContentsArray.releaseException();
+
+ return adoptRef(*new SerializedScriptValue(WTFMove(buffer), blobURLs, arrayBufferContentsArray.releaseReturnValue()));
+}
+
</ins><span class="cx"> RefPtr<SerializedScriptValue> SerializedScriptValue::create(StringView string)
</span><span class="cx"> {
</span><span class="cx"> Vector<uint8_t> buffer;
</span><span class="lines">@@ -2799,38 +2860,6 @@
</span><span class="cx"> return adoptRef(*new SerializedScriptValue(Vector<uint8_t>()));
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void SerializedScriptValue::maybeThrowExceptionIfSerializationFailed(ExecState* exec, SerializationReturnCode code)
-{
- VM& vm = exec->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- if (code == SuccessfullyCompleted)
- return;
-
- switch (code) {
- case StackOverflowError:
- throwException(exec, scope, createStackOverflowError(exec));
- break;
- case ValidationError:
- throwTypeError(exec, scope, ASCIILiteral("Unable to deserialize data."));
- break;
- case DataCloneError:
- setDOMException(exec, DATA_CLONE_ERR);
- break;
- case ExistingExceptionError:
- break;
- case UnspecifiedError:
- break;
- default:
- ASSERT_NOT_REACHED();
- }
-}
-
-bool SerializedScriptValue::serializationDidCompleteSuccessfully(SerializationReturnCode code)
-{
- return (code == SuccessfullyCompleted);
-}
-
</del><span class="cx"> uint32_t SerializedScriptValue::wireFormatVersion()
</span><span class="cx"> {
</span><span class="cx"> return CurrentVersion;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx">
</span><span class="cx"> #pragma once
</span><span class="cx">
</span><ins>+#include "ExceptionOr.h"
</ins><span class="cx"> #include <bindings/ScriptValue.h>
</span><span class="cx"> #include <heap/Strong.h>
</span><span class="cx"> #include <runtime/ArrayBuffer.h>
</span><span class="lines">@@ -42,26 +43,19 @@
</span><span class="cx">
</span><span class="cx"> class IDBValue;
</span><span class="cx"> class MessagePort;
</span><del>-
-enum SerializationReturnCode {
- SuccessfullyCompleted,
- StackOverflowError,
- InterruptedExecutionError,
- ValidationError,
- ExistingExceptionError,
- DataCloneError,
- UnspecifiedError
-};
-
</del><ins>+class SharedBuffer;
+enum class SerializationReturnCode;
+
</ins><span class="cx"> enum SerializationErrorMode { NonThrowing, Throwing };
</span><span class="cx">
</span><del>-class SharedBuffer;
</del><ins>+using ArrayBufferContentsArray = Vector<JSC::ArrayBufferContents>;
</ins><span class="cx">
</span><span class="cx"> class SerializedScriptValue : public ThreadSafeRefCounted<SerializedScriptValue> {
</span><span class="cx"> public:
</span><span class="cx"> WEBCORE_EXPORT static RefPtr<SerializedScriptValue> create(JSC::ExecState&, JSC::JSValue, SerializationErrorMode = Throwing);
</span><del>- WEBCORE_EXPORT static RefPtr<SerializedScriptValue> create(JSC::ExecState&, JSC::JSValue, Vector<RefPtr<MessagePort>>&, Vector<RefPtr<JSC::ArrayBuffer>>&&, SerializationErrorMode = Throwing);
</del><span class="cx">
</span><ins>+ WEBCORE_EXPORT static ExceptionOr<Ref<SerializedScriptValue>> create(JSC::ExecState&, JSC::JSValue, Vector<JSC::Strong<JSC::JSObject>>&&, Vector<RefPtr<MessagePort>>&);
+
</ins><span class="cx"> WEBCORE_EXPORT static RefPtr<SerializedScriptValue> create(StringView);
</span><span class="cx"> static Ref<SerializedScriptValue> adopt(Vector<uint8_t>&& buffer)
</span><span class="cx"> {
</span><span class="lines">@@ -100,17 +94,11 @@
</span><span class="cx"> WEBCORE_EXPORT ~SerializedScriptValue();
</span><span class="cx">
</span><span class="cx"> private:
</span><del>- typedef Vector<JSC::ArrayBufferContents> ArrayBufferContentsArray;
- static void maybeThrowExceptionIfSerializationFailed(JSC::ExecState*, SerializationReturnCode);
- static bool serializationDidCompleteSuccessfully(SerializationReturnCode);
- static std::unique_ptr<ArrayBufferContentsArray> transferArrayBuffers(JSC::ExecState*, Vector<RefPtr<JSC::ArrayBuffer>>&, SerializationReturnCode&);
-
</del><span class="cx"> WEBCORE_EXPORT SerializedScriptValue(Vector<unsigned char>&&);
</span><span class="cx"> SerializedScriptValue(Vector<unsigned char>&&, const Vector<String>& blobURLs, std::unique_ptr<ArrayBufferContentsArray>&&);
</span><span class="cx">
</span><span class="cx"> Vector<unsigned char> m_data;
</span><span class="cx"> std::unique_ptr<ArrayBufferContentsArray> m_arrayBufferContentsArray;
</span><del>-
</del><span class="cx"> Vector<String> m_blobURLs;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -597,6 +597,7 @@
</span><span class="cx"> return 0 if $object->IsStringType($type);
</span><span class="cx"> return 0 if $type->isUnion;
</span><span class="cx"> return 0 if $type->name eq "any";
</span><ins>+ return 0 if $type->name eq "object";
</ins><span class="cx">
</span><span class="cx"> return 1;
</span><span class="cx"> }
</span><span class="lines">@@ -862,6 +863,7 @@
</span><span class="cx"> return 1 if $object->IsTypedArrayType($type);
</span><span class="cx"> return 1 if $type->isUnion;
</span><span class="cx"> return 1 if $type->name eq "any";
</span><ins>+ return 1 if $type->name eq "object";
</ins><span class="cx"> return 1 if $type->name eq "BufferSource";
</span><span class="cx"> return 1 if $type->name eq "Promise";
</span><span class="cx"> return 1 if $type->name eq "XPathNSResolver";
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -279,6 +279,7 @@
</span><span class="cx"> return if $codeGenerator->IsStringType($type);
</span><span class="cx"> return if $codeGenerator->IsTypedArrayType($type);
</span><span class="cx"> return if $type->name eq "any";
</span><ins>+ return if $type->name eq "object";
</ins><span class="cx">
</span><span class="cx"> if ($type->isUnion) {
</span><span class="cx"> AddToIncludes("<wtf/Variant.h>", $includesRef, $conditional);
</span><span class="lines">@@ -4970,6 +4971,7 @@
</span><span class="cx"> "SerializedScriptValue" => "RefPtr<SerializedScriptValue>",
</span><span class="cx"> "XPathNSResolver" => "RefPtr<XPathNSResolver>",
</span><span class="cx"> "any" => "JSC::JSValue",
</span><ins>+ "object" => "JSC::Strong<JSC::JSObject>",
</ins><span class="cx"> "boolean" => "bool",
</span><span class="cx"> "byte" => "int8_t",
</span><span class="cx"> "double" => "double",
</span><span class="lines">@@ -5058,6 +5060,7 @@
</span><span class="cx"> "DOMString" => "IDLDOMString",
</span><span class="cx"> "ByteString" => "IDLByteString",
</span><span class="cx"> "USVString" => "IDLUSVString",
</span><ins>+ "object" => "IDLObject",
</ins><span class="cx">
</span><span class="cx"> # Non-WebIDL extensions
</span><span class="cx"> "Date" => "IDLDate",
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -1015,6 +1015,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBoolean(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalAny(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalObject(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver(JSC::ExecState*);
</span><span class="lines">@@ -1240,6 +1241,8 @@
</span><span class="cx"> JSC::EncodedJSValue jsTestObjCachedAttribute2(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjAnyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjAnyAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><ins>+JSC::EncodedJSValue jsTestObjObjectAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjObjectAttribute(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</ins><span class="cx"> JSC::EncodedJSValue jsTestObjContentDocument(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjMutablePoint(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjMutablePoint(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="lines">@@ -1540,6 +1543,7 @@
</span><span class="cx"> { "cachedAttribute1", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute1), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
</span><span class="cx"> { "cachedAttribute2", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjCachedAttribute2), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
</span><span class="cx"> { "anyAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjAnyAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjAnyAttribute) } },
</span><ins>+ { "objectAttribute", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjObjectAttribute), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjObjectAttribute) } },
</ins><span class="cx"> { "contentDocument", ReadOnly | CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjContentDocument), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(0) } },
</span><span class="cx"> { "mutablePoint", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjMutablePoint), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjMutablePoint) } },
</span><span class="cx"> { "immutablePoint", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjImmutablePoint), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjImmutablePoint) } },
</span><span class="lines">@@ -1652,6 +1656,7 @@
</span><span class="cx"> { "methodWithOptionalBoolean", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalBoolean), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalBooleanIsFalse", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalBooleanIsFalse), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalAny", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalAny), (intptr_t) (0) } },
</span><ins>+ { "methodWithOptionalObject", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalObject), (intptr_t) (0) } },
</ins><span class="cx"> { "methodWithOptionalNullableWrapper", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalNullableWrapperIsNull", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperIsNull), (intptr_t) (0) } },
</span><span class="cx"> { "methodWithOptionalXPathNSResolver", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalXPathNSResolver), (intptr_t) (0) } },
</span><span class="lines">@@ -3025,6 +3030,22 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline JSValue jsTestObjObjectAttributeGetter(ExecState&, JSTestObj&, ThrowScope& throwScope);
+
+EncodedJSValue jsTestObjObjectAttribute(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ return BindingCaller<JSTestObj>::attribute<jsTestObjObjectAttributeGetter>(state, thisValue, "objectAttribute");
+}
+
+static inline JSValue jsTestObjObjectAttributeGetter(ExecState& state, JSTestObj& thisObject, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(throwScope);
+ UNUSED_PARAM(state);
+ auto& impl = thisObject.wrapped();
+ JSValue result = toJS<IDLObject>(impl.objectAttribute());
+ return result;
+}
+
</ins><span class="cx"> static inline JSValue jsTestObjContentDocumentGetter(ExecState&, JSTestObj&, ThrowScope& throwScope);
</span><span class="cx">
</span><span class="cx"> EncodedJSValue jsTestObjContentDocument(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="lines">@@ -4623,6 +4644,25 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><ins>+static inline bool setJSTestObjObjectAttributeFunction(ExecState&, JSTestObj&, JSValue, ThrowScope&);
+
+bool setJSTestObjObjectAttribute(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ return BindingCaller<JSTestObj>::setAttribute<setJSTestObjObjectAttributeFunction>(state, thisValue, encodedValue, "objectAttribute");
+}
+
+static inline bool setJSTestObjObjectAttributeFunction(ExecState& state, JSTestObj& thisObject, JSValue value, ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = thisObject.wrapped();
+ auto nativeValue = convert<IDLObject>(state, value);
+ RETURN_IF_EXCEPTION(throwScope, false);
+ impl.setObjectAttribute(WTFMove(nativeValue));
+ return true;
+}
+
+
</ins><span class="cx"> static inline bool setJSTestObjMutablePointFunction(ExecState&, JSTestObj&, JSValue, ThrowScope&);
</span><span class="cx">
</span><span class="cx"> bool setJSTestObjMutablePoint(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</span><span class="lines">@@ -6433,6 +6473,24 @@
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalObjectCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
+
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalObject(ExecState* state)
+{
+ return BindingCaller<JSTestObj>::callOperation<jsTestObjPrototypeFunctionMethodWithOptionalObjectCaller>(state, "methodWithOptionalObject");
+}
+
+static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalObjectCaller(JSC::ExecState* state, JSTestObj* castedThis, JSC::ThrowScope& throwScope)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(throwScope);
+ auto& impl = castedThis->wrapped();
+ auto a = state->argument(0).isUndefined() ? std::optional<JSC::Strong<JSC::JSObject>>() : convert<IDLObject>(*state, state->uncheckedArgument(0));
+ RETURN_IF_EXCEPTION(throwScope, encodedJSValue());
+ impl.methodWithOptionalObject(WTFMove(a));
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> static inline JSC::EncodedJSValue jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapperCaller(JSC::ExecState*, JSTestObj*, JSC::ThrowScope&);
</span><span class="cx">
</span><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalNullableWrapper(ExecState* state)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -233,6 +233,7 @@
</span><span class="cx"> void methodWithOptionalBoolean(optional boolean b);
</span><span class="cx"> void methodWithOptionalBooleanIsFalse(optional boolean b = false);
</span><span class="cx"> void methodWithOptionalAny(optional any a);
</span><ins>+ void methodWithOptionalObject(optional object a);
</ins><span class="cx"> void methodWithOptionalNullableWrapper(optional TestObj? obj);
</span><span class="cx"> void methodWithOptionalNullableWrapperIsNull(optional TestObj? obj = null);
</span><span class="cx"> void methodWithOptionalXPathNSResolver(optional XPathNSResolver? resolver);
</span><span class="lines">@@ -272,6 +273,7 @@
</span><span class="cx"> [CachedAttribute] readonly attribute any cachedAttribute2;
</span><span class="cx">
</span><span class="cx"> attribute any anyAttribute;
</span><ins>+ attribute object objectAttribute;
</ins><span class="cx">
</span><span class="cx"> // Overloads
</span><span class="cx"> void overloadedMethod(TestObj? objArg, DOMString strArg);
</span></span></pre></div>
<a id="trunkSourceWebCoredomExceptionCodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ExceptionCode.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ExceptionCode.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/dom/ExceptionCode.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -72,6 +72,12 @@
</span><span class="cx"> OperationError,
</span><span class="cx"> NotAllowedError,
</span><span class="cx">
</span><ins>+ // Non-standard errors
+ StackOverflowError,
+
+ // Used to indicate to the bindings that a JS exception was thrown below and it should be propogated.
+ ExistingExceptionError,
+
</ins><span class="cx"> // WebIDL exception types, handled by the binding layer.
</span><span class="cx"> // FIXME: Add GeneralError, EvalError, etc. when implemented in the bindings.
</span><span class="cx"> TypeError = 105,
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessagePortcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessagePort.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessagePort.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/dom/MessagePort.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -51,8 +51,13 @@
</span><span class="cx"> m_scriptExecutionContext->destroyedMessagePort(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> MessagePort::postMessage(RefPtr<SerializedScriptValue>&& message, Vector<RefPtr<MessagePort>>&& ports)
</del><ins>+ExceptionOr<void> MessagePort::postMessage(JSC::ExecState& state, JSC::JSValue messageValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
</ins><span class="cx"> {
</span><ins>+ Vector<RefPtr<MessagePort>> ports;
+ auto message = SerializedScriptValue::create(state, messageValue, WTFMove(transfer), ports);
+ if (message.hasException())
+ return message.releaseException();
+
</ins><span class="cx"> if (!isEntangled())
</span><span class="cx"> return { };
</span><span class="cx"> ASSERT(m_scriptExecutionContext);
</span><span class="lines">@@ -69,7 +74,7 @@
</span><span class="cx"> return disentangleResult.releaseException();
</span><span class="cx"> channels = disentangleResult.releaseReturnValue();
</span><span class="cx"> }
</span><del>- m_entangledChannel->postMessageToRemote(WTFMove(message), WTFMove(channels));
</del><ins>+ m_entangledChannel->postMessageToRemote(message.releaseReturnValue(), WTFMove(channels));
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessagePorth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessagePort.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessagePort.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/dom/MessagePort.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -30,6 +30,12 @@
</span><span class="cx"> #include "ExceptionOr.h"
</span><span class="cx"> #include "MessagePortChannel.h"
</span><span class="cx">
</span><ins>+namespace JSC {
+class ExecState;
+class JSObject;
+class JSValue;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class Frame;
</span><span class="lines">@@ -39,7 +45,7 @@
</span><span class="cx"> static Ref<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(*new MessagePort(scriptExecutionContext)); }
</span><span class="cx"> virtual ~MessagePort();
</span><span class="cx">
</span><del>- ExceptionOr<void> postMessage(RefPtr<SerializedScriptValue>&& message, Vector<RefPtr<MessagePort>>&&);
</del><ins>+ ExceptionOr<void> postMessage(JSC::ExecState&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&&);
</ins><span class="cx">
</span><span class="cx"> void start();
</span><span class="cx"> void close();
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessagePortidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessagePort.idl (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessagePort.idl        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/dom/MessagePort.idl        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -31,8 +31,7 @@
</span><span class="cx"> GenerateIsReachable=Impl,
</span><span class="cx"> JSCustomMarkFunction,
</span><span class="cx"> ] interface MessagePort : EventTarget {
</span><del>- [Custom, MayThrowException] void postMessage(any message, optional Array messagePorts);
-
</del><ins>+ [CallWith=ScriptState, MayThrowException] void postMessage(any message, optional sequence<object> transfer = []);
</ins><span class="cx"> void start();
</span><span class="cx"> void close();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx"> #include <wtf/MathExtras.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="cx"> #include <wtf/Ref.h>
</span><ins>+#include <wtf/Variant.h>
</ins><span class="cx"> #include <wtf/text/WTFString.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(USER_MESSAGE_HANDLERS)
</span><span class="lines">@@ -919,12 +920,12 @@
</span><span class="cx"> return m_localStorage.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> DOMWindow::postMessage(Ref<SerializedScriptValue>&& message, Vector<RefPtr<MessagePort>>&& ports, const String& targetOrigin, DOMWindow& source)
</del><ins>+ExceptionOr<void> DOMWindow::postMessage(JSC::ExecState& state, DOMWindow& callerWindow, JSC::JSValue messageValue, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
</ins><span class="cx"> {
</span><span class="cx"> if (!isCurrentlyDisplayedInFrame())
</span><span class="cx"> return { };
</span><span class="cx">
</span><del>- Document* sourceDocument = source.document();
</del><ins>+ Document* sourceDocument = callerWindow.document();
</ins><span class="cx">
</span><span class="cx"> // Compute the target origin. We need to do this synchronously in order
</span><span class="cx"> // to generate the SYNTAX_ERR exception correctly.
</span><span class="lines">@@ -941,6 +942,11 @@
</span><span class="cx"> return Exception { SYNTAX_ERR };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ Vector<RefPtr<MessagePort>> ports;
+ auto message = SerializedScriptValue::create(state, messageValue, WTFMove(transfer), ports);
+ if (message.hasException())
+ return message.releaseException();
+
</ins><span class="cx"> auto channels = MessagePort::disentanglePorts(WTFMove(ports));
</span><span class="cx"> if (channels.hasException())
</span><span class="cx"> return channels.releaseException();
</span><span class="lines">@@ -957,7 +963,7 @@
</span><span class="cx"> stackTrace = createScriptCallStack(JSMainThreadExecState::currentState(), ScriptCallStack::maxCallStackSizeToCapture);
</span><span class="cx">
</span><span class="cx"> // Schedule the message.
</span><del>- auto* timer = new PostMessageTimer(*this, WTFMove(message), sourceOrigin, source, channels.releaseReturnValue(), WTFMove(target), WTFMove(stackTrace));
</del><ins>+ auto* timer = new PostMessageTimer(*this, message.releaseReturnValue(), sourceOrigin, callerWindow, channels.releaseReturnValue(), WTFMove(target), WTFMove(stackTrace));
</ins><span class="cx"> timer->startOneShot(0);
</span><span class="cx">
</span><span class="cx"> return { };
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include "URL.h"
</span><span class="cx"> #include <functional>
</span><span class="cx"> #include <memory>
</span><ins>+#include <wtf/Forward.h>
</ins><span class="cx"> #include <wtf/HashSet.h>
</span><span class="cx"> #include <wtf/Optional.h>
</span><span class="cx"> #include <wtf/WeakPtr.h>
</span><span class="lines">@@ -44,6 +45,13 @@
</span><span class="cx"> class ScriptCallStack;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+namespace JSC {
+class ExecState;
+class JSObject;
+class JSValue;
+template<typename T> class Strong;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class BarProp;
</span><span class="lines">@@ -235,7 +243,7 @@
</span><span class="cx"> void printErrorMessage(const String&);
</span><span class="cx"> String crossDomainAccessErrorMessage(const DOMWindow& activeWindow);
</span><span class="cx">
</span><del>- ExceptionOr<void> postMessage(Ref<SerializedScriptValue>&& message, Vector<RefPtr<MessagePort>>&&, const String& targetOrigin, DOMWindow& source);
</del><ins>+ ExceptionOr<void> postMessage(JSC::ExecState&, DOMWindow& callerWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&);
</ins><span class="cx"> void postMessageTimerFired(PostMessageTimer&);
</span><span class="cx"> void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event&, PassRefPtr<Inspector::ScriptCallStack>);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.idl (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.idl        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/page/DOMWindow.idl        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx"> // 0 when straight up; -90 when rotated 90 degrees clockwise; 90 counter clockwise.
</span><span class="cx"> [Conditional=ORIENTATION_EVENTS] readonly attribute long orientation;
</span><span class="cx">
</span><del>- [DoNotCheckSecurity, Custom, MayThrowException, ForwardDeclareInHeader] void postMessage(SerializedScriptValue message, USVString targetOrigin, optional Array messagePorts);
</del><ins>+ [CallWith=ScriptState&CallerWindow, DoNotCheckSecurity, ForwardDeclareInHeader, MayThrowException] void postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
</ins><span class="cx">
</span><span class="cx"> [Conditional=WEB_TIMING, Replaceable] readonly attribute Performance performance;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersDedicatedWorkerGlobalScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -63,13 +63,18 @@
</span><span class="cx"> return DedicatedWorkerGlobalScopeEventTargetInterfaceType;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> DedicatedWorkerGlobalScope::postMessage(RefPtr<SerializedScriptValue>&& message, Vector<RefPtr<MessagePort>>&& ports)
</del><ins>+ExceptionOr<void> DedicatedWorkerGlobalScope::postMessage(JSC::ExecState& state, JSC::JSValue messageValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
</ins><span class="cx"> {
</span><ins>+ Vector<RefPtr<MessagePort>> ports;
+ auto message = SerializedScriptValue::create(state, messageValue, WTFMove(transfer), ports);
+ if (message.hasException())
+ return message.releaseException();
+
</ins><span class="cx"> // Disentangle the port in preparation for sending it to the remote context.
</span><span class="cx"> auto channels = MessagePort::disentanglePorts(WTFMove(ports));
</span><span class="cx"> if (channels.hasException())
</span><span class="cx"> return channels.releaseException();
</span><del>- thread().workerObjectProxy().postMessageToWorkerObject(WTFMove(message), channels.releaseReturnValue());
</del><ins>+ thread().workerObjectProxy().postMessageToWorkerObject(message.releaseReturnValue(), channels.releaseReturnValue());
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersDedicatedWorkerGlobalScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -33,6 +33,12 @@
</span><span class="cx">
</span><span class="cx"> #include "WorkerGlobalScope.h"
</span><span class="cx">
</span><ins>+namespace JSC {
+class ExecState;
+class JSObject;
+class JSValue;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class ContentSecurityPolicyResponseHeaders;
</span><span class="lines">@@ -45,7 +51,7 @@
</span><span class="cx"> static Ref<DedicatedWorkerGlobalScope> create(const URL&, const String& identifier, const String& userAgent, DedicatedWorkerThread&, const ContentSecurityPolicyResponseHeaders&, bool shouldBypassMainWorldContentSecurityPolicy, RefPtr<SecurityOrigin>&& topOrigin, IDBClient::IDBConnectionProxy*, SocketProvider*);
</span><span class="cx"> virtual ~DedicatedWorkerGlobalScope();
</span><span class="cx">
</span><del>- ExceptionOr<void> postMessage(RefPtr<SerializedScriptValue>&&, Vector<RefPtr<MessagePort>>&&);
</del><ins>+ ExceptionOr<void> postMessage(JSC::ExecState&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&&);
</ins><span class="cx">
</span><span class="cx"> DedicatedWorkerThread& thread();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersDedicatedWorkerGlobalScopeidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.idl        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> Global=(Worker,DedicatedWorker),
</span><span class="cx"> JSGenerateToNativeObject,
</span><span class="cx"> ] interface DedicatedWorkerGlobalScope : WorkerGlobalScope {
</span><del>- [Custom, MayThrowException] void postMessage(any message, optional Array messagePorts);
</del><ins>+ [CallWith=ScriptState, MayThrowException] void postMessage(any message, optional sequence<object> transfer = []);
</ins><span class="cx">
</span><span class="cx"> attribute EventHandler onmessage;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/Worker.cpp (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/Worker.cpp        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/workers/Worker.cpp        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -101,13 +101,18 @@
</span><span class="cx"> m_contextProxy->workerObjectDestroyed();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> Worker::postMessage(RefPtr<SerializedScriptValue>&& message, Vector<RefPtr<MessagePort>>&& ports)
</del><ins>+ExceptionOr<void> Worker::postMessage(JSC::ExecState& state, JSC::JSValue messageValue, Vector<JSC::Strong<JSC::JSObject>>&& transfer)
</ins><span class="cx"> {
</span><ins>+ Vector<RefPtr<MessagePort>> ports;
+ auto message = SerializedScriptValue::create(state, messageValue, WTFMove(transfer), ports);
+ if (message.hasException())
+ return message.releaseException();
+
</ins><span class="cx"> // Disentangle the port in preparation for sending it to the remote context.
</span><span class="cx"> auto channels = MessagePort::disentanglePorts(WTFMove(ports));
</span><span class="cx"> if (channels.hasException())
</span><span class="cx"> return channels.releaseException();
</span><del>- m_contextProxy->postMessageToWorkerGlobalScope(WTFMove(message), channels.releaseReturnValue());
</del><ins>+ m_contextProxy->postMessageToWorkerGlobalScope(message.releaseReturnValue(), channels.releaseReturnValue());
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/Worker.h (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/Worker.h        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/workers/Worker.h        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -35,6 +35,12 @@
</span><span class="cx"> #include <wtf/Optional.h>
</span><span class="cx"> #include <wtf/text/AtomicStringHash.h>
</span><span class="cx">
</span><ins>+namespace JSC {
+class ExecState;
+class JSObject;
+class JSValue;
+}
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="cx"> class ScriptExecutionContext;
</span><span class="lines">@@ -46,7 +52,7 @@
</span><span class="cx"> static ExceptionOr<Ref<Worker>> create(ScriptExecutionContext&, const String& url, JSC::RuntimeFlags);
</span><span class="cx"> virtual ~Worker();
</span><span class="cx">
</span><del>- ExceptionOr<void> postMessage(RefPtr<SerializedScriptValue>&& message, Vector<RefPtr<MessagePort>>&&);
</del><ins>+ ExceptionOr<void> postMessage(JSC::ExecState&, JSC::JSValue message, Vector<JSC::Strong<JSC::JSObject>>&&);
</ins><span class="cx">
</span><span class="cx"> void terminate();
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkeridl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/Worker.idl (209302 => 209303)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/Worker.idl        2016-12-03 19:56:49 UTC (rev 209302)
+++ trunk/Source/WebCore/workers/Worker.idl        2016-12-03 20:22:43 UTC (rev 209303)
</span><span class="lines">@@ -28,11 +28,10 @@
</span><span class="cx"> ActiveDOMObject,
</span><span class="cx"> CustomConstructor(USVString scriptUrl),
</span><span class="cx"> ] interface Worker : EventTarget {
</span><ins>+ void terminate();
+
+ [CallWith=ScriptState, MayThrowException] void postMessage(any message, optional sequence<object> transfer = []);
</ins><span class="cx"> attribute EventHandler onmessage;
</span><del>-
- [Custom, MayThrowException] void postMessage(SerializedScriptValue message, optional Array messagePorts);
-
- void terminate();
</del><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> Worker implements AbstractWorker;
</span></span></pre>
</div>
</div>
</body>
</html>