<!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>[207505] trunk/Source/WebCore</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/207505">207505</a></dd>
<dt>Author</dt> <dd>weinig@apple.com</dd>
<dt>Date</dt> <dd>2016-10-18 17:05:09 -0700 (Tue, 18 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify SerializedScriptValue, MessagePortArray and ArrayBufferArray to ease generation
https://bugs.webkit.org/show_bug.cgi?id=163625

Reviewed by Chris Dumez.

- Replace uses of MessagePortArray (a.k.a. Vector&lt;RefPtr&lt;MessagePort&gt;, 1&gt;) with Vector&lt;RefPtr&lt;MessagePort&gt;&gt;.
- Replace uses of ArrayBufferArray (a.k.a. Vector&lt;RefPtr&lt;ArrayBuffer&gt;, 1&gt;) with Vector&lt;RefPtr&lt;ArrayBuffer&gt;&gt;.
- Add convenience functions to SerializedScriptValue to allow calling with fewer parameters.
- Move MessagePorts and ArrayBuffers more where possible.

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::putOrAdd):
* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
* bindings/js/IDBBindingUtilities.cpp:
(WebCore::deserializeIDBValueToJSValue):
* bindings/js/JSCustomEventCustom.cpp:
(WebCore::JSCustomEvent::detail):
* bindings/js/JSHistoryCustom.cpp:
(WebCore::JSHistory::state):
(WebCore::JSHistory::pushState):
(WebCore::JSHistory::replaceState):
* bindings/js/JSPopStateEventCustom.cpp:
(WebCore::JSPopStateEvent::state):
* dom/CustomEvent.cpp:
(WebCore::CustomEvent::trySerializeDetail):
* dom/ErrorEvent.cpp:
(WebCore::ErrorEvent::sanitizedErrorValue):
(WebCore::ErrorEvent::trySerializeError):
* dom/PopStateEvent.cpp:
(WebCore::PopStateEvent::trySerializeState):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::postMessage):
* page/DOMWindow.h:
* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::postMessage):
* workers/DedicatedWorkerGlobalScope.h:
* workers/Worker.cpp:
(WebCore::Worker::postMessage):
* workers/Worker.h:
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::handlePostMessage):
* bindings/js/JSDictionary.cpp:
(WebCore::JSDictionary::convertValue):
* bindings/js/JSDictionary.h:
Updated for new SerializedScriptValue interface/vector naming.

* bindings/js/JSMessageEventCustom.cpp:
(WebCore::handleInitMessageEvent):
Update handleInitMessageEvent to check for exceptions and use convert for the MessagePort sequence.

* bindings/js/JSMessagePortCustom.cpp:
(WebCore::extractTransferables):
(WebCore::fillMessagePortArray): Deleted.
* bindings/js/JSMessagePortCustom.h:
(WebCore::handlePostMessage):
Rename fillMessagePortArray to extractTransferables to better express what it does.

* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(WebCore::CloneSerializer::CloneSerializer):
(WebCore::CloneSerializer::fillTransferMap):
(WebCore::CloneSerializer::dumpIfTerminal):
(WebCore::CloneDeserializer::deserialize):
(WebCore::CloneDeserializer::CloneDeserializer):
(WebCore::CloneDeserializer::readTerminal):
(WebCore::SerializedScriptValue::transferArrayBuffers):
(WebCore::SerializedScriptValue::create):
(WebCore::SerializedScriptValue::deserialize):
* bindings/js/SerializedScriptValue.h:
Simplify interface to allow more callers to avoid passing default arguments. Use ExecState&amp; more.
* bindings/scripts/CodeGeneratorJS.pm:
(GetNativeVectorType):
Remove special case for MessagePort.
(JSValueToNative):
(NativeToJSValue):
Updated for new SerializedScriptValue interface.

* dom/MessageEvent.cpp:
(WebCore::MessageEvent::MessageEvent):
(WebCore::MessageEvent::create):
(WebCore::MessageEvent::initMessageEvent):
(WebCore::MessageEvent::trySerializeData):
* dom/MessageEvent.h:
Store the MessagePort sequence as a Vector&lt;RefPtr&lt;MessagePort&gt;&gt; rather than in a unique_ptr.

* dom/MessageEvent.idl:
Update last type in init functions to be sequence&lt;MessagePort&gt; rather than Array. They are still
custom, as we don't quite generate these correctly yet. 

