<!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>[191850] 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/191850">191850</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-10-31 21:34:49 -0700 (Sat, 31 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>IDB: Date objects don't work as keys or values.
https://bugs.webkit.org/show_bug.cgi?id=150743

Reviewed by Darin Adler.

Source/WebCore:

Test: storage/indexeddb/modern/date-basic.html

The combination of the autogenerated bindings with Deprecated::ScriptValue was
losing the fidelity of &quot;Date&quot; objects being Dates, and not just normal Objects.

This was breaking their usage as IDBKeys.

Custom binding + reworking the IDBObjectStore IDLs to use JSValue instead of ScriptValue
fixes this handily.

* Modules/indexeddb/IDBObjectStore.h:
* Modules/indexeddb/IDBObjectStore.idl:

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::add):
(WebCore::IDBClient::IDBObjectStore::put):
(WebCore::IDBClient::IDBObjectStore::putOrAdd):
* Modules/indexeddb/client/IDBObjectStoreImpl.h:

* Modules/indexeddb/legacy/LegacyObjectStore.cpp:
(WebCore::LegacyObjectStore::add):
(WebCore::LegacyObjectStore::put):
* Modules/indexeddb/legacy/LegacyObjectStore.h:

* bindings/js/IDBBindingUtilities.cpp:
(WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath):
(WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath):
(WebCore::canInjectIDBKeyIntoScriptValue):
(WebCore::scriptValueToIDBKey):
* bindings/js/IDBBindingUtilities.h:

* bindings/js/JSIDBObjectStoreCustom.cpp:
(WebCore::putOrAdd):
(WebCore::JSIDBObjectStore::putRecord):
(WebCore::JSIDBObjectStore::add):

LayoutTests:

