<!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>[194625] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/194625">194625</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2016-01-05 18:08:23 -0800 (Tue, 05 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: storage/indexeddb/structured-clone.html crashes.
https://bugs.webkit.org/show_bug.cgi?id=152763

Reviewed by Alex Christensen.

Source/WebCore:

No new tests (At least one failing test now passes).

A lot of SerializedScriptValue code incorrectly assumed the global object is a JSDOMGlobalObject,
which doesn't have to be true for native Javascript types like typed arrays.

Fixing that fixes the test.

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::putOrAdd): If serializing the script value caused an exception,
  clear that exception and return a better IDB specific exception.

* bindings/js/JSDOMBinding.h:
(WebCore::toJS): Add a ArrayBufferView specialization for toJS that skips the need for a JSDOMGlobalObject.

* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readArrayBufferView): Call toJS directly instead of getJSValue, which
  incorrectly assumes the existence of a JSDOMGlobalObject (vs a JSGlobalObject)
(WebCore::CloneDeserializer::readTerminal): Instead of getJSValue, call JSArrayBuffer::create directly.

LayoutTests:

* platform/mac-wk1/TestExpectations:
* storage/indexeddb/clone-exception-expected.txt:
* storage/indexeddb/exceptions-expected.txt:
* storage/indexeddb/objectstore-basics-expected.txt:
* storage/indexeddb/structured-clone-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbcloneexceptionexpectedtxt">trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbexceptionsexpectedtxt">trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbobjectstorebasicsexpectedtxt">trunk/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbstructuredcloneexpectedtxt">trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValuecpp">trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/LayoutTests/ChangeLog        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-01-05  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: storage/indexeddb/structured-clone.html crashes.
+        https://bugs.webkit.org/show_bug.cgi?id=152763
+
+        Reviewed by Alex Christensen.
+
+        * platform/mac-wk1/TestExpectations:
+        * storage/indexeddb/clone-exception-expected.txt:
+        * storage/indexeddb/exceptions-expected.txt:
+        * storage/indexeddb/objectstore-basics-expected.txt:
+        * storage/indexeddb/structured-clone-expected.txt:
+
</ins><span class="cx"> 2016-01-05  Pranjal Jumde  &lt;pjumde@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Image should not be re-registered if m_form already exists. This leads to an assertion failure.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/TestExpectations        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -72,9 +72,6 @@
</span><span class="cx"> storage/indexeddb/key-generator.html [ Skip ]
</span><span class="cx"> storage/indexeddb/lazy-index-population.html [ Skip ]
</span><span class="cx"> 
</span><del>-# IDB tests that crash/assert in CloneDeserializer
-storage/indexeddb/structured-clone.html [ Skip ]
-
</del><span class="cx"> # IDB tests that crash with GuardMalloc or ASan
</span><span class="cx"> storage/indexeddb/index-multientry.html [ Skip ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbcloneexceptionexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txt (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txt        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/LayoutTests/storage/indexeddb/clone-exception-expected.txt        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -13,7 +13,7 @@
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is 25
</span><span class="cx"> PASS ename is 'DataCloneError'
</span><del>-Exception message: DataCloneError: DOM Exception 25
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> 
</span><span class="cx"> doSecondOpen():
</span><span class="cx"> indexedDB.open(dbname + '2')
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is 25
</span><span class="cx"> PASS ename is 'DataCloneError'
</span><del>-Exception message: DataCloneError: DOM Exception 25
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> 
</span><span class="cx"> doThirdOpen():
</span><span class="cx"> indexedDB.open(dbname + '3')
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is 25
</span><span class="cx"> PASS ename is 'DataCloneError'
</span><del>-Exception message: DataCloneError: DOM Exception 25
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbexceptionsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/LayoutTests/storage/indexeddb/exceptions-expected.txt        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx"> Expecting exception from store.add(self, 0)
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: DataCloneError: DOM Exception 25
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> 
</span><span class="cx"> IDBObjectStore.clear()
</span><span class="cx"> This method throws a DOMException of type ReadOnlyError if the transaction which this IDBObjectStore belongs to is has its mode set to &quot;readonly&quot;.
</span><span class="lines">@@ -273,7 +273,7 @@
</span><span class="cx"> Expecting exception from store.put(self, 0)
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: DataCloneError: DOM Exception 25
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> db.close()
</span><span class="cx"> ro_transaction.oncomplete = transactionComplete
</span><span class="cx"> rw_transaction.oncomplete = transactionComplete
</span><span class="lines">@@ -505,7 +505,7 @@
</span><span class="cx"> Expecting exception from cursor.update(self)
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: DataCloneError: DOM Exception 25
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> The transaction this IDBCursor belongs to is not active.
</span><span class="cx"> Expecting exception from cursorFromInactiveTransaction.update({})
</span><span class="cx"> PASS Exception was thrown.
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbobjectstorebasicsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/LayoutTests/storage/indexeddb/objectstore-basics-expected.txt        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx"> Expecting exception from store.add({x: 'bar', y: self}, 'bar')
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: DataCloneError: DOM Exception 25
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> Try to insert data where key path yields a Date key:
</span><span class="cx"> store.add({x: testDateB, y: 'value'}, 'key')
</span><span class="cx"> addSuccess():
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbstructuredcloneexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/LayoutTests/storage/indexeddb/structured-clone-expected.txt        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -783,25 +783,25 @@
</span><span class="cx"> Expecting exception from store.put(new Error, 'key')
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> Expecting exception from store.put(new Function, 'key')
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> 
</span><span class="cx"> Other host object types:
</span><span class="cx"> Expecting exception from store.put(self, 'key')
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> Expecting exception from store.put(document, 'key')
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> Expecting exception from store.put(document.body, 'key')
</span><span class="cx"> PASS Exception was thrown.
</span><span class="cx"> PASS code is DOMException.DATA_CLONE_ERR
</span><del>-Exception message: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned.
</del><ins>+Exception message: Failed to store record in an IDBObjectStore: An object could not be cloned.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/Source/WebCore/ChangeLog        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-01-05  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: storage/indexeddb/structured-clone.html crashes.
+        https://bugs.webkit.org/show_bug.cgi?id=152763
+
+        Reviewed by Alex Christensen.
+
+        No new tests (At least one failing test now passes).
+        
+        A lot of SerializedScriptValue code incorrectly assumed the global object is a JSDOMGlobalObject,
+        which doesn't have to be true for native Javascript types like typed arrays.
+        
+        Fixing that fixes the test.
+
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::putOrAdd): If serializing the script value caused an exception,
+          clear that exception and return a better IDB specific exception.
+
+        * bindings/js/JSDOMBinding.h:
+        (WebCore::toJS): Add a ArrayBufferView specialization for toJS that skips the need for a JSDOMGlobalObject.
+        
+        * bindings/js/SerializedScriptValue.cpp:
+        (WebCore::CloneDeserializer::readArrayBufferView): Call toJS directly instead of getJSValue, which 
+          incorrectly assumes the existence of a JSDOMGlobalObject (vs a JSGlobalObject)
+        (WebCore::CloneDeserializer::readTerminal): Instead of getJSValue, call JSArrayBuffer::create directly.
+
</ins><span class="cx"> 2016-01-05  Pranjal Jumde  &lt;pjumde@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Image should not be re-registered if m_form already exists. This leads to an assertion failure.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -265,6 +265,9 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::create(&amp;state, value, nullptr, nullptr);
</span><span class="cx">     if (state.hadException()) {
</span><ins>+        // Clear the DOM exception from the serializer so we can give a more targeted exception.
+        state.clearException();
+
</ins><span class="cx">         ec.code = IDBDatabaseException::DataCloneError;
</span><span class="cx">         ec.message = ASCIILiteral(&quot;Failed to store record in an IDBObjectStore: An object could not be cloned.&quot;);
</span><span class="cx">         return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -411,6 +411,13 @@
</span><span class="cx">     return view-&gt;wrap(exec, globalObject);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline JSC::JSValue toJS(JSC::ExecState* exec, JSC::JSGlobalObject* globalObject, JSC::ArrayBufferView* view)
+{
+    if (!view)
+        return JSC::jsNull();
+    return view-&gt;wrap(exec, globalObject);
+}
+
</ins><span class="cx"> template&lt;typename T&gt; inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, RefPtr&lt;T&gt; ptr)
</span><span class="cx"> {
</span><span class="cx">     return toJS(exec, globalObject, ptr.get());
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (194624 => 194625)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-01-06 01:56:29 UTC (rev 194624)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2016-01-06 02:08:23 UTC (rev 194625)
</span><span class="lines">@@ -1815,31 +1815,31 @@
</span><span class="cx">             arrayBufferView = getJSValue(DataView::create(arrayBuffer, byteOffset, length).get());
</span><span class="cx">             return true;
</span><span class="cx">         case Int8ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Int8Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Int8Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Uint8ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Uint8Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Uint8Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Uint8ClampedArrayTag:
</span><del>-            arrayBufferView = getJSValue(Uint8ClampedArray::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Uint8ClampedArray::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Int16ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Int16Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Int16Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Uint16ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Uint16Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Uint16Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Int32ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Int32Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Int32Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Uint32ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Uint32Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Uint32Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Float32ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Float32Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Float32Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         case Float64ArrayTag:
</span><del>-            arrayBufferView = getJSValue(Float64Array::create(arrayBuffer, byteOffset, length).get());
</del><ins>+            arrayBufferView = toJS(m_exec, m_globalObject, Float64Array::create(arrayBuffer, byteOffset, length).get());
</ins><span class="cx">             return true;
</span><span class="cx">         default:
</span><span class="cx">             return false;
</span><span class="lines">@@ -2330,7 +2330,7 @@
</span><span class="cx">                 fail();
</span><span class="cx">                 return JSValue();
</span><span class="cx">             }
</span><del>-            JSValue result = getJSValue(arrayBuffer.get());
</del><ins>+            JSValue result = JSArrayBuffer::create(m_exec-&gt;vm(), m_globalObject-&gt;arrayBufferStructure(), arrayBuffer.release());
</ins><span class="cx">             m_gcBuffer.append(result);
</span><span class="cx">             return result;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>