* dom/MessagePort.cpp:
(WebCore::MessagePort::postMessage):
(WebCore::MessagePort::dispatchMessages):
(WebCore::MessagePort::disentanglePorts):
(WebCore::MessagePort::entanglePorts):
* dom/MessagePort.h:
Update interface to take MessagePort vectors by rvalue reference.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp">trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCustomEventCustomcpp">trunk/Source/WebCore/bindings/js/JSCustomEventCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp">trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDictionarycpp">trunk/Source/WebCore/bindings/js/JSDictionary.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDictionaryh">trunk/Source/WebCore/bindings/js/JSDictionary.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSHistoryCustomcpp">trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMessageEventCustomcpp">trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMessagePortCustomcpp">trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMessagePortCustomh">trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSPopStateEventCustomcpp">trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.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="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCoredomCustomEventcpp">trunk/Source/WebCore/dom/CustomEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomErrorEventcpp">trunk/Source/WebCore/dom/ErrorEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomMessageEventcpp">trunk/Source/WebCore/dom/MessageEvent.cpp</a></li>
<li><a href="#trunkSourceWebCoredomMessageEventh">trunk/Source/WebCore/dom/MessageEvent.h</a></li>
<li><a href="#trunkSourceWebCoredomMessageEventidl">trunk/Source/WebCore/dom/MessageEvent.idl</a></li>
<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="#trunkSourceWebCoredomPopStateEventcpp">trunk/Source/WebCore/dom/PopStateEvent.cpp</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="#trunkSourceWebCoreworkersDedicatedWorkerGlobalScopecpp">trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersDedicatedWorkerGlobalScopeh">trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/ChangeLog        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -1,3 +1,103 @@
</span><ins>+2016-10-18  Sam Weinig  &lt;sam@webkit.org&gt;
+
+        Simplify SerializedScriptValue, MessagePortArray and ArrayBufferArray to ease generation
+        https://bugs.webkit.org/show_bug.cgi?id=163625
+
+        Reviewed by Chris Dumez.
+
+        - Replace uses of MessagePortArray (a.k.a. Vector&lt;RefPtr&lt;MessagePort&gt;, 1&gt;) with Vector&lt;RefPtr&lt;MessagePort&gt;&gt;.
+        - Replace uses of ArrayBufferArray (a.k.a. Vector&lt;RefPtr&lt;ArrayBuffer&gt;, 1&gt;) with Vector&lt;RefPtr&lt;ArrayBuffer&gt;&gt;.
+        - Add convenience functions to SerializedScriptValue to allow calling with fewer parameters.
+        - Move MessagePorts and ArrayBuffers more where possible.
+
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::putOrAdd):
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
+        * bindings/js/IDBBindingUtilities.cpp:
+        (WebCore::deserializeIDBValueToJSValue):
+        * bindings/js/JSCustomEventCustom.cpp:
+        (WebCore::JSCustomEvent::detail):
+        * bindings/js/JSHistoryCustom.cpp:
+        (WebCore::JSHistory::state):
+        (WebCore::JSHistory::pushState):
+        (WebCore::JSHistory::replaceState):
+        * bindings/js/JSPopStateEventCustom.cpp:
+        (WebCore::JSPopStateEvent::state):
+        * dom/CustomEvent.cpp:
+        (WebCore::CustomEvent::trySerializeDetail):
+        * dom/ErrorEvent.cpp:
+        (WebCore::ErrorEvent::sanitizedErrorValue):
+        (WebCore::ErrorEvent::trySerializeError):
+        * dom/PopStateEvent.cpp:
+        (WebCore::PopStateEvent::trySerializeState):
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessage):
+        * page/DOMWindow.h:
+        * workers/DedicatedWorkerGlobalScope.cpp:
+        (WebCore::DedicatedWorkerGlobalScope::postMessage):
+        * workers/DedicatedWorkerGlobalScope.h:
+        * workers/Worker.cpp:
+        (WebCore::Worker::postMessage):
+        * workers/Worker.h:
+        * bindings/js/JSDOMWindowCustom.cpp:
+        (WebCore::handlePostMessage):
+        * bindings/js/JSDictionary.cpp:
+        (WebCore::JSDictionary::convertValue):
+        * bindings/js/JSDictionary.h:
+        Updated for new SerializedScriptValue interface/vector naming.
+
+        * bindings/js/JSMessageEventCustom.cpp:
+        (WebCore::handleInitMessageEvent):
+        Update handleInitMessageEvent to check for exceptions and use convert for the MessagePort sequence.
+
+        * bindings/js/JSMessagePortCustom.cpp:
+        (WebCore::extractTransferables):
+        (WebCore::fillMessagePortArray): Deleted.
+        * bindings/js/JSMessagePortCustom.h:
+        (WebCore::handlePostMessage):
+        Rename fillMessagePortArray to extractTransferables to better express what it does.
+
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::CloneSerializer::serialize):
+        (WebCore::CloneSerializer::CloneSerializer):
+        (WebCore::CloneSerializer::fillTransferMap):
+        (WebCore::CloneSerializer::dumpIfTerminal):
+        (WebCore::CloneDeserializer::deserialize):
+        (WebCore::CloneDeserializer::CloneDeserializer):
+        (WebCore::CloneDeserializer::readTerminal):
+        (WebCore::SerializedScriptValue::transferArrayBuffers):
+        (WebCore::SerializedScriptValue::create):
+        (WebCore::SerializedScriptValue::deserialize):
+        * bindings/js/SerializedScriptValue.h:
+        Simplify interface to allow more callers to avoid passing default arguments. Use ExecState&amp; more.
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GetNativeVectorType):
+        Remove special case for MessagePort.
+        (JSValueToNative):
+        (NativeToJSValue):
+        Updated for new SerializedScriptValue interface.
+
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::MessageEvent):
+        (WebCore::MessageEvent::create):
+        (WebCore::MessageEvent::initMessageEvent):
+        (WebCore::MessageEvent::trySerializeData):
+        * dom/MessageEvent.h:
+        Store the MessagePort sequence as a Vector&lt;RefPtr&lt;MessagePort&gt;&gt; rather than in a unique_ptr.
+
+        * dom/MessageEvent.idl:
+        Update last type in init functions to be sequence&lt;MessagePort&gt; rather than Array. They are still
+        custom, as we don't quite generate these correctly yet. 
+
+        * dom/MessagePort.cpp:
+        (WebCore::MessagePort::postMessage):
+        (WebCore::MessagePort::dispatchMessages):
+        (WebCore::MessagePort::disentanglePorts):
+        (WebCore::MessagePort::entanglePorts):
+        * dom/MessagePort.h:
+        Update interface to take MessagePort vectors by rvalue reference.
+
</ins><span class="cx"> 2016-10-18  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Drop JSDictionary::convertValue() overload taking a TouchList
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx">     if (m_transaction-&gt;isReadOnly())
</span><span class="cx">         return Exception { IDBDatabaseException::ReadOnlyError, ASCIILiteral(&quot;Failed to store record in an IDBObjectStore: The transaction is read-only.&quot;) };
</span><span class="cx"> 
</span><del>-    RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::create(&amp;state, value, nullptr, nullptr);
</del><ins>+    auto serializedValue = SerializedScriptValue::create(state, value);
</ins><span class="cx">     if (UNLIKELY(scope.exception())) {
</span><span class="cx">         // Clear the DOM exception from the serializer so we can give a more targeted exception.
</span><span class="cx">         scope.clearException();
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -874,7 +874,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        auto serializedValue = SerializedScriptValue::create(&amp;databaseThreadExecState(), value, nullptr, nullptr);
</del><ins>+        auto serializedValue = SerializedScriptValue::create(databaseThreadExecState(), value);
</ins><span class="cx">         if (UNLIKELY(scope.exception())) {
</span><span class="cx">             postDatabaseTaskReply(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, IDBError(IDBDatabaseException::ConstraintError, ASCIILiteral(&quot;Unable to serialize record value after injecting record key&quot;)), usedKey));
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx"> #include &quot;JSDOMConvert.h&quot;
</span><span class="cx"> #include &quot;JSDOMStringList.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><ins>+#include &quot;MessagePort.h&quot;
</ins><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="cx"> #include &quot;SerializedScriptValue.h&quot;
</span><span class="cx"> #include &quot;SharedBuffer.h&quot;
</span><span class="lines">@@ -328,7 +329,8 @@
</span><span class="cx">     auto serializedValue = SerializedScriptValue::createFromWireBytes(Vector&lt;uint8_t&gt;(data));
</span><span class="cx"> 
</span><span class="cx">     exec.vm().apiLock().lock();
</span><del>-    JSValue result = serializedValue-&gt;deserialize(&amp;exec, exec.lexicalGlobalObject(), 0, NonThrowing, value.blobURLs(), value.blobFilePaths());
</del><ins>+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt; messagePorts;
+    JSValue result = serializedValue-&gt;deserialize(exec, exec.lexicalGlobalObject(), messagePorts, value.blobURLs(), value.blobFilePaths(), NonThrowing);
</ins><span class="cx">     exec.vm().apiLock().unlock();
</span><span class="cx"> 
</span><span class="cx">     return result;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCustomEventCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCustomEventCustom.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCustomEventCustom.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSCustomEventCustom.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx">         auto serializedDetail = event.trySerializeDetail(state);
</span><span class="cx">         if (!serializedDetail)
</span><span class="cx">             return jsNull();
</span><del>-        return serializedDetail-&gt;deserialize(&amp;state, globalObject(), nullptr);
</del><ins>+        return serializedDetail-&gt;deserialize(state, globalObject());
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return detail;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMWindowCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -505,8 +505,8 @@
</span><span class="cx">     if (UNLIKELY(state.argumentCount() &lt; 2))
</span><span class="cx">         return throwException(&amp;state, scope, createNotEnoughArgumentsError(&amp;state));
</span><span class="cx"> 
</span><del>-    MessagePortArray messagePorts;
-    ArrayBufferArray arrayBuffers;
</del><ins>+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt; messagePorts;
+    Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt; arrayBuffers;
</ins><span class="cx"> 
</span><span class="cx">     // This function has variable arguments and can be:
</span><span class="cx">     // Per current spec:
</span><span class="lines">@@ -521,11 +521,11 @@
</span><span class="cx">             targetOriginArgIndex = 2;
</span><span class="cx">             transferablesArgIndex = 1;
</span><span class="cx">         }
</span><del>-        fillMessagePortArray(state, state.argument(transferablesArgIndex), messagePorts, arrayBuffers);
</del><ins>+        extractTransferables(state, state.argument(transferablesArgIndex), messagePorts, arrayBuffers);
</ins><span class="cx">     }
</span><span class="cx">     RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> 
</span><del>-    auto message = SerializedScriptValue::create(&amp;state, state.uncheckedArgument(0), &amp;messagePorts, &amp;arrayBuffers);
</del><ins>+    auto message = SerializedScriptValue::create(state, state.uncheckedArgument(0), messagePorts, WTFMove(arrayBuffers));
</ins><span class="cx"> 
</span><span class="cx">     RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> 
</span><span class="lines">@@ -533,7 +533,7 @@
</span><span class="cx">     RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> 
</span><span class="cx">     ExceptionCode ec = 0;
</span><del>-    impl.postMessage(WTFMove(message), &amp;messagePorts, targetOrigin, callerDOMWindow(&amp;state), ec);
</del><ins>+    impl.postMessage(WTFMove(message), WTFMove(messagePorts), targetOrigin, callerDOMWindow(&amp;state), ec);
</ins><span class="cx">     setDOMException(&amp;state, ec);
</span><span class="cx"> 
</span><span class="cx">     return jsUndefined();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDictionarycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDictionary.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDictionary.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -30,10 +30,11 @@
</span><span class="cx"> #include &quot;DOMWindow.h&quot;
</span><span class="cx"> #include &quot;Dictionary.h&quot;
</span><span class="cx"> #include &quot;JSCSSFontFaceRule.h&quot;
</span><ins>+#include &quot;JSDOMConvert.h&quot;
</ins><span class="cx"> #include &quot;JSDOMError.h&quot;
</span><span class="cx"> #include &quot;JSDOMWindow.h&quot;
</span><span class="cx"> #include &quot;JSEventTarget.h&quot;
</span><del>-#include &quot;JSMessagePortCustom.h&quot;
</del><ins>+#include &quot;JSMessagePort.h&quot;
</ins><span class="cx"> #include &quot;JSNode.h&quot;
</span><span class="cx"> #include &quot;JSStorage.h&quot;
</span><span class="cx"> #include &quot;JSTrackCustom.h&quot;
</span><span class="lines">@@ -177,7 +178,7 @@
</span><span class="cx"> 
</span><span class="cx"> void JSDictionary::convertValue(ExecState* exec, JSValue value, RefPtr&lt;SerializedScriptValue&gt;&amp; result)
</span><span class="cx"> {
</span><del>-    result = SerializedScriptValue::create(exec, value, 0, 0);
</del><ins>+    result = SerializedScriptValue::create(*exec, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void JSDictionary::convertValue(ExecState* state, JSValue value, RefPtr&lt;DOMWindow&gt;&amp; result)
</span><span class="lines">@@ -208,10 +209,9 @@
</span><span class="cx">     result = JSStorage::toWrapped(value);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JSDictionary::convertValue(ExecState* exec, JSValue value, MessagePortArray&amp; result)
</del><ins>+void JSDictionary::convertValue(ExecState* exec, JSValue value, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; result)
</ins><span class="cx"> {
</span><del>-    ArrayBufferArray arrayBuffers;
-    fillMessagePortArray(*exec, value, result, arrayBuffers);
</del><ins>+    result = convert&lt;IDLSequence&lt;IDLInterface&lt;MessagePort&gt;&gt;&gt;(*exec, value);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDictionaryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDictionary.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDictionary.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSDictionary.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -136,7 +136,7 @@
</span><span class="cx">     static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr&lt;EventTarget&gt;&amp; result);
</span><span class="cx">     static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr&lt;Node&gt;&amp; result);
</span><span class="cx">     static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr&lt;Storage&gt;&amp; result);
</span><del>-    static void convertValue(JSC::ExecState*, JSC::JSValue, MessagePortArray&amp; result);
</del><ins>+    static void convertValue(JSC::ExecState*, JSC::JSValue, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; result);
</ins><span class="cx"> #if ENABLE(VIDEO_TRACK)
</span><span class="cx">     static void convertValue(JSC::ExecState*, JSC::JSValue, RefPtr&lt;TrackBase&gt;&amp; result);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSHistoryCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSHistoryCustom.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">         return cachedValue;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;SerializedScriptValue&gt; serialized = history.state();
</span><del>-    JSValue result = serialized ? serialized-&gt;deserialize(&amp;state, globalObject(), 0) : jsNull();
</del><ins>+    JSValue result = serialized ? serialized-&gt;deserialize(state, globalObject()) : jsNull();
</ins><span class="cx">     m_state.set(state.vm(), this, result);
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx">     if (UNLIKELY(argCount &lt; 2))
</span><span class="cx">         return throwException(&amp;state, scope, createNotEnoughArgumentsError(&amp;state));
</span><span class="cx"> 
</span><del>-    auto historyState = SerializedScriptValue::create(&amp;state, state.uncheckedArgument(0), 0, 0);
</del><ins>+    auto historyState = SerializedScriptValue::create(state, state.uncheckedArgument(0));
</ins><span class="cx">     RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> 
</span><span class="cx">     // FIXME: title should not be nullable.
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx">     if (UNLIKELY(argCount &lt; 2))
</span><span class="cx">         return throwException(&amp;state, scope, createNotEnoughArgumentsError(&amp;state));
</span><span class="cx"> 
</span><del>-    auto historyState = SerializedScriptValue::create(&amp;state, state.uncheckedArgument(0), 0, 0);
</del><ins>+    auto historyState = SerializedScriptValue::create(state, state.uncheckedArgument(0));
</ins><span class="cx">     RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx"> 
</span><span class="cx">     // FIXME: title should not be nullable.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMessageEventCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSMessageEventCustom.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -33,10 +33,10 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;JSBlob.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><ins>+#include &quot;JSDOMConvert.h&quot;
</ins><span class="cx"> #include &quot;JSDOMWindow.h&quot;
</span><span class="cx"> #include &quot;JSEventTarget.h&quot;
</span><span class="cx"> #include &quot;JSMessagePort.h&quot;
</span><del>-#include &quot;JSMessagePortCustom.h&quot;
</del><span class="cx"> #include &quot;MessageEvent.h&quot;
</span><span class="cx"> #include &lt;runtime/JSArray.h&gt;
</span><span class="cx"> #include &lt;runtime/JSArrayBuffer.h&gt;
</span><span class="lines">@@ -67,7 +67,7 @@
</span><span class="cx">             if (dataValue.isObject() &amp;&amp; &amp;worldForDOMObject(dataValue.getObject()) != &amp;currentWorld(&amp;state)) {
</span><span class="cx">                 RefPtr&lt;SerializedScriptValue&gt; serializedValue = event.trySerializeData(&amp;state);
</span><span class="cx">                 if (serializedValue)
</span><del>-                    result = serializedValue-&gt;deserialize(&amp;state, globalObject(), nullptr);
</del><ins>+                    result = serializedValue-&gt;deserialize(state, globalObject());
</ins><span class="cx">                 else
</span><span class="cx">                     result = jsNull();
</span><span class="cx">             } else
</span><span class="lines">@@ -78,9 +78,9 @@
</span><span class="cx"> 
</span><span class="cx">     case MessageEvent::DataTypeSerializedScriptValue:
</span><span class="cx">         if (RefPtr&lt;SerializedScriptValue&gt; serializedValue = event.dataAsSerializedScriptValue()) {
</span><del>-            MessagePortArray ports = wrapped().ports();
</del><ins>+            Vector&lt;RefPtr&lt;MessagePort&gt;&gt; ports = wrapped().ports();
</ins><span class="cx">             // FIXME: Why does this suppress exceptions?
</span><del>-            result = serializedValue-&gt;deserialize(&amp;state, globalObject(), &amp;ports, NonThrowing);
</del><ins>+            result = serializedValue-&gt;deserialize(state, globalObject(), ports, NonThrowing);
</ins><span class="cx">         } else
</span><span class="cx">             result = jsNull();
</span><span class="cx">         break;
</span><span class="lines">@@ -109,25 +109,34 @@
</span><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><span class="cx">     const String&amp; typeArg = state.argument(0).toString(&amp;state)-&gt;value(&amp;state);
</span><ins>+    RETURN_IF_EXCEPTION(scope, JSValue());
+
</ins><span class="cx">     bool canBubbleArg = state.argument(1).toBoolean(&amp;state);
</span><ins>+    RETURN_IF_EXCEPTION(scope, JSValue());
+
</ins><span class="cx">     bool cancelableArg = state.argument(2).toBoolean(&amp;state);
</span><ins>+    RETURN_IF_EXCEPTION(scope, JSValue());
+
+    JSValue dataArg = state.argument(3);
+
</ins><span class="cx">     const String originArg = valueToUSVString(&amp;state, state.argument(4));
</span><ins>+    RETURN_IF_EXCEPTION(scope, JSValue());
+
</ins><span class="cx">     const String lastEventIdArg = state.argument(5).toString(&amp;state)-&gt;value(&amp;state);
</span><ins>+    RETURN_IF_EXCEPTION(scope, JSValue());
+
</ins><span class="cx">     auto sourceArg = convert&lt;IDLNullable&lt;IDLUnion&lt;IDLInterface&lt;DOMWindow&gt;, IDLInterface&lt;MessagePort&gt;&gt;&gt;&gt;(state, state.argument(6));
</span><del>-    std::unique_ptr&lt;MessagePortArray&gt; messagePorts;
-    std::unique_ptr&lt;ArrayBufferArray&gt; arrayBuffers;
</del><ins>+    RETURN_IF_EXCEPTION(scope, JSValue());
+    
+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt; messagePorts;
</ins><span class="cx">     if (!state.argument(7).isUndefinedOrNull()) {
</span><del>-        messagePorts = std::make_unique&lt;MessagePortArray&gt;();
-        arrayBuffers = std::make_unique&lt;ArrayBufferArray&gt;();
-        fillMessagePortArray(state, state.argument(7), *messagePorts, *arrayBuffers);
</del><ins>+        messagePorts = convert&lt;IDLSequence&lt;IDLInterface&lt;MessagePort&gt;&gt;&gt;(state, state.argument(7));
</ins><span class="cx">         RETURN_IF_EXCEPTION(scope, JSValue());
</span><span class="cx">     }
</span><del>-    Deprecated::ScriptValue dataArg(vm, state.argument(3));
-    RETURN_IF_EXCEPTION(scope, JSValue());
</del><span class="cx"> 
</span><span class="cx">     MessageEvent&amp; event = jsEvent-&gt;wrapped();
</span><del>-    event.initMessageEvent(typeArg, canBubbleArg, cancelableArg, dataArg, originArg, lastEventIdArg, WTFMove(sourceArg), WTFMove(messagePorts));
-    jsEvent-&gt;m_data.set(vm, jsEvent, dataArg.jsValue());
</del><ins>+    event.initMessageEvent(state, typeArg, canBubbleArg, cancelableArg, dataArg, originArg, lastEventIdArg, WTFMove(sourceArg), WTFMove(messagePorts));
+    jsEvent-&gt;m_data.set(vm, jsEvent, dataArg);
</ins><span class="cx">     return jsUndefined();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMessagePortCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSMessagePortCustom.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -57,13 +57,11 @@
</span><span class="cx">     return handlePostMessage(state, &amp;wrapped());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void fillMessagePortArray(JSC::ExecState&amp; state, JSC::JSValue value, MessagePortArray&amp; portArray, ArrayBufferArray&amp; arrayBuffers)
</del><ins>+void extractTransferables(JSC::ExecState&amp; state, JSC::JSValue value, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; portArray, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp; arrayBuffers)
</ins><span class="cx"> {
</span><span class="cx">     VM&amp; vm = state.vm();
</span><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="cx"> 
</span><del>-    // Convert from the passed-in JS array-like object to a MessagePortArray.
-    // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 of the HTML5 spec.
</del><span class="cx">     if (value.isUndefinedOrNull()) {
</span><span class="cx">         portArray.resize(0);
</span><span class="cx">         arrayBuffers.resize(0);
</span><span class="lines">@@ -78,7 +76,7 @@
</span><span class="cx">     for (unsigned i = 0 ; i &lt; length; ++i) {
</span><span class="cx">         JSValue value = object-&gt;get(&amp;state, i);
</span><span class="cx">         RETURN_IF_EXCEPTION(scope, void());
</span><del>-        // Validation of non-null objects, per HTML5 spec 10.3.3.
</del><ins>+
</ins><span class="cx">         if (value.isUndefinedOrNull()) {
</span><span class="cx">             setDOMException(&amp;state, INVALID_STATE_ERR);
</span><span class="cx">             return;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMessagePortCustomh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSMessagePortCustom.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -42,10 +42,7 @@
</span><span class="cx"> 
</span><span class="cx">     typedef int ExceptionCode;
</span><span class="cx"> 
</span><del>-    // Helper function which pulls the values out of a JS sequence and into a MessagePortArray.
-    // Also validates the elements per sections 4.1.13 and 4.1.15 of the WebIDL spec and section 8.3.3 of the HTML5 spec.
-    // May generate an exception via the passed ExecState.
-    void fillMessagePortArray(JSC::ExecState&amp;, JSC::JSValue, MessagePortArray&amp;, ArrayBufferArray&amp;);
</del><ins>+    void extractTransferables(JSC::ExecState&amp;, JSC::JSValue, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     // Helper function to convert from JS postMessage arguments to WebCore postMessage arguments.
</span><span class="cx">     template &lt;typename T&gt;
</span><span class="lines">@@ -57,14 +54,16 @@
</span><span class="cx">         if (UNLIKELY(state.argumentCount() &lt; 1))
</span><span class="cx">             return throwException(&amp;state, scope, createNotEnoughArgumentsError(&amp;state));
</span><span class="cx"> 
</span><del>-        MessagePortArray portArray;
-        ArrayBufferArray arrayBufferArray;
-        fillMessagePortArray(state, state.argument(1), portArray, arrayBufferArray);
-        auto message = SerializedScriptValue::create(&amp;state, state.uncheckedArgument(0), &amp;portArray, &amp;arrayBufferArray);
</del><ins>+        
+        Vector&lt;RefPtr&lt;MessagePort&gt;&gt; messagePortArray;
+        Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt; arrayBufferArray;
+        extractTransferables(state, state.argument(1), messagePortArray, arrayBufferArray);
+        
+        auto message = SerializedScriptValue::create(state, state.uncheckedArgument(0), messagePortArray, WTFMove(arrayBufferArray));
</ins><span class="cx">         RETURN_IF_EXCEPTION(scope, JSC::JSValue());
</span><span class="cx"> 
</span><span class="cx">         ExceptionCode ec = 0;
</span><del>-        impl-&gt;postMessage(WTFMove(message), &amp;portArray, ec);
</del><ins>+        impl-&gt;postMessage(WTFMove(message), WTFMove(messagePortArray), ec);
</ins><span class="cx">         setDOMException(&amp;state, ec);
</span><span class="cx">         return JSC::jsUndefined();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSPopStateEventCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/JSPopStateEventCustom.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">         // Ideally, we would check that the worlds have different privileges but that's not possible yet.
</span><span class="cx">         if (eventState.isObject() &amp;&amp; &amp;worldForDOMObject(eventState.getObject()) != &amp;currentWorld(&amp;state)) {
</span><span class="cx">             if (auto serializedValue = event.trySerializeState(&amp;state))
</span><del>-                eventState = serializedValue-&gt;deserialize(&amp;state, globalObject(), nullptr);
</del><ins>+                eventState = serializedValue-&gt;deserialize(state, globalObject());
</ins><span class="cx">             else
</span><span class="cx">                 eventState = jsNull();
</span><span class="cx">         }
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">         JSHistory* jsHistory = jsCast&lt;JSHistory*&gt;(toJS(&amp;state, globalObject(), *history).asCell());
</span><span class="cx">         result = jsHistory-&gt;state(state);
</span><span class="cx">     } else
</span><del>-        result = event.serializedState()-&gt;deserialize(&amp;state, globalObject(), 0);
</del><ins>+        result = event.serializedState()-&gt;deserialize(state, globalObject());
</ins><span class="cx"> 
</span><span class="cx">     return cacheState(state, this, result);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -474,9 +474,7 @@
</span><span class="cx"> 
</span><span class="cx"> class CloneSerializer : CloneBase {
</span><span class="cx"> public:
</span><del>-    static SerializationReturnCode serialize(ExecState* exec, JSValue value,
-                                             MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers,
-                                             Vector&lt;String&gt;&amp; blobURLs, Vector&lt;uint8_t&gt;&amp; out)
</del><ins>+    static SerializationReturnCode serialize(ExecState* exec, JSValue value, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp; arrayBuffers, Vector&lt;String&gt;&amp; blobURLs, Vector&lt;uint8_t&gt;&amp; out)
</ins><span class="cx">     {
</span><span class="cx">         CloneSerializer serializer(exec, messagePorts, arrayBuffers, blobURLs, out);
</span><span class="cx">         return serializer.serialize(value);
</span><span class="lines">@@ -525,7 +523,7 @@
</span><span class="cx"> private:
</span><span class="cx">     typedef HashMap&lt;JSObject*, uint32_t&gt; ObjectPool;
</span><span class="cx"> 
</span><del>-    CloneSerializer(ExecState* exec, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, Vector&lt;String&gt;&amp; blobURLs, Vector&lt;uint8_t&gt;&amp; out)
</del><ins>+    CloneSerializer(ExecState* exec, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp; arrayBuffers, Vector&lt;String&gt;&amp; blobURLs, Vector&lt;uint8_t&gt;&amp; out)
</ins><span class="cx">         : CloneBase(exec)
</span><span class="cx">         , m_buffer(out)
</span><span class="cx">         , m_blobURLs(blobURLs)
</span><span class="lines">@@ -537,13 +535,13 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     template &lt;class T&gt;
</span><del>-    void fillTransferMap(Vector&lt;RefPtr&lt;T&gt;, 1&gt;* input, ObjectPool&amp; result)
</del><ins>+    void fillTransferMap(Vector&lt;RefPtr&lt;T&gt;&gt;&amp; input, ObjectPool&amp; result)
</ins><span class="cx">     {
</span><del>-        if (!input)
</del><ins>+        if (input.isEmpty())
</ins><span class="cx">             return;
</span><span class="cx">         JSDOMGlobalObject* globalObject = jsCast&lt;JSDOMGlobalObject*&gt;(m_exec-&gt;lexicalGlobalObject());
</span><del>-        for (size_t i = 0; i &lt; input-&gt;size(); i++) {
-            JSC::JSValue value = toJS(m_exec, globalObject, input-&gt;at(i).get());
</del><ins>+        for (size_t i = 0; i &lt; input.size(); i++) {
+            JSC::JSValue value = toJS(m_exec, globalObject, input[i].get());
</ins><span class="cx">             JSC::JSObject* obj = value.getObject();
</span><span class="cx">             if (obj &amp;&amp; !result.contains(obj))
</span><span class="cx">                 result.add(obj, i);
</span><span class="lines">@@ -877,7 +875,9 @@
</span><span class="cx">                 write(CryptoKeyTag);
</span><span class="cx">                 Vector&lt;uint8_t&gt; serializedKey;
</span><span class="cx">                 Vector&lt;String&gt; dummyBlobURLs;
</span><del>-                CloneSerializer rawKeySerializer(m_exec, nullptr, nullptr, dummyBlobURLs, serializedKey);
</del><ins>+                Vector&lt;RefPtr&lt;MessagePort&gt;&gt; dummyMessagePorts;
+                Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt; dummyArrayBuffers;
+                CloneSerializer rawKeySerializer(m_exec, dummyMessagePorts, dummyArrayBuffers, dummyBlobURLs, serializedKey);
</ins><span class="cx">                 rawKeySerializer.write(key);
</span><span class="cx">                 Vector&lt;uint8_t&gt; wrappedKey;
</span><span class="cx">                 if (!wrapCryptoKey(m_exec, serializedKey, wrappedKey))
</span><span class="lines">@@ -1487,7 +1487,7 @@
</span><span class="cx">         return str;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static DeserializationResult deserialize(ExecState* exec, JSGlobalObject* globalObject, MessagePortArray* messagePorts, ArrayBufferContentsArray* arrayBufferContentsArray, const Vector&lt;uint8_t&gt;&amp; buffer, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt; blobFilePaths)
</del><ins>+    static DeserializationResult deserialize(ExecState* exec, JSGlobalObject* globalObject, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, ArrayBufferContentsArray* arrayBufferContentsArray, const Vector&lt;uint8_t&gt;&amp; buffer, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt; blobFilePaths)
</ins><span class="cx">     {
</span><span class="cx">         if (!buffer.size())
</span><span class="cx">             return std::make_pair(jsNull(), UnspecifiedError);
</span><span class="lines">@@ -1536,7 +1536,7 @@
</span><span class="cx">         size_t m_index;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, MessagePortArray* messagePorts, ArrayBufferContentsArray* arrayBufferContents, const Vector&lt;uint8_t&gt;&amp; buffer)
</del><ins>+    CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, ArrayBufferContentsArray* arrayBufferContents, const Vector&lt;uint8_t&gt;&amp; buffer)
</ins><span class="cx">         : CloneBase(exec)
</span><span class="cx">         , m_globalObject(globalObject)
</span><span class="cx">         , m_isDOMGlobalObject(globalObject-&gt;inherits(JSDOMGlobalObject::info()))
</span><span class="lines">@@ -1551,7 +1551,7 @@
</span><span class="cx">             m_version = 0xFFFFFFFF;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, MessagePortArray* messagePorts, ArrayBufferContentsArray* arrayBufferContents, const Vector&lt;uint8_t&gt;&amp; buffer, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt; blobFilePaths)
</del><ins>+    CloneDeserializer(ExecState* exec, JSGlobalObject* globalObject, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, ArrayBufferContentsArray* arrayBufferContents, const Vector&lt;uint8_t&gt;&amp; buffer, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt; blobFilePaths)
</ins><span class="cx">         : CloneBase(exec)
</span><span class="cx">         , m_globalObject(globalObject)
</span><span class="cx">         , m_isDOMGlobalObject(globalObject-&gt;inherits(JSDOMGlobalObject::info()))
</span><span class="lines">@@ -2347,11 +2347,11 @@
</span><span class="cx">         case MessagePortReferenceTag: {
</span><span class="cx">             uint32_t index;
</span><span class="cx">             bool indexSuccessfullyRead = read(index);
</span><del>-            if (!indexSuccessfullyRead || !m_messagePorts || index &gt;= m_messagePorts-&gt;size()) {
</del><ins>+            if (!indexSuccessfullyRead || index &gt;= m_messagePorts.size()) {
</ins><span class="cx">                 fail();
</span><span class="cx">                 return JSValue();
</span><span class="cx">             }
</span><del>-            return getJSValue(m_messagePorts-&gt;at(index).get());
</del><ins>+            return getJSValue(m_messagePorts[index].get());
</ins><span class="cx">         }
</span><span class="cx">         case ArrayBufferTag: {
</span><span class="cx">             RefPtr&lt;ArrayBuffer&gt; arrayBuffer;
</span><span class="lines">@@ -2398,7 +2398,8 @@
</span><span class="cx">                 return JSValue();
</span><span class="cx">             }
</span><span class="cx">             JSValue cryptoKey;
</span><del>-            CloneDeserializer rawKeyDeserializer(m_exec, m_globalObject, nullptr, nullptr, serializedKey);
</del><ins>+            Vector&lt;RefPtr&lt;MessagePort&gt;&gt; dummyMessagePorts;
+            CloneDeserializer rawKeyDeserializer(m_exec, m_globalObject, dummyMessagePorts, nullptr, serializedKey);
</ins><span class="cx">             if (!rawKeyDeserializer.readCryptoKey(cryptoKey)) {
</span><span class="cx">                 fail();
</span><span class="cx">                 return JSValue();
</span><span class="lines">@@ -2428,9 +2429,9 @@
</span><span class="cx">     const uint8_t* m_end;
</span><span class="cx">     unsigned m_version;
</span><span class="cx">     Vector&lt;CachedString&gt; m_constantPool;
</span><del>-    MessagePortArray* m_messagePorts;
</del><ins>+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; m_messagePorts;
</ins><span class="cx">     ArrayBufferContentsArray* m_arrayBufferContents;
</span><del>-    ArrayBufferArray m_arrayBuffers;
</del><ins>+    Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt; m_arrayBuffers;
</ins><span class="cx">     Vector&lt;String&gt; m_blobURLs;
</span><span class="cx">     Vector&lt;String&gt; m_blobFilePaths;
</span><span class="cx"> 
</span><span class="lines">@@ -2654,7 +2655,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;SerializedScriptValue::ArrayBufferContentsArray&gt; SerializedScriptValue::transferArrayBuffers(
</span><del>-    ExecState* exec, ArrayBufferArray&amp; arrayBuffers, SerializationReturnCode&amp; code)
</del><ins>+    ExecState* exec, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp; arrayBuffers, SerializationReturnCode&amp; code)
</ins><span class="cx"> {
</span><span class="cx">     for (size_t i = 0; i &lt; arrayBuffers.size(); i++) {
</span><span class="cx">         if (arrayBuffers[i]-&gt;isNeutered()) {
</span><span class="lines">@@ -2682,19 +2683,24 @@
</span><span class="cx">     return contents;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;SerializedScriptValue&gt; SerializedScriptValue::create(ExecState* exec, JSValue value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, SerializationErrorMode throwExceptions)
</del><ins>+RefPtr&lt;SerializedScriptValue&gt; SerializedScriptValue::create(ExecState&amp; exec, JSValue value, SerializationErrorMode throwExceptions)
</ins><span class="cx"> {
</span><ins>+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt; messagePorts;
+    return SerializedScriptValue::create(exec, value, messagePorts, { }, throwExceptions);
+}
+
+RefPtr&lt;SerializedScriptValue&gt; SerializedScriptValue::create(ExecState&amp; exec, JSValue value, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp;&amp; arrayBuffers, SerializationErrorMode throwExceptions)
+{
</ins><span class="cx">     Vector&lt;uint8_t&gt; buffer;
</span><span class="cx">     Vector&lt;String&gt; blobURLs;
</span><del>-    SerializationReturnCode code = CloneSerializer::serialize(exec, value, messagePorts, arrayBuffers, blobURLs, buffer);
</del><ins>+    SerializationReturnCode code = CloneSerializer::serialize(&amp;exec, value, messagePorts, arrayBuffers, blobURLs, buffer);
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;ArrayBufferContentsArray&gt; arrayBufferContentsArray;
</span><ins>+    if (!arrayBuffers.isEmpty() &amp;&amp; serializationDidCompleteSuccessfully(code))
+        arrayBufferContentsArray = transferArrayBuffers(&amp;exec, arrayBuffers, code);
</ins><span class="cx"> 
</span><del>-    if (arrayBuffers &amp;&amp; serializationDidCompleteSuccessfully(code))
-        arrayBufferContentsArray = transferArrayBuffers(exec, *arrayBuffers, code);
-
</del><span class="cx">     if (throwExceptions == Throwing)
</span><del>-        maybeThrowExceptionIfSerializationFailed(exec, code);
</del><ins>+        maybeThrowExceptionIfSerializationFailed(&amp;exec, code);
</ins><span class="cx"> 
</span><span class="cx">     if (!serializationDidCompleteSuccessfully(code))
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -2718,7 +2724,7 @@
</span><span class="cx">     auto scope = DECLARE_CATCH_SCOPE(vm);
</span><span class="cx"> 
</span><span class="cx">     JSValue value = toJS(exec, apiValue);
</span><del>-    RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::create(exec, value, nullptr, nullptr);
</del><ins>+    RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::create(*exec, value);
</ins><span class="cx">     if (UNLIKELY(scope.exception())) {
</span><span class="cx">         if (exception)
</span><span class="cx">             *exception = toRef(exec, scope.exception()-&gt;value());
</span><span class="lines">@@ -2734,17 +2740,24 @@
</span><span class="cx">     return CloneDeserializer::deserializeString(m_data);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue SerializedScriptValue::deserialize(ExecState* exec, JSGlobalObject* globalObject, MessagePortArray* messagePorts, SerializationErrorMode throwExceptions)
</del><ins>+JSValue SerializedScriptValue::deserialize(ExecState&amp; exec, JSGlobalObject* globalObject, SerializationErrorMode throwExceptions)
</ins><span class="cx"> {
</span><del>-    Vector&lt;String&gt; dummyBlobs, dummyPaths;
-    return deserialize(exec, globalObject, messagePorts, throwExceptions, dummyBlobs, dummyPaths);
</del><ins>+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt; dummyMessagePorts;
+    return deserialize(exec, globalObject, dummyMessagePorts, throwExceptions);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-JSValue SerializedScriptValue::deserialize(ExecState* exec, JSGlobalObject* globalObject, MessagePortArray* messagePorts, SerializationErrorMode throwExceptions, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt;&amp; blobFilePaths)
</del><ins>+JSValue SerializedScriptValue::deserialize(ExecState&amp; exec, JSGlobalObject* globalObject, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, SerializationErrorMode throwExceptions)
</ins><span class="cx"> {
</span><del>-    DeserializationResult result = CloneDeserializer::deserialize(exec, globalObject, messagePorts, m_arrayBufferContentsArray.get(), m_data, blobURLs, blobFilePaths);
</del><ins>+    Vector&lt;String&gt; dummyBlobs;
+    Vector&lt;String&gt; dummyPaths;
+    return deserialize(exec, globalObject, messagePorts, dummyBlobs, dummyPaths, throwExceptions);
+}
+
+JSValue SerializedScriptValue::deserialize(ExecState&amp; exec, JSGlobalObject* globalObject, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; messagePorts, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt;&amp; blobFilePaths, SerializationErrorMode throwExceptions)
+{
+    DeserializationResult result = CloneDeserializer::deserialize(&amp;exec, globalObject, messagePorts, m_arrayBufferContentsArray.get(), m_data, blobURLs, blobFilePaths);
</ins><span class="cx">     if (throwExceptions == Throwing)
</span><del>-        maybeThrowExceptionIfSerializationFailed(exec, result.second);
</del><ins>+        maybeThrowExceptionIfSerializationFailed(&amp;exec, result.second);
</ins><span class="cx">     return result.first ? result.first : jsNull();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2755,7 +2768,7 @@
</span><span class="cx">     JSLockHolder locker(vm);
</span><span class="cx">     auto scope = DECLARE_CATCH_SCOPE(vm);
</span><span class="cx"> 
</span><del>-    JSValue value = deserialize(exec, exec-&gt;lexicalGlobalObject(), nullptr);
</del><ins>+    JSValue value = deserialize(*exec, exec-&gt;lexicalGlobalObject());
</ins><span class="cx">     if (UNLIKELY(scope.exception())) {
</span><span class="cx">         if (exception)
</span><span class="cx">             *exception = toRef(exec, scope.exception()-&gt;value());
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -42,8 +42,6 @@
</span><span class="cx"> 
</span><span class="cx"> class IDBValue;
</span><span class="cx"> class MessagePort;
</span><del>-typedef Vector&lt;RefPtr&lt;MessagePort&gt;, 1&gt; MessagePortArray;
-typedef Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;, 1&gt; ArrayBufferArray;
</del><span class="cx">  
</span><span class="cx"> enum SerializationReturnCode {
</span><span class="cx">     SuccessfullyCompleted,
</span><span class="lines">@@ -61,7 +59,8 @@
</span><span class="cx"> 
</span><span class="cx"> class SerializedScriptValue : public ThreadSafeRefCounted&lt;SerializedScriptValue&gt; {
</span><span class="cx"> public:
</span><del>-    WEBCORE_EXPORT static RefPtr&lt;SerializedScriptValue&gt; create(JSC::ExecState*, JSC::JSValue, MessagePortArray*, ArrayBufferArray*, SerializationErrorMode = Throwing);
</del><ins>+    WEBCORE_EXPORT static RefPtr&lt;SerializedScriptValue&gt; create(JSC::ExecState&amp;, JSC::JSValue, SerializationErrorMode = Throwing);
+    WEBCORE_EXPORT static RefPtr&lt;SerializedScriptValue&gt; create(JSC::ExecState&amp;, JSC::JSValue, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp;&amp;, SerializationErrorMode = Throwing);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static RefPtr&lt;SerializedScriptValue&gt; create(StringView);
</span><span class="cx">     static Ref&lt;SerializedScriptValue&gt; adopt(Vector&lt;uint8_t&gt;&amp;&amp; buffer)
</span><span class="lines">@@ -71,8 +70,9 @@
</span><span class="cx"> 
</span><span class="cx">     static Ref&lt;SerializedScriptValue&gt; nullValue();
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT JSC::JSValue deserialize(JSC::ExecState*, JSC::JSGlobalObject*, MessagePortArray*, SerializationErrorMode = Throwing);
-    JSC::JSValue deserialize(JSC::ExecState*, JSC::JSGlobalObject*, MessagePortArray*, SerializationErrorMode, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt;&amp; blobFilePaths);
</del><ins>+    WEBCORE_EXPORT JSC::JSValue deserialize(JSC::ExecState&amp;, JSC::JSGlobalObject*, SerializationErrorMode = Throwing);
+    WEBCORE_EXPORT JSC::JSValue deserialize(JSC::ExecState&amp;, JSC::JSGlobalObject*, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;, SerializationErrorMode = Throwing);
+    JSC::JSValue deserialize(JSC::ExecState&amp;, JSC::JSGlobalObject*, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;, const Vector&lt;String&gt;&amp; blobURLs, const Vector&lt;String&gt;&amp; blobFilePaths, SerializationErrorMode = Throwing);
</ins><span class="cx"> 
</span><span class="cx">     static uint32_t wireFormatVersion();
</span><span class="cx"> 
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx">     typedef Vector&lt;JSC::ArrayBufferContents&gt; ArrayBufferContentsArray;
</span><span class="cx">     static void maybeThrowExceptionIfSerializationFailed(JSC::ExecState*, SerializationReturnCode);
</span><span class="cx">     static bool serializationDidCompleteSuccessfully(SerializationReturnCode);
</span><del>-    static std::unique_ptr&lt;ArrayBufferContentsArray&gt; transferArrayBuffers(JSC::ExecState*, ArrayBufferArray&amp;, SerializationReturnCode&amp;);
</del><ins>+    static std::unique_ptr&lt;ArrayBufferContentsArray&gt; transferArrayBuffers(JSC::ExecState*, Vector&lt;RefPtr&lt;JSC::ArrayBuffer&gt;&gt;&amp;, SerializationReturnCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;&amp;);
</span><span class="cx">     SerializedScriptValue(Vector&lt;unsigned char&gt;&amp;&amp;, const Vector&lt;String&gt;&amp; blobURLs, std::unique_ptr&lt;ArrayBufferContentsArray&gt;&amp;&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -4905,7 +4905,6 @@
</span><span class="cx">     die &quot;This should only be called for sequence or array types&quot; unless $codeGenerator-&gt;IsSequenceOrFrozenArrayType($type);
</span><span class="cx"> 
</span><span class="cx">     my $innerType = $codeGenerator-&gt;GetSequenceOrFrozenArrayInnerType($type);
</span><del>-    return &quot;MessagePortArray&quot; if $innerType eq &quot;MessagePort&quot;;
</del><span class="cx">     return &quot;Vector&lt;&quot; . GetNativeVectorInnerType($innerType) . &quot;&gt;&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -5168,7 +5167,7 @@
</span><span class="cx"> 
</span><span class="cx">     if ($type eq &quot;SerializedScriptValue&quot;) {
</span><span class="cx">         AddToImplIncludes(&quot;SerializedScriptValue.h&quot;, $conditional);
</span><del>-        return (&quot;SerializedScriptValue::create($statePointer, $value, 0, 0)&quot;, 1);
</del><ins>+        return (&quot;SerializedScriptValue::create($stateReference, $value)&quot;, 1);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if ($type eq &quot;Dictionary&quot;) {
</span><span class="lines">@@ -5274,7 +5273,7 @@
</span><span class="cx"> 
</span><span class="cx">     if ($type eq &quot;SerializedScriptValue&quot;) {
</span><span class="cx">         AddToImplIncludes(&quot;SerializedScriptValue.h&quot;, $conditional);
</span><del>-        return &quot;$value ? $value-&gt;deserialize($statePointer, $globalObject, 0) : jsNull()&quot;;
</del><ins>+        return &quot;$value ? $value-&gt;deserialize($stateReference, $globalObject) : jsNull()&quot;;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     AddToImplIncludes(&quot;StyleProperties.h&quot;, $conditional) if $type eq &quot;CSSStyleDeclaration&quot;;
</span></span></pre></div>
<a id="trunkSourceWebCoredomCustomEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/CustomEvent.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomEvent.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/CustomEvent.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> RefPtr&lt;SerializedScriptValue&gt; CustomEvent::trySerializeDetail(JSC::ExecState&amp; state)
</span><span class="cx"> {
</span><span class="cx">     if (!m_triedToSerialize) {
</span><del>-        m_serializedDetail = SerializedScriptValue::create(&amp;state, m_detail, nullptr, nullptr, NonThrowing);
</del><ins>+        m_serializedDetail = SerializedScriptValue::create(state, m_detail, NonThrowing);
</ins><span class="cx">         m_triedToSerialize = true;
</span><span class="cx">     }
</span><span class="cx">     return m_serializedDetail;
</span></span></pre></div>
<a id="trunkSourceWebCoredomErrorEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/ErrorEvent.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/ErrorEvent.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/ErrorEvent.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx">         auto serializedError = trySerializeError(exec);
</span><span class="cx">         if (!serializedError)
</span><span class="cx">             return jsNull();
</span><del>-        return serializedError-&gt;deserialize(&amp;exec, &amp;globalObject, nullptr);
</del><ins>+        return serializedError-&gt;deserialize(exec, &amp;globalObject);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return error;
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> RefPtr&lt;SerializedScriptValue&gt; ErrorEvent::trySerializeError(ExecState&amp; exec)
</span><span class="cx"> {
</span><span class="cx">     if (!m_triedToSerialize) {
</span><del>-        m_serializedDetail = SerializedScriptValue::create(&amp;exec, m_error, nullptr, nullptr, NonThrowing);
</del><ins>+        m_serializedDetail = SerializedScriptValue::create(exec, m_error, NonThrowing);
</ins><span class="cx">         m_triedToSerialize = true;
</span><span class="cx">     }
</span><span class="cx">     return m_serializedDetail;
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessageEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessageEvent.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessageEvent.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/MessageEvent.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -48,11 +48,11 @@
</span><span class="cx">     , m_origin(initializer.origin)
</span><span class="cx">     , m_lastEventId(initializer.lastEventId)
</span><span class="cx">     , m_source(WTFMove(initializer.source))
</span><del>-    , m_ports(std::make_unique&lt;MessagePortArray&gt;(initializer.ports))
</del><ins>+    , m_ports(WTFMove(initializer.ports))
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline MessageEvent::MessageEvent(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, std::unique_ptr&lt;MessagePortArray&gt; ports)
</del><ins>+inline MessageEvent::MessageEvent(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports)
</ins><span class="cx">     : Event(eventNames().messageEvent, false, false)
</span><span class="cx">     , m_dataType(DataTypeSerializedScriptValue)
</span><span class="cx">     , m_dataAsSerializedScriptValue(WTFMove(data))
</span><span class="lines">@@ -96,7 +96,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Ref&lt;MessageEvent&gt; MessageEvent::create(std::unique_ptr&lt;MessagePortArray&gt; ports, RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source)
</del><ins>+Ref&lt;MessageEvent&gt; MessageEvent::create(Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports, RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source)
</ins><span class="cx"> {
</span><span class="cx">     return adoptRef(*new MessageEvent(WTFMove(data), origin, lastEventId, WTFMove(source), WTFMove(ports)));
</span><span class="cx"> }
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MessageEvent::initMessageEvent(const AtomicString&amp; type, bool canBubble, bool cancelable, const Deprecated::ScriptValue&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, std::unique_ptr&lt;MessagePortArray&gt; ports)
</del><ins>+void MessageEvent::initMessageEvent(ExecState&amp; state, const AtomicString&amp; type, bool canBubble, bool cancelable, JSValue data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports)
</ins><span class="cx"> {
</span><span class="cx">     if (dispatched())
</span><span class="cx">         return;
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx">     initEvent(type, canBubble, cancelable);
</span><span class="cx"> 
</span><span class="cx">     m_dataType = DataTypeScriptValue;
</span><del>-    m_dataAsScriptValue = data;
</del><ins>+    m_dataAsScriptValue = Deprecated::ScriptValue(state.vm(), data);
</ins><span class="cx">     m_dataAsSerializedScriptValue = nullptr;
</span><span class="cx">     m_triedToSerialize = false;
</span><span class="cx">     m_origin = origin;
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx">     m_ports = WTFMove(ports);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MessageEvent::initMessageEvent(const AtomicString&amp; type, bool canBubble, bool cancelable, PassRefPtr&lt;SerializedScriptValue&gt; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, std::unique_ptr&lt;MessagePortArray&gt; ports)
</del><ins>+void MessageEvent::initMessageEvent(const AtomicString&amp; type, bool canBubble, bool cancelable, PassRefPtr&lt;SerializedScriptValue&gt; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports)
</ins><span class="cx"> {
</span><span class="cx">     if (dispatched())
</span><span class="cx">         return;
</span><span class="lines">@@ -185,7 +185,7 @@
</span><span class="cx">     ASSERT(!m_dataAsScriptValue.hasNoValue());
</span><span class="cx">     
</span><span class="cx">     if (!m_dataAsSerializedScriptValue &amp;&amp; !m_triedToSerialize) {
</span><del>-        m_dataAsSerializedScriptValue = SerializedScriptValue::create(exec, m_dataAsScriptValue.jsValue(), nullptr, nullptr, NonThrowing);
</del><ins>+        m_dataAsSerializedScriptValue = SerializedScriptValue::create(*exec, m_dataAsScriptValue.jsValue(), NonThrowing);
</ins><span class="cx">         m_triedToSerialize = true;
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessageEventh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessageEvent.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessageEvent.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/MessageEvent.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> 
</span><span class="cx"> class MessageEvent final : public Event {
</span><span class="cx"> public:
</span><del>-    static Ref&lt;MessageEvent&gt; create(std::unique_ptr&lt;MessagePortArray&gt;, RefPtr&lt;SerializedScriptValue&gt;&amp;&amp;, const String&amp; origin = { }, const String&amp; lastEventId = { }, Optional&lt;MessageEventSource&gt;&amp;&amp; source = Nullopt);
</del><ins>+    static Ref&lt;MessageEvent&gt; create(Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;, RefPtr&lt;SerializedScriptValue&gt;&amp;&amp;, const String&amp; origin = { }, const String&amp; lastEventId = { }, Optional&lt;MessageEventSource&gt;&amp;&amp; source = Nullopt);
</ins><span class="cx">     static Ref&lt;MessageEvent&gt; create(const AtomicString&amp; type, RefPtr&lt;SerializedScriptValue&gt;&amp;&amp;, const String&amp; origin, const String&amp; lastEventId);
</span><span class="cx">     static Ref&lt;MessageEvent&gt; create(const String&amp; data, const String&amp; origin = { });
</span><span class="cx">     static Ref&lt;MessageEvent&gt; create(Ref&lt;Blob&gt;&amp;&amp; data, const String&amp; origin);
</span><span class="lines">@@ -54,19 +54,19 @@
</span><span class="cx">         String origin;
</span><span class="cx">         String lastEventId;
</span><span class="cx">         Optional&lt;MessageEventSource&gt; source;
</span><del>-        MessagePortArray ports;
</del><ins>+        Vector&lt;RefPtr&lt;MessagePort&gt;&gt; ports;
</ins><span class="cx">     };
</span><span class="cx">     static Ref&lt;MessageEvent&gt; create(JSC::ExecState&amp;, const AtomicString&amp; type, Init&amp;, IsTrusted = IsTrusted::No);
</span><span class="cx"> 
</span><span class="cx">     virtual ~MessageEvent();
</span><span class="cx"> 
</span><del>-    void initMessageEvent(const AtomicString&amp; type, bool canBubble, bool cancelable, const Deprecated::ScriptValue&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, std::unique_ptr&lt;MessagePortArray&gt;);
-    void initMessageEvent(const AtomicString&amp; type, bool canBubble, bool cancelable, PassRefPtr&lt;SerializedScriptValue&gt; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, std::unique_ptr&lt;MessagePortArray&gt;);
</del><ins>+    void initMessageEvent(JSC::ExecState&amp;, const AtomicString&amp; type, bool canBubble, bool cancelable, JSC::JSValue data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp;, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;);
+    void initMessageEvent(const AtomicString&amp; type, bool canBubble, bool cancelable, PassRefPtr&lt;SerializedScriptValue&gt; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp;, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     const String&amp; origin() const { return m_origin; }
</span><span class="cx">     const String&amp; lastEventId() const { return m_lastEventId; }
</span><span class="cx">     EventTarget* source() const;
</span><del>-    MessagePortArray ports() const { return m_ports ? *m_ports : MessagePortArray(); }
</del><ins>+    const Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp; ports() const { return m_ports; }
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: Remove this when we have custom ObjC binding support.
</span><span class="cx">     SerializedScriptValue* data() const;
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> private:
</span><span class="cx">     MessageEvent();
</span><span class="cx">     MessageEvent(JSC::ExecState&amp;, const AtomicString&amp;, Init&amp;, IsTrusted);
</span><del>-    MessageEvent(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp; source, std::unique_ptr&lt;MessagePortArray&gt;);
</del><ins>+    MessageEvent(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; data, const String&amp; origin, const String&amp; lastEventId, Optional&lt;MessageEventSource&gt;&amp;&amp;, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;);
</ins><span class="cx">     MessageEvent(const AtomicString&amp; type, RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; data, const String&amp; origin, const String&amp; lastEventId);
</span><span class="cx">     MessageEvent(const String&amp; data, const String&amp; origin);
</span><span class="cx">     MessageEvent(Ref&lt;Blob&gt;&amp;&amp; data, const String&amp; origin);
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx">     String m_origin;
</span><span class="cx">     String m_lastEventId;
</span><span class="cx">     Optional&lt;MessageEventSource&gt; m_source;
</span><del>-    std::unique_ptr&lt;MessagePortArray&gt; m_ports;
</del><ins>+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt; m_ports;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessageEventidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessageEvent.idl (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessageEvent.idl        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/MessageEvent.idl        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -39,11 +39,10 @@
</span><span class="cx"> 
</span><span class="cx">     [Custom] void initMessageEvent(optional DOMString typeArg, optional boolean canBubbleArg, optional boolean cancelableArg,
</span><span class="cx">         optional any dataArg, optional USVString originArg, optional DOMString lastEventIdArg, optional (DOMWindow or MessagePort)? sourceArg,
</span><del>-        optional Array messagePorts);
-
</del><ins>+        optional sequence&lt;MessagePort&gt; messagePorts);
</ins><span class="cx">     [Custom] void webkitInitMessageEvent(optional DOMString typeArg, optional boolean canBubbleArg, optional boolean cancelableArg,
</span><span class="cx">         optional any dataArg, optional USVString originArg, optional DOMString lastEventIdArg, optional (DOMWindow or MessagePort)? sourceArg,
</span><del>-        optional Array transferables);
</del><ins>+        optional sequence&lt;MessagePort&gt; messagePorts);
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> dictionary MessageEventInit : EventInit {
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessagePortcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessagePort.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessagePort.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/MessagePort.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">         m_scriptExecutionContext-&gt;destroyedMessagePort(*this);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void MessagePort::postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, const MessagePortArray* ports, ExceptionCode&amp; ec)
</del><ins>+void MessagePort::postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     if (!isEntangled())
</span><span class="cx">         return;
</span><span class="lines">@@ -61,14 +61,14 @@
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;MessagePortChannelArray&gt; channels;
</span><span class="cx">     // Make sure we aren't connected to any of the passed-in ports.
</span><del>-    if (ports) {
-        for (auto&amp; dataPort : *ports) {
</del><ins>+    if (!ports.isEmpty()) {
+        for (auto&amp; dataPort : ports) {
</ins><span class="cx">             if (dataPort == this || m_entangledChannel-&gt;isConnectedTo(dataPort.get())) {
</span><span class="cx">                 ec = DATA_CLONE_ERR;
</span><span class="cx">                 return;
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        channels = MessagePort::disentanglePorts(ports, ec);
</del><ins>+        channels = MessagePort::disentanglePorts(WTFMove(ports), ec);
</ins><span class="cx">         if (ec)
</span><span class="cx">             return;
</span><span class="cx">     }
</span><span class="lines">@@ -152,7 +152,7 @@
</span><span class="cx">         if (is&lt;WorkerGlobalScope&gt;(*m_scriptExecutionContext) &amp;&amp; downcast&lt;WorkerGlobalScope&gt;(*m_scriptExecutionContext).isClosing())
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        std::unique_ptr&lt;MessagePortArray&gt; ports = MessagePort::entanglePorts(*m_scriptExecutionContext, WTFMove(channels));
</del><ins>+        Vector&lt;RefPtr&lt;MessagePort&gt;&gt; ports = MessagePort::entanglePorts(*m_scriptExecutionContext, WTFMove(channels));
</ins><span class="cx">         Ref&lt;Event&gt; event = MessageEvent::create(WTFMove(ports), WTFMove(message));
</span><span class="cx">         dispatchEvent(event);
</span><span class="cx">     }
</span><span class="lines">@@ -174,9 +174,9 @@
</span><span class="cx">     return m_entangledChannel ? m_entangledChannel-&gt;locallyEntangledPort(m_scriptExecutionContext) : nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;MessagePortChannelArray&gt; MessagePort::disentanglePorts(const MessagePortArray* ports, ExceptionCode&amp; ec)
</del><ins>+std::unique_ptr&lt;MessagePortChannelArray&gt; MessagePort::disentanglePorts(Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><del>-    if (!ports || !ports-&gt;size())
</del><ins>+    if (ports.isEmpty())
</ins><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     // HashSet used to efficiently check for duplicates in the passed-in array.
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx">     HashSet&lt;MessagePort*&gt; portSet;
</span><span class="cx"> 
</span><span class="cx">     // Walk the incoming array - if there are any duplicate ports, or null ports or cloned ports, throw an error (per section 8.3.3 of the HTML5 spec).
</span><del>-    for (auto&amp; port : *ports) {
</del><ins>+    for (auto&amp; port : ports) {
</ins><span class="cx">         if (!port || port-&gt;isNeutered() || portSet.contains(port.get())) {
</span><span class="cx">             ec = DATA_CLONE_ERR;
</span><span class="cx">             return nullptr;
</span><span class="lines">@@ -192,24 +192,25 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Passed-in ports passed validity checks, so we can disentangle them.
</span><del>-    auto portArray = std::make_unique&lt;MessagePortChannelArray&gt;(ports-&gt;size());
-    for (unsigned int i = 0 ; i &lt; ports-&gt;size() ; ++i) {
-        std::unique_ptr&lt;MessagePortChannel&gt; channel = (*ports)[i]-&gt;disentangle();
</del><ins>+    auto portArray = std::make_unique&lt;MessagePortChannelArray&gt;(ports.size());
+    for (unsigned int i = 0 ; i &lt; ports.size() ; ++i) {
+        std::unique_ptr&lt;MessagePortChannel&gt; channel = ports[i]-&gt;disentangle();
</ins><span class="cx">         (*portArray)[i] = WTFMove(channel);
</span><span class="cx">     }
</span><span class="cx">     return portArray;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;MessagePortArray&gt; MessagePort::entanglePorts(ScriptExecutionContext&amp; context, std::unique_ptr&lt;MessagePortChannelArray&gt; channels)
</del><ins>+Vector&lt;RefPtr&lt;MessagePort&gt;&gt; MessagePort::entanglePorts(ScriptExecutionContext&amp; context, std::unique_ptr&lt;MessagePortChannelArray&gt; channels)
</ins><span class="cx"> {
</span><span class="cx">     if (!channels || !channels-&gt;size())
</span><del>-        return nullptr;
</del><ins>+        return { };
</ins><span class="cx"> 
</span><del>-    auto portArray = std::make_unique&lt;MessagePortArray&gt;(channels-&gt;size());
</del><ins>+    Vector&lt;RefPtr&lt;MessagePort&gt;&gt; portArray;
+    portArray.reserveInitialCapacity(channels-&gt;size());
</ins><span class="cx">     for (unsigned int i = 0; i &lt; channels-&gt;size(); ++i) {
</span><span class="cx">         auto port = MessagePort::create(context);
</span><span class="cx">         port-&gt;entangle(WTFMove((*channels)[i]));
</span><del>-        (*portArray)[i] = WTFMove(port);
</del><ins>+        portArray.uncheckedAppend(WTFMove(port));
</ins><span class="cx">     }
</span><span class="cx">     return portArray;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomMessagePorth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/MessagePort.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/MessagePort.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/MessagePort.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -42,15 +42,12 @@
</span><span class="cx">     class MessagePort;
</span><span class="cx">     class ScriptExecutionContext;
</span><span class="cx"> 
</span><del>-    // The overwhelmingly common case is sending a single port, so handle that efficiently with an inline buffer of size 1.
-    typedef Vector&lt;RefPtr&lt;MessagePort&gt;, 1&gt; MessagePortArray;
-
</del><span class="cx">     class MessagePort final : public RefCounted&lt;MessagePort&gt;, public EventTargetWithInlineData {
</span><span class="cx">     public:
</span><span class="cx">         static Ref&lt;MessagePort&gt; create(ScriptExecutionContext&amp; scriptExecutionContext) { return adoptRef(*new MessagePort(scriptExecutionContext)); }
</span><span class="cx">         virtual ~MessagePort();
</span><span class="cx"> 
</span><del>-        void postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, const MessagePortArray*, ExceptionCode&amp;);
</del><ins>+        void postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">         void start();
</span><span class="cx">         void close();
</span><span class="lines">@@ -59,10 +56,9 @@
</span><span class="cx">         std::unique_ptr&lt;MessagePortChannel&gt; disentangle();
</span><span class="cx"> 
</span><span class="cx">         // Returns 0 if there is an exception, or if the passed-in array is 0/empty.
</span><del>-        static std::unique_ptr&lt;MessagePortChannelArray&gt; disentanglePorts(const MessagePortArray*, ExceptionCode&amp;);
</del><ins>+        static std::unique_ptr&lt;MessagePortChannelArray&gt; disentanglePorts(Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><del>-        // Returns 0 if the passed array is 0/empty.
-        static std::unique_ptr&lt;MessagePortArray&gt; entanglePorts(ScriptExecutionContext&amp;, std::unique_ptr&lt;MessagePortChannelArray&gt;);
</del><ins>+        static Vector&lt;RefPtr&lt;MessagePort&gt;&gt; entanglePorts(ScriptExecutionContext&amp;, std::unique_ptr&lt;MessagePortChannelArray&gt;);
</ins><span class="cx"> 
</span><span class="cx">         void messageAvailable();
</span><span class="cx">         bool started() const { return m_started; }
</span></span></pre></div>
<a id="trunkSourceWebCoredomPopStateEventcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/PopStateEvent.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/PopStateEvent.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/dom/PopStateEvent.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     ASSERT(!m_state.hasNoValue());
</span><span class="cx">     
</span><span class="cx">     if (!m_serializedState &amp;&amp; !m_triedToSerialize) {
</span><del>-        m_serializedState = SerializedScriptValue::create(exec, m_state.jsValue(), nullptr, nullptr, NonThrowing);
</del><ins>+        m_serializedState = SerializedScriptValue::create(*exec, m_state.jsValue(), NonThrowing);
</ins><span class="cx">         m_triedToSerialize = true;
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/page/DOMWindow.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -906,7 +906,7 @@
</span><span class="cx">     return m_localStorage.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DOMWindow::postMessage(PassRefPtr&lt;SerializedScriptValue&gt; message, const MessagePortArray* ports, const String&amp; targetOrigin, DOMWindow&amp; source, ExceptionCode&amp; ec)
</del><ins>+void DOMWindow::postMessage(PassRefPtr&lt;SerializedScriptValue&gt; message, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports, const String&amp; targetOrigin, DOMWindow&amp; source, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     if (!isCurrentlyDisplayedInFrame())
</span><span class="cx">         return;
</span><span class="lines">@@ -930,7 +930,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    auto channels = MessagePort::disentanglePorts(ports, ec);
</del><ins>+    auto channels = MessagePort::disentanglePorts(WTFMove(ports), ec);
</ins><span class="cx">     if (ec)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageDOMWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DOMWindow.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DOMWindow.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/page/DOMWindow.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -88,8 +88,6 @@
</span><span class="cx"> 
</span><span class="cx">     struct WindowFeatures;
</span><span class="cx"> 
</span><del>-    typedef Vector&lt;RefPtr&lt;MessagePort&gt;, 1&gt; MessagePortArray;
-
</del><span class="cx">     typedef int ExceptionCode;
</span><span class="cx"> 
</span><span class="cx">     enum SetLocationLocking { LockHistoryBasedOnGestureState, LockHistoryAndBackForwardList };
</span><span class="lines">@@ -241,7 +239,7 @@
</span><span class="cx">         void printErrorMessage(const String&amp;);
</span><span class="cx">         String crossDomainAccessErrorMessage(const DOMWindow&amp; activeWindow);
</span><span class="cx"> 
</span><del>-        void postMessage(PassRefPtr&lt;SerializedScriptValue&gt; message, const MessagePortArray*, const String&amp; targetOrigin, DOMWindow&amp; source, ExceptionCode&amp;);
</del><ins>+        void postMessage(PassRefPtr&lt;SerializedScriptValue&gt; message, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;, const String&amp; targetOrigin, DOMWindow&amp; source, ExceptionCode&amp;);
</ins><span class="cx">         void postMessageTimerFired(PostMessageTimer&amp;);
</span><span class="cx">         void dispatchMessageEventWithOriginCheck(SecurityOrigin* intendedTargetOrigin, Event&amp;, PassRefPtr&lt;Inspector::ScriptCallStack&gt;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersDedicatedWorkerGlobalScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -63,10 +63,10 @@
</span><span class="cx">     return DedicatedWorkerGlobalScopeEventTargetInterfaceType;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DedicatedWorkerGlobalScope::postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, const MessagePortArray* ports, ExceptionCode&amp; ec)
</del><ins>+void DedicatedWorkerGlobalScope::postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     // Disentangle the port in preparation for sending it to the remote context.
</span><del>-    auto channels = MessagePort::disentanglePorts(ports, ec);
</del><ins>+    auto channels = MessagePort::disentanglePorts(WTFMove(ports), ec);
</ins><span class="cx">     if (ec)
</span><span class="cx">         return;
</span><span class="cx">     thread().workerObjectProxy().postMessageToWorkerObject(WTFMove(message), WTFMove(channels));
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersDedicatedWorkerGlobalScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/workers/DedicatedWorkerGlobalScope.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">         // EventTarget
</span><span class="cx">         EventTargetInterface eventTargetInterface() const override;
</span><span class="cx"> 
</span><del>-        void postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp;, const MessagePortArray*, ExceptionCode&amp;);
</del><ins>+        void postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp;, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">         DedicatedWorkerThread&amp; thread();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/Worker.cpp (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/Worker.cpp        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/workers/Worker.cpp        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -107,10 +107,10 @@
</span><span class="cx">     m_contextProxy-&gt;workerObjectDestroyed();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Worker::postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, const MessagePortArray* ports, ExceptionCode&amp; ec)
</del><ins>+void Worker::postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp; ports, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     // Disentangle the port in preparation for sending it to the remote context.
</span><del>-    auto channels = MessagePort::disentanglePorts(ports, ec);
</del><ins>+    auto channels = MessagePort::disentanglePorts(WTFMove(ports), ec);
</ins><span class="cx">     if (ec)
</span><span class="cx">         return;
</span><span class="cx">     m_contextProxy-&gt;postMessageToWorkerGlobalScope(WTFMove(message), WTFMove(channels));
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/Worker.h (207504 => 207505)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/Worker.h        2016-10-18 23:55:04 UTC (rev 207504)
+++ trunk/Source/WebCore/workers/Worker.h        2016-10-19 00:05:09 UTC (rev 207505)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx"> 
</span><span class="cx">         EventTargetInterface eventTargetInterface() const override { return WorkerEventTargetInterfaceType; }
</span><span class="cx"> 
</span><del>-        void postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, const MessagePortArray*, ExceptionCode&amp;);
</del><ins>+        void postMessage(RefPtr&lt;SerializedScriptValue&gt;&amp;&amp; message, Vector&lt;RefPtr&lt;MessagePort&gt;&gt;&amp;&amp;, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">         void terminate();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>