* storage/indexeddb/modern/date-basic-expected.txt: Added.
* storage/indexeddb/modern/date-basic.html: Added.
* storage/indexeddb/modern/get-keyrange-expected.txt:
* storage/indexeddb/modern/get-keyrange.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderngetkeyrangeexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderngetkeyrangehtml">trunk/LayoutTests/storage/indexeddb/modern/get-keyrange.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBObjectStoreidl">trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddblegacyLegacyObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddblegacyLegacyObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp">trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsIDBBindingUtilitiesh">trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSIDBObjectStoreCustomcpp">trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndatebasicexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmoderndatebasichtml">trunk/LayoutTests/storage/indexeddb/modern/date-basic.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/LayoutTests/ChangeLog        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2015-10-31  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        IDB: Date objects don't work as keys or values.
+        https://bugs.webkit.org/show_bug.cgi?id=150743
+
+        Reviewed by Darin Adler.
+
+        * storage/indexeddb/modern/date-basic-expected.txt: Added.
+        * storage/indexeddb/modern/date-basic.html: Added.
+        * storage/indexeddb/modern/get-keyrange-expected.txt:
+        * storage/indexeddb/modern/get-keyrange.html:
+
+2015-10-31  Brady Eidson  &lt;beidson@apple.com&gt;
+
</ins><span class="cx">         storage/indexeddb/modern/idbdatabase-deleteobjectstore-failures.html is flaky.
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=150735
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndatebasicexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt (0 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic-expected.txt        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -0,0 +1,17 @@
</span><ins>+ALERT: Initial upgrade needed: Old version - 0 New version - 1
+ALERT: Initial upgrade versionchange transaction complete
+ALERT: Success getting key 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object, result is 'Flux capacitor' of type string
+ALERT: Key is a Date object, btw
+ALERT: Success getting key 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object, result is 'Fish under the sea' of type string
+ALERT: Key is a Date object, btw
+ALERT: Success getting key 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object, result is 'Hoverboards' of type string
+ALERT: Key is a Date object, btw
+ALERT: Success getting key 'a' of type string, result is 'Fri Nov 04 1955 17:00:00 GMT-0700 (PDT)' of type object
+ALERT: Result is a Date object, btw
+ALERT: Success getting key 'b' of type string, result is 'Sat Nov 12 1955 10:00:00 GMT-0800 (PST)' of type object
+ALERT: Result is a Date object, btw
+ALERT: Success getting key 'c' of type string, result is 'Wed Oct 21 2015 09:00:00 GMT-0700 (PDT)' of type object
+ALERT: Result is a Date object, btw
+ALERT: readonly transaction complete
+ALERT: Done
+This tests using Date objects as keys and values.
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderndatebasichtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/date-basic.html (0 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/date-basic.html                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/date-basic.html        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+This tests using Date objects as keys and values.
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function done()
+{
+    alert(&quot;Done&quot;);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open(&quot;DateBasicDatabase&quot;, 1);
+var database;
+
+var date1 = new Date(&quot;1955-11-05T00:00:00&quot;);
+var date2 = new Date(&quot;1955-11-12T18:00:00&quot;);
+var date3 = new Date(&quot;2015-10-21T16:00:00&quot;);
+    
+createRequest.onupgradeneeded = function(event) {
+    alert(&quot;Initial upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
+
+    var versionTransaction = createRequest.transaction;
+    database = event.target.result;
+    var objectStore = database.createObjectStore(&quot;TestObjectStore&quot;);
+
+    objectStore.put(&quot;Flux capacitor&quot;, date1);
+    objectStore.put(&quot;Fish under the sea&quot;, date2);
+    objectStore.put(&quot;Hoverboards&quot;, date3);
+    
+    objectStore.put(date1, &quot;a&quot;);
+    objectStore.put(date2, &quot;b&quot;);
+    objectStore.put(date3, &quot;c&quot;);
+    
+    versionTransaction.onabort = function(event) {
+        alert(&quot;Initial upgrade versionchange transaction unexpected aborted&quot;);
+        done();
+    }
+
+    versionTransaction.oncomplete = function(event) {
+        alert(&quot;Initial upgrade versionchange transaction complete&quot;);
+        continueTest1();
+    }
+
+    versionTransaction.onerror = function(event) {
+        alert(&quot;Initial upgrade versionchange transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
+var objectStore;
+
+function testGet(key) {
+    var request = objectStore.get(key);
+    request.onsuccess = function()
+    {
+        alert(&quot;Success getting key '&quot; + key + &quot;' of type &quot; + typeof(key) + &quot;, result is '&quot; + request.result + &quot;' of type &quot; + typeof(request.result));
+        if (key instanceof Date)
+            alert(&quot;Key is a Date object, btw&quot;);
+        if (request.result instanceof Date)
+            alert(&quot;Result is a Date object, btw&quot;);
+    }
+    request.onerror = function()
+    {
+        alert(&quot;Expected error getting key '&quot; + key + &quot;'&quot;);
+    }
+}
+
+function continueTest1()
+{
+    var transaction = database.transaction(&quot;TestObjectStore&quot;, &quot;readonly&quot;);
+    objectStore = transaction.objectStore(&quot;TestObjectStore&quot;);
+    
+    testGet(date1);
+    testGet(date2);
+    testGet(date3);
+    testGet(&quot;a&quot;);
+    testGet(&quot;b&quot;);
+    testGet(&quot;c&quot;);
+    
+    transaction.onabort = function(event) {
+        alert(&quot;readonly transaction unexpected abort&quot; + event);
+        done();
+    }
+
+    transaction.oncomplete = function(event) {
+        alert(&quot;readonly transaction complete&quot;);
+        done();
+    }
+
+    transaction.onerror = function(event) {
+        alert(&quot;readonly transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderngetkeyrangeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange-expected.txt        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -77,11 +77,11 @@
</span><span class="cx"> ALERT: Success getting keyRange [Infinity (Closed), a (Closed)]
</span><span class="cx"> ALERT: Result is PosInf
</span><span class="cx"> ALERT: Success getting keyRange [Infinity (Open), a (Closed)]
</span><del>-ALERT: Result is A
</del><ins>+ALERT: Result is Flux capacitor
</ins><span class="cx"> ALERT: Success getting keyRange [Infinity (Closed), a (Open)]
</span><span class="cx"> ALERT: Result is PosInf
</span><span class="cx"> ALERT: Success getting keyRange [Infinity (Open), a (Open)]
</span><del>-ALERT: Result is A
</del><ins>+ALERT: Result is Flux capacitor
</ins><span class="cx"> ALERT: Success getting keyRange [AS (Closed), a (Closed)]
</span><span class="cx"> ALERT: Result is AS
</span><span class="cx"> ALERT: Success getting keyRange [AS (Open), a (Closed)]
</span><span class="lines">@@ -93,11 +93,35 @@
</span><span class="cx"> ALERT: Success getting keyRange [Infinity (Closed),  (Closed)]
</span><span class="cx"> ALERT: Result is PosInf
</span><span class="cx"> ALERT: Success getting keyRange [Infinity (Open),  (Closed)]
</span><del>-ALERT: Result is A
</del><ins>+ALERT: Result is Flux capacitor
</ins><span class="cx"> ALERT: Success getting keyRange [Infinity (Closed),  (Open)]
</span><span class="cx"> ALERT: Result is PosInf
</span><span class="cx"> ALERT: Success getting keyRange [Infinity (Open),  (Open)]
</span><del>-ALERT: Result is A
</del><ins>+ALERT: Result is Flux capacitor
+ALERT: Success getting keyRange [Infinity (Closed), a (Closed)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open), a (Closed)]
+ALERT: Result is Flux capacitor
+ALERT: Success getting keyRange [Infinity (Closed), a (Open)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open), a (Open)]
+ALERT: Result is Flux capacitor
+ALERT: Success getting keyRange [Infinity (Closed), a (Closed)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open), a (Closed)]
+ALERT: Result is Flux capacitor
+ALERT: Success getting keyRange [Infinity (Closed), a (Open)]
+ALERT: Result is PosInf
+ALERT: Success getting keyRange [Infinity (Open), a (Open)]
+ALERT: Result is Flux capacitor
+ALERT: Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+ALERT: Result is Flux capacitor
+ALERT: Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Closed)]
+ALERT: Result is Fish under the sea
+ALERT: Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Closed), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+ALERT: Result is Flux capacitor
+ALERT: Success getting keyRange [Fri Nov 04 1955 17:00:00 GMT-0700 (PDT) (Open), Wed Oct 21 2015 09:00:00 GMT-0700 (PDT) (Open)]
+ALERT: Result is Fish under the sea
</ins><span class="cx"> ALERT: readonly transaction complete
</span><span class="cx"> ALERT: Done
</span><span class="cx"> This test exercises IDBObjectStore.get() with an IDBKeyRange as the parameter.
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmoderngetkeyrangehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/storage/indexeddb/modern/get-keyrange.html (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/get-keyrange.html        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/LayoutTests/storage/indexeddb/modern/get-keyrange.html        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -16,12 +16,21 @@
</span><span class="cx"> var createRequest = window.indexedDB.open(&quot;GetKeyRangeDatabase&quot;, 1);
</span><span class="cx"> var database;
</span><span class="cx"> 
</span><ins>+var date1 = new Date(&quot;1955-11-05T00:00:00&quot;);
+var date2 = new Date(&quot;1955-11-12T18:00:00&quot;);
+var date3 = new Date(&quot;2015-10-21T16:00:00&quot;);
+    
</ins><span class="cx"> createRequest.onupgradeneeded = function(event) {
</span><span class="cx">     alert(&quot;Initial upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
</span><span class="cx"> 
</span><span class="cx">     var versionTransaction = createRequest.transaction;
</span><span class="cx">     database = event.target.result;
</span><span class="cx">     var objectStore = database.createObjectStore(&quot;TestObjectStore&quot;);
</span><ins>+
+    objectStore.put(&quot;Flux capacitor&quot;, date1);
+    objectStore.put(&quot;Fish under the sea&quot;, date2);
+    objectStore.put(&quot;Hoverboards&quot;, date3);
+
</ins><span class="cx">     for (var i = 0; i &lt; 100; ++i)
</span><span class="cx">         objectStore.put(&quot;\&quot;&quot; + i + &quot;\&quot;&quot;, i);
</span><span class="cx"> 
</span><span class="lines">@@ -127,6 +136,21 @@
</span><span class="cx">     testGet(IDBKeyRange.bound(Infinity, [], true));
</span><span class="cx">     testGet(IDBKeyRange.bound(Infinity, [], false, true));
</span><span class="cx">     testGet(IDBKeyRange.bound(Infinity, [], true, true));
</span><ins>+
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;));
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;, true));
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;, false, true));
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;, true, true));
+
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;));
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;, true));
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;, false, true));
+    testGet(IDBKeyRange.bound(Infinity, &quot;a&quot;, true, true));
+
+    testGet(IDBKeyRange.bound(date1, date3));
+    testGet(IDBKeyRange.bound(date1, date3, true));
+    testGet(IDBKeyRange.bound(date1, date3, false, true));
+    testGet(IDBKeyRange.bound(date1, date3, true, true));
</ins><span class="cx">     
</span><span class="cx">     transaction.onabort = function(event) {
</span><span class="cx">         alert(&quot;readonly transaction unexpected abort&quot; + event);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/ChangeLog        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-10-31  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        IDB: Date objects don't work as keys or values.
+        https://bugs.webkit.org/show_bug.cgi?id=150743
+
+        Reviewed by Darin Adler.
+
+        Test: storage/indexeddb/modern/date-basic.html
+
+        The combination of the autogenerated bindings with Deprecated::ScriptValue was
+        losing the fidelity of &quot;Date&quot; objects being Dates, and not just normal Objects.
+        
+        This was breaking their usage as IDBKeys.
+        
+        Custom binding + reworking the IDBObjectStore IDLs to use JSValue instead of ScriptValue
+        fixes this handily.
+        
+        * Modules/indexeddb/IDBObjectStore.h:
+        * Modules/indexeddb/IDBObjectStore.idl:
+        
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::add):
+        (WebCore::IDBClient::IDBObjectStore::put):
+        (WebCore::IDBClient::IDBObjectStore::putOrAdd):
+        * Modules/indexeddb/client/IDBObjectStoreImpl.h:
+        
+        * Modules/indexeddb/legacy/LegacyObjectStore.cpp:
+        (WebCore::LegacyObjectStore::add):
+        (WebCore::LegacyObjectStore::put):
+        * Modules/indexeddb/legacy/LegacyObjectStore.h:
+        
+        * bindings/js/IDBBindingUtilities.cpp:
+        (WebCore::internalCreateIDBKeyFromScriptValueAndKeyPath):
+        (WebCore::maybeCreateIDBKeyFromScriptValueAndKeyPath):
+        (WebCore::canInjectIDBKeyIntoScriptValue):
+        (WebCore::scriptValueToIDBKey):
+        * bindings/js/IDBBindingUtilities.h:
+
+        * bindings/js/JSIDBObjectStoreCustom.cpp:
+        (WebCore::putOrAdd):
+        (WebCore::JSIDBObjectStore::putRecord):
+        (WebCore::JSIDBObjectStore::add):
+
</ins><span class="cx"> 2015-10-31  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add a debug overlay with information about web process resource usage.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> class ExecState;
</span><ins>+class JSValue;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -66,8 +67,8 @@
</span><span class="cx">     virtual RefPtr&lt;IDBTransaction&gt; transaction() = 0;
</span><span class="cx">     virtual bool autoIncrement() const = 0;
</span><span class="cx"> 
</span><del>-    virtual RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, ExceptionCode&amp;) = 0;
-    virtual RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, ExceptionCode&amp;) = 0;
</del><ins>+    virtual RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, JSC::JSValue, ExceptionCode&amp;) = 0;
+    virtual RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, JSC::JSValue, ExceptionCode&amp;) = 0;
</ins><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; openCursor(ScriptExecutionContext*, ExceptionCode&amp;) = 0;
</span><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; openCursor(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;) = 0;
</span><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) = 0;
</span><span class="lines">@@ -76,8 +77,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; get(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) = 0;
</span><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; get(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;) = 0;
</span><del>-    virtual RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) = 0;
-    virtual RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) = 0;
</del><ins>+    virtual RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, JSC::JSValue, JSC::JSValue key, ExceptionCode&amp;) = 0;
+    virtual RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, JSC::JSValue, JSC::JSValue key, ExceptionCode&amp;) = 0;
</ins><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; deleteFunction(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;) = 0;
</span><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; deleteFunction(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) = 0;
</span><span class="cx">     virtual RefPtr&lt;IDBRequest&gt; clear(ScriptExecutionContext*, ExceptionCode&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBObjectStoreidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.idl        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -34,8 +34,8 @@
</span><span class="cx">     readonly attribute IDBTransaction transaction;
</span><span class="cx">     readonly attribute boolean autoIncrement;
</span><span class="cx"> 
</span><del>-    [CallWith=ScriptState, RaisesException] IDBRequest put(any value, optional any key);
-    [CallWith=ScriptState, RaisesException] IDBRequest add(any value, optional any key);
</del><ins>+    [CallWith=ScriptExecutionContext, Custom, ImplementedAs=putFunction, RaisesException] IDBRequest put(any value, optional any key);
+    [CallWith=ScriptExecutionContext, Custom, RaisesException] IDBRequest add(any value, optional any key);
</ins><span class="cx">     [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(IDBKeyRange? keyRange);
</span><span class="cx">     [CallWith=ScriptExecutionContext, ImplementedAs=deleteFunction, RaisesException] IDBRequest delete(any key);
</span><span class="cx">     [CallWith=ScriptExecutionContext, RaisesException] IDBRequest get(IDBKeyRange? key);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -87,16 +87,6 @@
</span><span class="cx">     return m_info.autoIncrement();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::add(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, ExceptionCode&amp; ec)
-{
-    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, ec);
-}
-
-RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::put(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, ExceptionCode&amp; ec)
-{
-    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::Overwrite, ec);
-}
-
</del><span class="cx"> RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::openCursor(ScriptExecutionContext*, ExceptionCode&amp;)
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT_NOT_REACHED();
</span><span class="lines">@@ -183,20 +173,30 @@
</span><span class="cx">     return WTF::move(request);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::add(JSC::ExecState&amp; execState, Deprecated::ScriptValue&amp; value, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::add(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><ins>+    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, ec);
+}
+
+RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::add(JSC::ExecState&amp; execState, JSC::JSValue value, JSC::JSValue key, ExceptionCode&amp; ec)
+{
</ins><span class="cx">     auto idbKey = scriptValueToIDBKey(execState, key);
</span><span class="cx">     return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::NoOverwrite, ec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::put(JSC::ExecState&amp; execState, Deprecated::ScriptValue&amp; value, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::put(JSC::ExecState&amp; execState, JSC::JSValue value, JSC::JSValue key, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     auto idbKey = scriptValueToIDBKey(execState, key);
</span><span class="cx">     return putOrAdd(execState, value, idbKey, IndexedDB::ObjectStoreOverwriteMode::Overwrite, ec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::putOrAdd(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, RefPtr&lt;IDBKey&gt; key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::put(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><ins>+    return putOrAdd(state, value, nullptr, IndexedDB::ObjectStoreOverwriteMode::Overwrite, ec);
+}
+
+RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::putOrAdd(JSC::ExecState&amp; state, JSC::JSValue value, RefPtr&lt;IDBKey&gt; key, IndexedDB::ObjectStoreOverwriteMode overwriteMode, ExceptionCode&amp; ec)
+{
</ins><span class="cx">     LOG(IndexedDB, &quot;IDBObjectStore::putOrAdd&quot;);
</span><span class="cx"> 
</span><span class="cx">     if (m_transaction-&gt;isReadOnly()) {
</span><span class="lines">@@ -214,7 +214,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::create(&amp;state, value.jsValue(), nullptr, nullptr);
</del><ins>+    RefPtr&lt;SerializedScriptValue&gt; serializedValue = SerializedScriptValue::create(&amp;state, value, nullptr, nullptr);
</ins><span class="cx">     if (state.hadException()) {
</span><span class="cx">         ec = DATA_CLONE_ERR;
</span><span class="cx">         return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.h        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -54,8 +54,8 @@
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBTransaction&gt; transaction() override final;
</span><span class="cx">     virtual bool autoIncrement() const override final;
</span><span class="cx"> 
</span><del>-    virtual RefPtr&lt;WebCore::IDBRequest&gt; add(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, ExceptionCode&amp;) override final;
-    virtual RefPtr&lt;WebCore::IDBRequest&gt; put(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, ExceptionCode&amp;) override final;
</del><ins>+    virtual RefPtr&lt;WebCore::IDBRequest&gt; add(JSC::ExecState&amp;, JSC::JSValue, ExceptionCode&amp;) override final;
+    virtual RefPtr&lt;WebCore::IDBRequest&gt; put(JSC::ExecState&amp;, JSC::JSValue, ExceptionCode&amp;) override final;
</ins><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; openCursor(ScriptExecutionContext*, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; openCursor(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) override final;
</span><span class="lines">@@ -63,8 +63,8 @@
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, const String&amp; direction, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; get(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; get(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;) override final;
</span><del>-    virtual RefPtr&lt;WebCore::IDBRequest&gt; add(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) override final;
-    virtual RefPtr&lt;WebCore::IDBRequest&gt; put(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) override final;
</del><ins>+    virtual RefPtr&lt;WebCore::IDBRequest&gt; add(JSC::ExecState&amp;, JSC::JSValue, JSC::JSValue key, ExceptionCode&amp;) override final;
+    virtual RefPtr&lt;WebCore::IDBRequest&gt; put(JSC::ExecState&amp;, JSC::JSValue, JSC::JSValue key, ExceptionCode&amp;) override final;
</ins><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; deleteFunction(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; deleteFunction(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;) override final;
</span><span class="cx">     virtual RefPtr&lt;WebCore::IDBRequest&gt; clear(ScriptExecutionContext*, ExceptionCode&amp;) override final;
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx"> private:
</span><span class="cx">     IDBObjectStore(const IDBObjectStoreInfo&amp;, IDBTransaction&amp;);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;WebCore::IDBRequest&gt; putOrAdd(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, RefPtr&lt;IDBKey&gt;, IndexedDB::ObjectStoreOverwriteMode, ExceptionCode&amp;);
</del><ins>+    RefPtr&lt;WebCore::IDBRequest&gt; putOrAdd(JSC::ExecState&amp;, JSC::JSValue, RefPtr&lt;IDBKey&gt;, IndexedDB::ObjectStoreOverwriteMode, ExceptionCode&amp;);
</ins><span class="cx"> 
</span><span class="cx">     IDBObjectStoreInfo m_info;
</span><span class="cx">     Ref&lt;IDBTransaction&gt; m_transaction;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddblegacyLegacyObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.cpp (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.cpp        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.cpp        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -96,28 +96,33 @@
</span><span class="cx">     return get(context, keyRange.get(), ec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;IDBRequest&gt; LegacyObjectStore::add(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;IDBRequest&gt; LegacyObjectStore::add(JSC::ExecState&amp; state, JSC::JSValue value, JSC::JSValue key, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     LOG(StorageAPI, &quot;LegacyObjectStore::add&quot;);
</span><del>-    return put(IDBDatabaseBackend::AddOnly, LegacyAny::create(this), state, value, key, ec);
</del><ins>+    auto deprecatedValue = Deprecated::ScriptValue(state.vm(), value);
+    auto dKey = Deprecated::ScriptValue(state.vm(), key);
+    return put(IDBDatabaseBackend::AddOnly, LegacyAny::create(this), state, deprecatedValue, dKey, ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;IDBRequest&gt; LegacyObjectStore::add(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;IDBRequest&gt; LegacyObjectStore::add(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     LOG(StorageAPI, &quot;LegacyObjectStore::add&quot;);
</span><del>-    return put(IDBDatabaseBackend::AddOnly, LegacyAny::create(this), state, value, static_cast&lt;IDBKey*&gt;(nullptr), ec);
</del><ins>+    auto deprecatedValue = Deprecated::ScriptValue(state.vm(), value);
+    return put(IDBDatabaseBackend::AddOnly, LegacyAny::create(this), state, deprecatedValue, static_cast&lt;IDBKey*&gt;(nullptr), ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;IDBRequest&gt; LegacyObjectStore::put(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;IDBRequest&gt; LegacyObjectStore::put(JSC::ExecState&amp; state, JSC::JSValue value, JSC::JSValue key, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     LOG(StorageAPI, &quot;LegacyObjectStore::put&quot;);
</span><del>-    return put(IDBDatabaseBackend::AddOrUpdate, LegacyAny::create(this), state, value, key, ec);
</del><ins>+    auto deprecatedValue = Deprecated::ScriptValue(state.vm(), value);
+    return put(IDBDatabaseBackend::AddOrUpdate, LegacyAny::create(this), state, deprecatedValue, Deprecated::ScriptValue(state.vm(), key), ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;IDBRequest&gt; LegacyObjectStore::put(JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, ExceptionCode&amp; ec)
</del><ins>+RefPtr&lt;IDBRequest&gt; LegacyObjectStore::put(JSC::ExecState&amp; state, JSC::JSValue value, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><span class="cx">     LOG(StorageAPI, &quot;LegacyObjectStore::put&quot;);
</span><del>-    return put(IDBDatabaseBackend::AddOrUpdate, LegacyAny::create(this), state, value, static_cast&lt;IDBKey*&gt;(nullptr), ec);
</del><ins>+    auto deprecatedValue = Deprecated::ScriptValue(state.vm(), value);
+    return put(IDBDatabaseBackend::AddOrUpdate, LegacyAny::create(this), state, deprecatedValue, static_cast&lt;IDBKey*&gt;(nullptr), ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;IDBRequest&gt; LegacyObjectStore::put(IDBDatabaseBackend::PutMode putMode, RefPtr&lt;LegacyAny&gt; source, JSC::ExecState&amp; state, Deprecated::ScriptValue&amp; value, const Deprecated::ScriptValue&amp; keyValue, ExceptionCode&amp; ec)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddblegacyLegacyObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.h (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.h        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyObjectStore.h        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -67,8 +67,8 @@
</span><span class="cx">     RefPtr&lt;IDBTransaction&gt; transaction() { return m_transaction; }
</span><span class="cx">     bool autoIncrement() const { return m_metadata.autoIncrement; }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, ExceptionCode&amp;);
-    RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, ExceptionCode&amp;);
</del><ins>+    RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, JSC::JSValue, ExceptionCode&amp;);
+    RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, JSC::JSValue, ExceptionCode&amp;);
</ins><span class="cx">     RefPtr&lt;IDBRequest&gt; openCursor(ScriptExecutionContext*, ExceptionCode&amp;);
</span><span class="cx">     RefPtr&lt;IDBRequest&gt; openCursor(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;);
</span><span class="cx">     RefPtr&lt;IDBRequest&gt; openCursor(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;);
</span><span class="lines">@@ -78,8 +78,8 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;IDBRequest&gt; get(ScriptExecutionContext*, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;);
</span><span class="cx">     RefPtr&lt;IDBRequest&gt; get(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;);
</span><del>-    RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;);
-    RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;);
</del><ins>+    RefPtr&lt;IDBRequest&gt; add(JSC::ExecState&amp;, JSC::JSValue, JSC::JSValue key, ExceptionCode&amp;);
+    RefPtr&lt;IDBRequest&gt; put(JSC::ExecState&amp;, JSC::JSValue, JSC::JSValue key, ExceptionCode&amp;);
</ins><span class="cx">     RefPtr&lt;IDBRequest&gt; put(IDBDatabaseBackend::PutMode, RefPtr&lt;LegacyAny&gt;, JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, RefPtr&lt;IDBKey&gt;, ExceptionCode&amp;);
</span><span class="cx">     RefPtr&lt;IDBRequest&gt; put(IDBDatabaseBackend::PutMode, RefPtr&lt;LegacyAny&gt; source, JSC::ExecState&amp;, Deprecated::ScriptValue&amp;, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsIDBBindingUtilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.cpp        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -185,14 +185,14 @@
</span><span class="cx">     return currentValue;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static RefPtr&lt;IDBKey&gt; internalCreateIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const Deprecated::ScriptValue&amp; value, const String&amp; keyPath)
</del><ins>+static RefPtr&lt;IDBKey&gt; internalCreateIDBKeyFromScriptValueAndKeyPath(ExecState* exec, const JSC::JSValue&amp; value, const String&amp; keyPath)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;String&gt; keyPathElements;
</span><span class="cx">     IDBKeyPathParseError error;
</span><span class="cx">     IDBParseKeyPath(keyPath, keyPathElements, error);
</span><span class="cx">     ASSERT(error == IDBKeyPathParseError::None);
</span><span class="cx"> 
</span><del>-    JSValue jsValue = value.jsValue();
</del><ins>+    JSValue jsValue = value;
</ins><span class="cx">     jsValue = getNthValueOnKeyPath(exec, jsValue, keyPathElements, keyPathElements.size());
</span><span class="cx">     if (jsValue.isUndefined())
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -302,8 +302,29 @@
</span><span class="cx">     return internalCreateIDBKeyFromScriptValueAndKeyPath(&amp;exec, value, keyPath.string());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool canInjectIDBKeyIntoScriptValue(DOMRequestState* requestState, const Deprecated::ScriptValue&amp; scriptValue, const IDBKeyPath&amp; keyPath)
</del><ins>+RefPtr&lt;IDBKey&gt; maybeCreateIDBKeyFromScriptValueAndKeyPath(ExecState&amp; exec, const JSC::JSValue&amp; value, const IDBKeyPath&amp; keyPath)
</ins><span class="cx"> {
</span><ins>+    ASSERT(!keyPath.isNull());
+
+    if (keyPath.type() == IndexedDB::KeyPathType::Array) {
+        const Vector&lt;String&gt;&amp; array = keyPath.array();
+        Vector&lt;RefPtr&lt;IDBKey&gt;&gt; result;
+        result.reserveInitialCapacity(array.size());
+        for (auto&amp; string : array) {
+            RefPtr&lt;IDBKey&gt; key = internalCreateIDBKeyFromScriptValueAndKeyPath(&amp;exec, value, string);
+            if (!key)
+                return nullptr;
+            result.uncheckedAppend(WTF::move(key));
+        }
+        return IDBKey::createArray(WTF::move(result));
+    }
+
+    ASSERT(keyPath.type() == IndexedDB::KeyPathType::String);
+    return internalCreateIDBKeyFromScriptValueAndKeyPath(&amp;exec, value, keyPath.string());
+}
+
+bool canInjectIDBKeyIntoScriptValue(DOMRequestState* requestState, const JSC::JSValue&amp; scriptValue, const IDBKeyPath&amp; keyPath)
+{
</ins><span class="cx">     LOG(StorageAPI, &quot;canInjectIDBKeyIntoScriptValue&quot;);
</span><span class="cx"> 
</span><span class="cx">     JSC::ExecState* exec = requestState-&gt;exec();
</span><span class="lines">@@ -313,7 +334,7 @@
</span><span class="cx">     return canInjectIDBKeyIntoScriptValue(*exec, scriptValue, keyPath);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&amp; execState, const Deprecated::ScriptValue&amp; scriptValue, const IDBKeyPath&amp; keyPath)
</del><ins>+bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&amp; execState, const JSC::JSValue&amp; scriptValue, const IDBKeyPath&amp; keyPath)
</ins><span class="cx"> {
</span><span class="cx">     LOG(StorageAPI, &quot;canInjectIDBKeyIntoScriptValue&quot;);
</span><span class="cx"> 
</span><span class="lines">@@ -326,7 +347,7 @@
</span><span class="cx">     if (!keyPathElements.size())
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    return canInjectNthValueOnKeyPath(&amp;execState, scriptValue.jsValue(), keyPathElements, keyPathElements.size() - 1);
</del><ins>+    return canInjectNthValueOnKeyPath(&amp;execState, scriptValue, keyPathElements, keyPathElements.size() - 1);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValue(DOMRequestState* requestState, PassRefPtr&lt;SerializedScriptValue&gt; prpValue)
</span><span class="lines">@@ -402,15 +423,15 @@
</span><span class="cx">     return Deprecated::ScriptValue(exec-&gt;vm(), idbKeyToJSValue(exec, jsCast&lt;JSDOMGlobalObject*&gt;(exec-&gt;lexicalGlobalObject()), key.get()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(DOMRequestState* requestState, const Deprecated::ScriptValue&amp; scriptValue)
</del><ins>+RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(DOMRequestState* requestState, const JSC::JSValue&amp; scriptValue)
</ins><span class="cx"> {
</span><span class="cx">     ExecState* exec = requestState-&gt;exec();
</span><del>-    return createIDBKeyFromValue(exec, scriptValue.jsValue());
</del><ins>+    return createIDBKeyFromValue(exec, scriptValue);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(ExecState&amp; exec, const Deprecated::ScriptValue&amp; scriptValue)
</del><ins>+RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(ExecState&amp; exec, const JSC::JSValue&amp; scriptValue)
</ins><span class="cx"> {
</span><del>-    return createIDBKeyFromValue(&amp;exec, scriptValue.jsValue());
</del><ins>+    return createIDBKeyFromValue(&amp;exec, scriptValue);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void generateIndexKeysForValue(ExecState* exec, const IDBIndexMetadata&amp; indexMetadata, const Deprecated::ScriptValue&amp; objectValue, Vector&lt;IDBKeyData&gt;&amp; indexKeys)
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsIDBBindingUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/bindings/js/IDBBindingUtilities.h        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -49,17 +49,18 @@
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;IDBKey&gt; createIDBKeyFromScriptValueAndKeyPath(JSC::ExecState*, const Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
</span><span class="cx"> RefPtr&lt;IDBKey&gt; maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&amp;, const Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
</span><ins>+RefPtr&lt;IDBKey&gt; maybeCreateIDBKeyFromScriptValueAndKeyPath(JSC::ExecState&amp;, const JSC::JSValue&amp;, const IDBKeyPath&amp;);
</ins><span class="cx"> 
</span><del>-bool canInjectIDBKeyIntoScriptValue(DOMRequestState*, const Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
-bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&amp;, const Deprecated::ScriptValue&amp;, const IDBKeyPath&amp;);
</del><ins>+bool canInjectIDBKeyIntoScriptValue(DOMRequestState*, const JSC::JSValue&amp;, const IDBKeyPath&amp;);
+bool canInjectIDBKeyIntoScriptValue(JSC::ExecState&amp;, const JSC::JSValue&amp;, const IDBKeyPath&amp;);
</ins><span class="cx"> 
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValue(DOMRequestState*, PassRefPtr&lt;SerializedScriptValue&gt;);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueData(ScriptExecutionContext&amp;, const ThreadSafeDataBuffer&amp; valueData);
</span><span class="cx"> Deprecated::ScriptValue deserializeIDBValueBuffer(DOMRequestState*, PassRefPtr&lt;SharedBuffer&gt;, bool keyIsDefined);
</span><span class="cx"> WEBCORE_EXPORT Deprecated::ScriptValue deserializeIDBValueBuffer(JSC::ExecState*, const Vector&lt;uint8_t&gt;&amp;, bool keyIsDefined);
</span><span class="cx"> Deprecated::ScriptValue idbKeyToScriptValue(DOMRequestState*, PassRefPtr&lt;IDBKey&gt;);
</span><del>-RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(DOMRequestState*, const Deprecated::ScriptValue&amp;);
-RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(JSC::ExecState&amp;, const Deprecated::ScriptValue&amp;);
</del><ins>+RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(DOMRequestState*, const JSC::JSValue&amp;);
+RefPtr&lt;IDBKey&gt; scriptValueToIDBKey(JSC::ExecState&amp;, const JSC::JSValue&amp;);
</ins><span class="cx"> WEBCORE_EXPORT void generateIndexKeysForValue(JSC::ExecState*, const IDBIndexMetadata&amp;, const Deprecated::ScriptValue&amp; objectValue, Vector&lt;IDBKeyData&gt;&amp; indexKeys);
</span><span class="cx"> 
</span><span class="cx"> Deprecated::ScriptValue idbKeyDataToScriptValue(ScriptExecutionContext*, const IDBKeyData&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSIDBObjectStoreCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp (191849 => 191850)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp        2015-11-01 02:29:47 UTC (rev 191849)
+++ trunk/Source/WebCore/bindings/js/JSIDBObjectStoreCustom.cpp        2015-11-01 04:34:49 UTC (rev 191850)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include &quot;IDBObjectStore.h&quot;
</span><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><span class="cx"> #include &quot;JSIDBIndex.h&quot;
</span><ins>+#include &quot;JSIDBRequest.h&quot;
</ins><span class="cx"> #include &lt;runtime/Error.h&gt;
</span><span class="cx"> #include &lt;runtime/JSString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -43,6 +44,55 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+static JSValue putOrAdd(JSC::ExecState&amp; state, bool overwrite)
+{
+    JSValue thisValue = state.thisValue();
+    JSIDBObjectStore* castedThis = jsDynamicCast&lt;JSIDBObjectStore*&gt;(thisValue);
+    if (UNLIKELY(!castedThis))
+        return JSValue::decode(throwThisTypeError(state, &quot;IDBObjectStore&quot;, &quot;put&quot;));
+
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSIDBObjectStore::info());
+    auto&amp; impl = castedThis-&gt;impl();
+
+    size_t argsCount = state.argumentCount();
+    if (UNLIKELY(argsCount &lt; 1))
+        return JSValue::decode(throwVMError(&amp;state, createNotEnoughArgumentsError(&amp;state)));
+
+    ExceptionCode ec = 0;
+    auto value = state.uncheckedArgument(0);
+
+    if (argsCount == 1) {
+        JSValue result;
+        if (overwrite)
+            result = toJS(&amp;state, castedThis-&gt;globalObject(), impl.put(state, value, ec).get());
+        else
+            result = toJS(&amp;state, castedThis-&gt;globalObject(), impl.add(state, value, ec).get());
+
+        setDOMException(&amp;state, ec);
+        return result;
+    }
+
+    auto key = state.uncheckedArgument(1);
+    JSValue result;
+    if (overwrite)
+        result = toJS(&amp;state, castedThis-&gt;globalObject(), impl.put(state, value, key, ec).get());
+    else
+        result = toJS(&amp;state, castedThis-&gt;globalObject(), impl.add(state, value, key, ec).get());
+
+    setDOMException(&amp;state, ec);
+    return result;
+}
+
+JSValue JSIDBObjectStore::putFunction(JSC::ExecState&amp; state)
+{
+    return putOrAdd(state, true);
+}
+
+JSValue JSIDBObjectStore::add(JSC::ExecState&amp; state)
+{
+    return putOrAdd(state, false);
+}
+
</ins><span class="cx"> JSValue JSIDBObjectStore::createIndex(ExecState&amp; state)
</span><span class="cx"> {
</span><span class="cx">     ScriptExecutionContext* context = jsCast&lt;JSDOMGlobalObject*&gt;(state.lexicalGlobalObject())-&gt;scriptExecutionContext();
</span></span></pre>
</div>
</div>

</body>
</html>