<!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>[191928] 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/191928">191928</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2015-11-02 17:06:53 -0800 (Mon, 02 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Modern IDB: IBDObjectStore.delete() support.
https://bugs.webkit.org/show_bug.cgi?id=150784

Reviewed by Alex Christensen.

Source/WebCore:

Tests: storage/indexeddb/modern/idbobjectstore-delete-1.html
       storage/indexeddb/modern/idbobjectstore-delete-2.html
       storage/indexeddb/modern/idbobjectstore-delete-failures.html

* Modules/indexeddb/IDBKeyRangeData.cpp:
(WebCore::IDBKeyRangeData::isValid):
* Modules/indexeddb/IDBKeyRangeData.h:

* Modules/indexeddb/client/IDBConnectionToServer.cpp:
(WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
(WebCore::IDBClient::IDBConnectionToServer::didDeleteRecord):
* Modules/indexeddb/client/IDBConnectionToServer.h:
* Modules/indexeddb/client/IDBConnectionToServerDelegate.h:

* Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
(WebCore::IDBClient::IDBObjectStore::get):
(WebCore::IDBClient::IDBObjectStore::deleteFunction):

* Modules/indexeddb/client/IDBTransactionImpl.cpp:
(WebCore::IDBClient::IDBTransaction::requestDeleteRecord):
(WebCore::IDBClient::IDBTransaction::deleteRecordOnServer):
(WebCore::IDBClient::IDBTransaction::didDeleteRecordOnServer):
* Modules/indexeddb/client/IDBTransactionImpl.h:

* Modules/indexeddb/server/IDBBackingStore.h:

* Modules/indexeddb/server/IDBConnectionToClient.cpp:
(WebCore::IDBServer::IDBConnectionToClient::didDeleteRecord):
* Modules/indexeddb/server/IDBConnectionToClient.h:
* Modules/indexeddb/server/IDBConnectionToClientDelegate.h:

* Modules/indexeddb/server/IDBServer.cpp:
(WebCore::IDBServer::IDBServer::deleteRecord):
* Modules/indexeddb/server/IDBServer.h:

* Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
(WebCore::IDBServer::MemoryIDBBackingStore::deleteRange):
(WebCore::IDBServer::MemoryIDBBackingStore::deleteRecord): Deleted.
* Modules/indexeddb/server/MemoryIDBBackingStore.h:

* Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::deleteRange):
* Modules/indexeddb/server/MemoryObjectStore.h:

* Modules/indexeddb/server/UniqueIDBDatabase.cpp:
(WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
(WebCore::IDBServer::UniqueIDBDatabase::deleteRecord):
(WebCore::IDBServer::UniqueIDBDatabase::performDeleteRecord):
(WebCore::IDBServer::UniqueIDBDatabase::didPerformDeleteRecord):
* Modules/indexeddb/server/UniqueIDBDatabase.h:

* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::getCount):
(WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteRecord):
* Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:

* Modules/indexeddb/shared/IDBResultData.cpp:
(WebCore::IDBResultData::deleteRecordSuccess):
* Modules/indexeddb/shared/IDBResultData.h:

* Modules/indexeddb/shared/InProcessIDBServer.cpp:
(WebCore::InProcessIDBServer::didDeleteRecord):
(WebCore::InProcessIDBServer::deleteRecord):
* Modules/indexeddb/shared/InProcessIDBServer.h:

LayoutTests:

* storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt: Added.
* storage/indexeddb/modern/idbobjectstore-delete-1.html: Added.
* storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt: Added.
* storage/indexeddb/modern/idbobjectstore-delete-2.html: Added.
* storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt: Added.
* storage/indexeddb/modern/idbobjectstore-delete-failures.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBKeyRangeDatacpp">trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbIDBKeyRangeDatah">trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerDelegateh">trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh">trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBBackingStoreh">trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientcpp">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClienth">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientDelegateh">trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBServercpp">trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverIDBServerh">trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorecpp">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh">trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactioncpp">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactionh">trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResultDatacpp">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedIDBResultDatah">trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp</a></li>
<li><a href="#trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh">trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete1expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete1html">trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete2expectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete2html">trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2.html</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbobjectstoredeletefailuresexpectedtxt">trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt</a></li>
<li><a href="#trunkLayoutTestsstorageindexeddbmodernidbobjectstoredeletefailureshtml">trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/LayoutTests/ChangeLog        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2015-11-02  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: IBDObjectStore.delete() support.
+        https://bugs.webkit.org/show_bug.cgi?id=150784
+
+        Reviewed by Alex Christensen.
+
+        * storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt: Added.
+        * storage/indexeddb/modern/idbobjectstore-delete-1.html: Added.
+        * storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt: Added.
+        * storage/indexeddb/modern/idbobjectstore-delete-2.html: Added.
+        * storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt: Added.
+        * storage/indexeddb/modern/idbobjectstore-delete-failures.html: Added.
+
</ins><span class="cx"> 2015-11-02  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Marking imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-chunked-trailer.htm as flaky on mac
</span></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt (0 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+This test exercises various uses of IDBObjectStore.delete()
+Initial upgrade needed: Old version - 0 New version - 1
+Count is 113
+Initial upgrade versionchange transaction complete
+Deleted &quot;Mon Jan 03 2000 16:00:00 GMT-0800 (PST)&quot;, and there should now be 1 less things total.
+Count is 112
+Deleted &quot;Mon Jan 03 2000 16:00:00 GMT-0800 (PST)&quot;, and there should now be 0 less things total.
+Count is 112
+Deleted &quot;balyhoo&quot;, and there should now be 0 less things total.
+Count is 112
+Deleted &quot;[object IDBKeyRange]&quot;, and there should now be 0 less things total.
+Count is 112
+Deleted &quot;[object IDBKeyRange]&quot;, and there should now be 1 less things total.
+Count is 111
+Deleted &quot;[object IDBKeyRange]&quot;, and there should now be 1 less things total.
+Count is 110
+Deleted &quot;[object IDBKeyRange]&quot;, and there should now be 5 less things total.
+Count is 105
+Deleted &quot;[object IDBKeyRange]&quot;, and there should now be 98 less things total.
+Count is 7
+Deleted &quot;[object IDBKeyRange]&quot;, and there should now be 3 less things total.
+Count is 4
+readwrite transaction complete
+Done
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1.html (0 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1.html                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1.html        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -0,0 +1,140 @@
</span><ins>+This test exercises various uses of IDBObjectStore.delete()&lt;br&gt;
+&lt;div id=&quot;logger&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function log(message)
+{
+    document.getElementById(&quot;logger&quot;).innerHTML += message + &quot;&lt;br&gt;&quot;;
+}
+
+function logCount()
+{
+    var req = objectStore.count();
+    req.onsuccess = function() { 
+        log(&quot;Count is &quot; + req.result);
+    }
+}
+
+function done()
+{
+    log(&quot;Done&quot;);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open(&quot;IDBObjectStoreDelete1Database&quot;, 1);
+var database;
+var objectStore;
+
+var date1 = new Date(&quot;1999-12-28T23:00:00&quot;);
+var date2 = new Date(&quot;1999-12-29T23:00:00&quot;);
+var date3 = new Date(&quot;1999-12-30T23:00:00&quot;);
+var date4 = new Date(&quot;1999-12-31T23:00:00&quot;);
+var date5 = new Date(&quot;2000-01-01T00:00:00&quot;);
+var date6 = new Date(&quot;2000-01-02T00:00:00&quot;);
+var date7 = new Date(&quot;2000-01-03T00:00:00&quot;);
+var date8 = new Date(&quot;2000-01-04T00:00:00&quot;);
+
+createRequest.onupgradeneeded = function(event) {
+    log(&quot;Initial upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
+
+    var versionTransaction = createRequest.transaction;
+    database = event.target.result;
+    objectStore = database.createObjectStore(&quot;TestObjectStore&quot;);
+    
+    // Just for the heck of it.
+    objectStore.delete(&quot;foo&quot;);
+    objectStore.put(&quot;boo&quot;, &quot;foo&quot;);
+    objectStore.delete(&quot;foo&quot;);
+
+    objectStore.put(&quot;boo&quot;, &quot;foo&quot;);
+    objectStore.put(&quot;bop&quot;, &quot;fop&quot;);
+    objectStore.put(&quot;boq&quot;, &quot;foq&quot;);
+    objectStore.put(&quot;bor&quot;, &quot;for&quot;);
+    objectStore.put(&quot;bos&quot;, &quot;fos&quot;);
+    
+    for (var i = 0; i &lt; 100; ++i)
+        objectStore.put(&quot;number &quot; + i, i);
+
+    objectStore.put(&quot;date 1&quot;, date1);
+    objectStore.put(&quot;date 2&quot;, date2);
+    objectStore.put(&quot;date 3&quot;, date3);
+    objectStore.put(&quot;date 4&quot;, date4);
+    objectStore.put(&quot;date 5&quot;, date5);
+    objectStore.put(&quot;date 6&quot;, date6);
+    objectStore.put(&quot;date 7&quot;, date7);
+    objectStore.put(&quot;date 8&quot;, date8);
+
+    logCount();
+
+    versionTransaction.onabort = function(event) {
+        log(&quot;Initial upgrade versionchange transaction unexpected abort&quot;);
+        done();
+    }
+
+    versionTransaction.oncomplete = function(event) {
+        log(&quot;Initial upgrade versionchange transaction complete&quot;);
+        continueTest1();
+    }
+
+    versionTransaction.onerror = function(event) {
+        log(&quot;Initial upgrade versionchange transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
+function continueTest1()
+{   
+    var transaction = database.transaction(&quot;TestObjectStore&quot;, &quot;readwrite&quot;);
+    objectStore = transaction.objectStore(&quot;TestObjectStore&quot;);
+
+    // The pairs of things in the array are the things to delete followed by the expected decrease in the total count of objects.
+    var thingsToDelete = [
+        date8, 1,
+        date8, 0, 
+        &quot;balyhoo&quot;, 0, 
+        IDBKeyRange.bound(date6, date7, true, true), 0,
+        IDBKeyRange.bound(date6, date7, true), 1,
+        IDBKeyRange.bound(date5, date6, false, true), 1,
+        IDBKeyRange.bound(date1, date6), 5,
+        IDBKeyRange.bound(1, 98), 98, 
+        IDBKeyRange.bound(&quot;foo&quot;, &quot;fos&quot;, true, true), 3
+    ];
+    var currentThing = 0;
+    
+    var runDeleteTests = function()
+    {
+        if (!thingsToDelete[currentThing])
+            return;
+        
+        objectStore.delete(thingsToDelete[currentThing]).onsuccess = function() {
+            log(&quot;Deleted \&quot;&quot; + thingsToDelete[currentThing] + &quot;\&quot;, and there should now be &quot; + thingsToDelete[currentThing + 1] + &quot; less things total.&quot;);
+            logCount();
+            currentThing += 2;
+            runDeleteTests();
+        }
+    }
+    runDeleteTests();
+    
+    transaction.onabort = function(event) {
+        log(&quot;readwrite transaction unexpected abort&quot; + event);
+        done();
+    }
+
+    transaction.oncomplete = function(event) {
+        log(&quot;readwrite transaction complete&quot;);
+        done();
+    }
+
+    transaction.onerror = function(event) {
+        log(&quot;readwrite transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete2expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt (0 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -0,0 +1,9 @@
</span><ins>+This test exercises IDBObjectStore.delete() followed by an abort to make sure the delete is un-done.
+Initial upgrade needed: Old version - 0 New version - 1
+Initial upgrade versionchange transaction complete
+After delete, record for &quot;foo&quot; has value: undefined
+readwrite transaction aborted
+Record for &quot;foo&quot; has final value: bar
+readonly transaction complete
+Done
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbobjectstoredelete2html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2.html (0 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2.html                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2.html        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+This test exercises IDBObjectStore.delete() followed by an abort to make sure the delete is un-done.&lt;br&gt;
+&lt;div id=&quot;logger&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function log(message)
+{
+    document.getElementById(&quot;logger&quot;).innerHTML += message + &quot;&lt;br&gt;&quot;;
+}
+
+function logCount()
+{
+    var req = objectStore.count();
+    req.onsuccess = function() { 
+        log(&quot;Count is &quot; + req.result);
+    }
+}
+
+function done()
+{
+    log(&quot;Done&quot;);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open(&quot;IDBObjectStoreDelete2Database&quot;, 1);
+var database;
+
+createRequest.onupgradeneeded = function(event) {
+    log(&quot;Initial upgrade needed: Old version - &quot; + event.oldVersion + &quot; New version - &quot; + event.newVersion);
+
+    var versionTransaction = createRequest.transaction;
+    database = event.target.result;
+    database.createObjectStore(&quot;TestObjectStore&quot;).put(&quot;bar&quot;, &quot;foo&quot;);
+
+    versionTransaction.onabort = function(event) {
+        log(&quot;Initial upgrade versionchange transaction unexpected abort&quot;);
+        done();
+    }
+
+    versionTransaction.oncomplete = function(event) {
+        log(&quot;Initial upgrade versionchange transaction complete&quot;);
+        continueTest1();
+    }
+
+    versionTransaction.onerror = function(event) {
+        log(&quot;Initial upgrade versionchange transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
+function continueTest1()
+{   
+    var transaction = database.transaction(&quot;TestObjectStore&quot;, &quot;readwrite&quot;);
+    transaction.objectStore(&quot;TestObjectStore&quot;).delete(&quot;foo&quot;).onsuccess = function()
+    {
+        var request = transaction.objectStore(&quot;TestObjectStore&quot;).get(&quot;foo&quot;);
+        request.onsuccess = function()
+        {
+            log(&quot;After delete, record for \&quot;foo\&quot; has value: &quot; + request.result);
+            transaction.abort();
+        }
+    }
+
+    transaction.onabort = function(event) {
+        log(&quot;readwrite transaction aborted&quot;);
+        continueTest2();
+    }
+
+    transaction.oncomplete = function(event) {
+        log(&quot;readwrite transaction unexpected complete&quot;);
+        done();
+    }
+
+    transaction.onerror = function(event) {
+        log(&quot;readwrite transaction unexpected error&quot;);
+        done();
+    }
+}
+
+function continueTest2()
+{   
+    var transaction = database.transaction(&quot;TestObjectStore&quot;, &quot;readonly&quot;);
+
+    var request = transaction.objectStore(&quot;TestObjectStore&quot;).get(&quot;foo&quot;);
+    request.onsuccess = function()
+    {
+        log(&quot;Record for \&quot;foo\&quot; has final value: &quot; + request.result);
+    }
+
+    transaction.onabort = function(event)
+    {
+        log(&quot;readonly transaction unexpected abort&quot;);
+        done();
+    }
+
+    transaction.oncomplete = function(event)
+    {
+        log(&quot;readonly transaction complete&quot;);
+        done();
+    }
+
+    transaction.onerror = function(event)
+    {
+        log(&quot;readonly transaction unexpected error&quot;);
+        done();
+    }
+}
+
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbobjectstoredeletefailuresexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt (0 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+This tests some obvious failures that can happen while calling IDBObjectStore.delete().
+Initial upgrade needed: Old version - 0 New version - 1
+Failed to delete record from object store with an invalid key
+Failed to delete record from object store that has been deleted
+Initial upgrade versionchange transaction complete
+Failed to delete a record in read-only transaction
+Failed to delete record with inactive transaction
+readwrite transaction complete
+Done
+
</ins></span></pre></div>
<a id="trunkLayoutTestsstorageindexeddbmodernidbobjectstoredeletefailureshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures.html (0 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures.html                                (rev 0)
+++ trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures.html        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -0,0 +1,120 @@
</span><ins>+This tests some obvious failures that can happen while calling IDBObjectStore.delete().&lt;br&gt;
+&lt;div id=&quot;logger&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+}
+
+function log(message)
+{
+    document.getElementById(&quot;logger&quot;).innerHTML += message + &quot;&lt;br&gt;&quot;;
+}
+
+function done()
+{
+    log(&quot;Done&quot;);
+    if (window.testRunner)
+        testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open(&quot;IDBObjectStoreDeleteFailuresDatabase&quot;, 1);
+var database;
+
+createRequest.onupgradeneeded = function(event) {
+    log(&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;);
+    var request = objectStore.put(&quot;bar&quot;, &quot;foo&quot;);
+
+    request.onsuccess = function() {
+        try {
+            objectStore.delete(NaN);
+        } catch(e) {
+            log(&quot;Failed to delete record from object store with an invalid key&quot;);
+        }
+        
+        database.deleteObjectStore(&quot;TestObjectStore&quot;);
+        
+        try {
+            objectStore.delete(&quot;foo&quot;);
+        } catch(e) {
+            log(&quot;Failed to delete record from object store that has been deleted&quot;);
+        } 
+
+        // Recreate the objectstore because we'll need it in phase 2.
+        var objectStore = database.createObjectStore(&quot;TestObjectStore&quot;);
+        objectStore.put(&quot;bar&quot;, &quot;foo&quot;);    
+    }
+    
+    versionTransaction.onabort = function(event) {
+        log(&quot;Initial upgrade versionchange transaction unexpected aborted&quot;);
+        done();
+    }
+
+    versionTransaction.oncomplete = function(event) {
+        log(&quot;Initial upgrade versionchange transaction complete&quot;);
+        continueTest1();
+    }
+
+    versionTransaction.onerror = function(event) {
+        log(&quot;Initial upgrade versionchange transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
+function continueTest1()
+{
+    var transaction = database.transaction(&quot;TestObjectStore&quot;, &quot;readonly&quot;);
+    var objectStore = transaction.objectStore(&quot;TestObjectStore&quot;);
+    
+    try {
+        objectStore.delete(&quot;foo&quot;);
+    } catch(e) {
+        log(&quot;Failed to delete a record in read-only transaction&quot;);
+    }
+    
+    var transaction = database.transaction(&quot;TestObjectStore&quot;, &quot;readwrite&quot;);
+    var objectStore = transaction.objectStore(&quot;TestObjectStore&quot;);
+
+    // Spin the transaction with get requests to keep it alive long enough for the setTimeout to fire.
+    var canFinish = false;
+    var spinGet = function() { 
+        objectStore.get(&quot;foo&quot;).onsuccess = function() {
+            if (!canFinish)
+                spinGet();
+        }
+    }
+    spinGet();
+
+    var testWhileInactive = function() {
+        try {
+            objectStore.delete(&quot;foo&quot;);
+        } catch(e) {
+            log(&quot;Failed to delete record with inactive transaction&quot;);
+        }
+        canFinish = true;
+    }
+    
+    setTimeout(testWhileInactive, 0);
+    
+    transaction.onabort = function(event) {
+        log(&quot;readwrite transaction unexpected abort&quot; + event);
+        done();
+    }
+
+    transaction.oncomplete = function(event) {
+        log(&quot;readwrite transaction complete&quot;);
+        done();
+    }
+
+    transaction.onerror = function(event) {
+        log(&quot;readwrite transaction unexpected error&quot; + event);
+        done();
+    }
+}
+
+&lt;/script&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/ChangeLog        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -1,3 +1,75 @@
</span><ins>+2015-11-02  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Modern IDB: IBDObjectStore.delete() support.
+        https://bugs.webkit.org/show_bug.cgi?id=150784
+
+        Reviewed by Alex Christensen.
+
+        Tests: storage/indexeddb/modern/idbobjectstore-delete-1.html
+               storage/indexeddb/modern/idbobjectstore-delete-2.html
+               storage/indexeddb/modern/idbobjectstore-delete-failures.html
+
+        * Modules/indexeddb/IDBKeyRangeData.cpp:
+        (WebCore::IDBKeyRangeData::isValid):
+        * Modules/indexeddb/IDBKeyRangeData.h:
+        
+        * Modules/indexeddb/client/IDBConnectionToServer.cpp:
+        (WebCore::IDBClient::IDBConnectionToServer::deleteRecord):
+        (WebCore::IDBClient::IDBConnectionToServer::didDeleteRecord):
+        * Modules/indexeddb/client/IDBConnectionToServer.h:
+        * Modules/indexeddb/client/IDBConnectionToServerDelegate.h:
+        
+        * Modules/indexeddb/client/IDBObjectStoreImpl.cpp:
+        (WebCore::IDBClient::IDBObjectStore::get):
+        (WebCore::IDBClient::IDBObjectStore::deleteFunction):
+        
+        * Modules/indexeddb/client/IDBTransactionImpl.cpp:
+        (WebCore::IDBClient::IDBTransaction::requestDeleteRecord):
+        (WebCore::IDBClient::IDBTransaction::deleteRecordOnServer):
+        (WebCore::IDBClient::IDBTransaction::didDeleteRecordOnServer):
+        * Modules/indexeddb/client/IDBTransactionImpl.h:
+        
+        * Modules/indexeddb/server/IDBBackingStore.h:
+        
+        * Modules/indexeddb/server/IDBConnectionToClient.cpp:
+        (WebCore::IDBServer::IDBConnectionToClient::didDeleteRecord):
+        * Modules/indexeddb/server/IDBConnectionToClient.h:
+        * Modules/indexeddb/server/IDBConnectionToClientDelegate.h:
+        
+        * Modules/indexeddb/server/IDBServer.cpp:
+        (WebCore::IDBServer::IDBServer::deleteRecord):
+        * Modules/indexeddb/server/IDBServer.h:
+        
+        * Modules/indexeddb/server/MemoryIDBBackingStore.cpp:
+        (WebCore::IDBServer::MemoryIDBBackingStore::deleteRange):
+        (WebCore::IDBServer::MemoryIDBBackingStore::deleteRecord): Deleted.
+        * Modules/indexeddb/server/MemoryIDBBackingStore.h:
+        
+        * Modules/indexeddb/server/MemoryObjectStore.cpp:
+        (WebCore::IDBServer::MemoryObjectStore::deleteRange):
+        * Modules/indexeddb/server/MemoryObjectStore.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabase.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabase::performPutOrAdd):
+        (WebCore::IDBServer::UniqueIDBDatabase::deleteRecord):
+        (WebCore::IDBServer::UniqueIDBDatabase::performDeleteRecord):
+        (WebCore::IDBServer::UniqueIDBDatabase::didPerformDeleteRecord):
+        * Modules/indexeddb/server/UniqueIDBDatabase.h:
+        
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp:
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::getCount):
+        (WebCore::IDBServer::UniqueIDBDatabaseTransaction::deleteRecord):
+        * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h:
+        
+        * Modules/indexeddb/shared/IDBResultData.cpp:
+        (WebCore::IDBResultData::deleteRecordSuccess):
+        * Modules/indexeddb/shared/IDBResultData.h:
+        
+        * Modules/indexeddb/shared/InProcessIDBServer.cpp:
+        (WebCore::InProcessIDBServer::didDeleteRecord):
+        (WebCore::InProcessIDBServer::deleteRecord):
+        * Modules/indexeddb/shared/InProcessIDBServer.h:
+
</ins><span class="cx"> 2015-11-02  Andy Estes  &lt;aestes@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the iOS build again.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBKeyRangeDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -79,6 +79,20 @@
</span><span class="cx">     return !lowerKey.compare(upperKey);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool IDBKeyRangeData::isValid() const
+{
+    if (isNull)
+        return false;
+
+    if (!lowerKey.isValid() &amp;&amp; !lowerKey.isNull())
+        return false;
+
+    if (!upperKey.isValid() &amp;&amp; !upperKey.isNull())
+        return false;
+
+    return true;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(INDEXED_DATABASE)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbIDBKeyRangeDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx">     WEBCORE_EXPORT PassRefPtr&lt;IDBKeyRange&gt; maybeCreateIDBKeyRange() const;
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT bool isExactlyOneKey() const;
</span><ins>+    bool isValid() const;
</ins><span class="cx"> 
</span><span class="cx">     template&lt;class Encoder&gt; void encode(Encoder&amp;) const;
</span><span class="cx">     template&lt;class Decoder&gt; static bool decode(Decoder&amp;, IDBKeyRangeData&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -186,6 +186,22 @@
</span><span class="cx">     completeOperation(resultData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBConnectionToServer::deleteRecord(TransactionOperation&amp; operation, const IDBKeyRangeData&amp; keyRangeData)
+{
+    LOG(IndexedDB, &quot;IDBConnectionToServer::deleteRecord&quot;);
+
+    ASSERT(!keyRangeData.isNull);
+
+    saveOperation(operation);
+    m_delegate-&gt;deleteRecord(IDBRequestData(operation), keyRangeData);
+}
+
+void IDBConnectionToServer::didDeleteRecord(const IDBResultData&amp; resultData)
+{
+    LOG(IndexedDB, &quot;IDBConnectionToServer::didDeleteRecord&quot;);
+    completeOperation(resultData);
+}
+
</ins><span class="cx"> void IDBConnectionToServer::establishTransaction(IDBTransaction&amp; transaction)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBConnectionToServer::establishTransaction&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -79,6 +79,9 @@
</span><span class="cx">     void getCount(TransactionOperation&amp;, const IDBKeyRangeData&amp;);
</span><span class="cx">     void didGetCount(const IDBResultData&amp;);
</span><span class="cx"> 
</span><ins>+    void deleteRecord(TransactionOperation&amp;, const IDBKeyRangeData&amp;);
+    void didDeleteRecord(const IDBResultData&amp;);
+
</ins><span class="cx">     void commitTransaction(IDBTransaction&amp;);
</span><span class="cx">     void didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBConnectionToServerDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx">     virtual void putOrAdd(const IDBRequestData&amp;, IDBKey*, SerializedScriptValue&amp;, const IndexedDB::ObjectStoreOverwriteMode) = 0;
</span><span class="cx">     virtual void getRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;) = 0;
</span><span class="cx">     virtual void getCount(const IDBRequestData&amp;, const IDBKeyRangeData&amp;) = 0;
</span><ins>+    virtual void deleteRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;) = 0;
</ins><span class="cx">     virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&amp;) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBObjectStoreImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -162,9 +162,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     IDBKeyRangeData keyRangeData(keyRange);
</span><del>-    if (keyRangeData.isNull
-        || (!keyRangeData.lowerKey.isValid() &amp;&amp; !keyRangeData.lowerKey.isNull())
-        || (!keyRangeData.upperKey.isValid() &amp;&amp; !keyRangeData.upperKey.isNull())) {
</del><ins>+    if (!keyRangeData.isValid()) {
</ins><span class="cx">         ec = static_cast&lt;ExceptionCode&gt;(IDBExceptionCode::DataError);
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="lines">@@ -277,14 +275,45 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::deleteFunction(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&amp;)
</del><ins>+RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::deleteFunction(ScriptExecutionContext* context, IDBKeyRange* keyRange, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><del>-    RELEASE_ASSERT_NOT_REACHED();
</del><ins>+    LOG(IndexedDB, &quot;IDBObjectStore::deleteFunction&quot;);
+
+    if (m_transaction-&gt;isReadOnly()) {
+        ec = static_cast&lt;ExceptionCode&gt;(IDBExceptionCode::ReadOnlyError);
+        return nullptr;
+    }
+
+    if (!m_transaction-&gt;isActive()) {
+        ec = static_cast&lt;ExceptionCode&gt;(IDBExceptionCode::TransactionInactiveError);
+        return nullptr;
+    }
+
+    if (m_deleted) {
+        ec = INVALID_STATE_ERR;
+        return nullptr;
+    }
+
+    IDBKeyRangeData keyRangeData(keyRange);
+    if (!keyRangeData.isValid()) {
+        ec = static_cast&lt;ExceptionCode&gt;(IDBExceptionCode::DataError);
+        return nullptr;
+    }
+
+    Ref&lt;IDBRequest&gt; request = m_transaction-&gt;requestDeleteRecord(*context, *this, keyRangeData);
+    return WTF::move(request);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::deleteFunction(ScriptExecutionContext*, const Deprecated::ScriptValue&amp;, ExceptionCode&amp;)
</del><ins>+RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::deleteFunction(ScriptExecutionContext* context, const Deprecated::ScriptValue&amp; key, ExceptionCode&amp; ec)
</ins><span class="cx"> {
</span><del>-    RELEASE_ASSERT_NOT_REACHED();
</del><ins>+    DOMRequestState requestState(context);
+    RefPtr&lt;IDBKey&gt; idbKey = scriptValueToIDBKey(&amp;requestState, key);
+    if (!idbKey || idbKey-&gt;type() == KeyType::Invalid) {
+        ec = static_cast&lt;ExceptionCode&gt;(IDBExceptionCode::DataError);
+        return nullptr;
+    }
+
+    return deleteFunction(context, &amp;IDBKeyRange::create(idbKey.get()).get(), ec);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> RefPtr&lt;WebCore::IDBRequest&gt; IDBObjectStore::clear(ScriptExecutionContext* context, ExceptionCode&amp; ec)
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -460,6 +460,34 @@
</span><span class="cx">     request.requestCompleted(resultData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Ref&lt;IDBRequest&gt; IDBTransaction::requestDeleteRecord(ScriptExecutionContext&amp; context, IDBObjectStore&amp; objectStore, const IDBKeyRangeData&amp; range)
+{
+    LOG(IndexedDB, &quot;IDBTransaction::requestDeleteRecord&quot;);
+    ASSERT(isActive());
+    ASSERT(!range.isNull);
+
+    Ref&lt;IDBRequest&gt; request = IDBRequest::create(context, objectStore, *this);
+    addRequest(request.get());
+
+    scheduleOperation(createTransactionOperation(*this, request.get(), &amp;IDBTransaction::didDeleteRecordOnServer, &amp;IDBTransaction::deleteRecordOnServer, range));
+    return request;
+}
+
+void IDBTransaction::deleteRecordOnServer(TransactionOperation&amp; operation, const IDBKeyRangeData&amp; keyRange)
+{
+    LOG(IndexedDB, &quot;IDBTransaction::deleteRecordOnServer&quot;);
+
+    serverConnection().deleteRecord(operation, keyRange);
+}
+
+void IDBTransaction::didDeleteRecordOnServer(IDBRequest&amp; request, const IDBResultData&amp; resultData)
+{
+    LOG(IndexedDB, &quot;IDBTransaction::didDeleteRecordOnServer&quot;);
+
+    request.setResultToUndefined();
+    request.requestCompleted(resultData);
+}
+
</ins><span class="cx"> Ref&lt;IDBRequest&gt; IDBTransaction::requestClearObjectStore(ScriptExecutionContext&amp; context, IDBObjectStore&amp; objectStore)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBTransaction::requestClearObjectStore&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbclientIDBTransactionImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -91,6 +91,7 @@
</span><span class="cx"> 
</span><span class="cx">     Ref&lt;IDBRequest&gt; requestPutOrAdd(ScriptExecutionContext&amp;, IDBObjectStore&amp;, IDBKey*, SerializedScriptValue&amp;, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx">     Ref&lt;IDBRequest&gt; requestGetRecord(ScriptExecutionContext&amp;, IDBObjectStore&amp;, const IDBKeyRangeData&amp;);
</span><ins>+    Ref&lt;IDBRequest&gt; requestDeleteRecord(ScriptExecutionContext&amp;, IDBObjectStore&amp;, const IDBKeyRangeData&amp;);
</ins><span class="cx">     Ref&lt;IDBRequest&gt; requestClearObjectStore(ScriptExecutionContext&amp;, IDBObjectStore&amp;);
</span><span class="cx">     Ref&lt;IDBRequest&gt; requestCount(ScriptExecutionContext&amp;, IDBObjectStore&amp;, const IDBKeyRangeData&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -140,6 +141,9 @@
</span><span class="cx">     void getCountOnServer(TransactionOperation&amp;, const IDBKeyRangeData&amp;);
</span><span class="cx">     void didGetCountOnServer(IDBRequest&amp;, const IDBResultData&amp;);
</span><span class="cx"> 
</span><ins>+    void deleteRecordOnServer(TransactionOperation&amp;, const IDBKeyRangeData&amp;);
+    void didDeleteRecordOnServer(IDBRequest&amp;, const IDBResultData&amp;);
+
</ins><span class="cx">     void deleteObjectStoreOnServer(TransactionOperation&amp;, const String&amp; objectStoreName);
</span><span class="cx">     void didDeleteObjectStoreOnServer(const IDBResultData&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     virtual IDBError deleteObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, const String&amp; objectStoreName) = 0;
</span><span class="cx">     virtual IDBError clearObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
</span><span class="cx">     virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp;, bool&amp; keyExists) = 0;
</span><del>-    virtual IDBError deleteRecord(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp;) = 0;
</del><ins>+    virtual IDBError deleteRange(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;) = 0;
</ins><span class="cx">     virtual IDBError putRecord(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; value) = 0;
</span><span class="cx">     virtual IDBError getRecord(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;, ThreadSafeDataBuffer&amp; outValue) = 0;
</span><span class="cx">     virtual IDBError getCount(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;, uint64_t&amp; outCount) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -93,6 +93,11 @@
</span><span class="cx">     m_delegate-&gt;didGetCount(result);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBConnectionToClient::didDeleteRecord(const IDBResultData&amp; result)
+{
+    m_delegate-&gt;didDeleteRecord(result);
+}
+
</ins><span class="cx"> void IDBConnectionToClient::didCommitTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp; error)
</span><span class="cx"> {
</span><span class="cx">     m_delegate-&gt;didCommitTransaction(transactionIdentifier, error);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx">     void didPutOrAdd(const IDBResultData&amp;);
</span><span class="cx">     void didGetRecord(const IDBResultData&amp;);
</span><span class="cx">     void didGetCount(const IDBResultData&amp;);
</span><ins>+    void didDeleteRecord(const IDBResultData&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void fireVersionChangeEvent(UniqueIDBDatabaseConnection&amp;, uint64_t requestedVersion);
</span><span class="cx">     void didStartTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBConnectionToClientDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx">     virtual void didPutOrAdd(const IDBResultData&amp;) = 0;
</span><span class="cx">     virtual void didGetRecord(const IDBResultData&amp;) = 0;
</span><span class="cx">     virtual void didGetCount(const IDBResultData&amp;) = 0;
</span><ins>+    virtual void didDeleteRecord(const IDBResultData&amp;) = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void fireVersionChangeEvent(UniqueIDBDatabaseConnection&amp;, uint64_t requestedVersion) = 0;
</span><span class="cx">     virtual void didStartTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -224,6 +224,17 @@
</span><span class="cx">     transaction-&gt;getCount(requestData, keyRangeData);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void IDBServer::deleteRecord(const IDBRequestData&amp; requestData, const IDBKeyRangeData&amp; keyRangeData)
+{
+    LOG(IndexedDB, &quot;IDBServer::deleteRecord&quot;);
+
+    auto transaction = m_transactions.get(requestData.transactionIdentifier());
+    if (!transaction)
+        return;
+
+    transaction-&gt;deleteRecord(requestData, keyRangeData);
+}
+
</ins><span class="cx"> void IDBServer::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&amp; info)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;IDBServer::establishTransaction&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx">     void putOrAdd(const IDBRequestData&amp;, const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx">     void getRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;);
</span><span class="cx">     void getCount(const IDBRequestData&amp;, const IDBKeyRangeData&amp;);
</span><ins>+    void deleteRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;);
</ins><span class="cx">     void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&amp;);
</span><span class="cx">     void databaseConnectionClosed(uint64_t databaseConnectionIdentifier);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(INDEXED_DATABASE)
</span><span class="cx"> 
</span><ins>+#include &quot;IDBKeyRangeData.h&quot;
</ins><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;MemoryObjectStore.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -210,17 +211,20 @@
</span><span class="cx">     return IDBError();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IDBError MemoryIDBBackingStore::deleteRecord(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp; keyData)
</del><ins>+IDBError MemoryIDBBackingStore::deleteRange(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp; range)
</ins><span class="cx"> {
</span><del>-    LOG(IndexedDB, &quot;MemoryIDBBackingStore::deleteRecord&quot;);
</del><ins>+    LOG(IndexedDB, &quot;MemoryIDBBackingStore::deleteRange&quot;);
</ins><span class="cx"> 
</span><span class="cx">     ASSERT(objectStoreIdentifier);
</span><span class="cx"> 
</span><ins>+    if (!m_transactions.contains(transactionIdentifier))
+        return IDBError(IDBExceptionCode::Unknown, WTF::ASCIILiteral(&quot;No backing store transaction found to delete from&quot;));
+
</ins><span class="cx">     MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
</span><del>-    RELEASE_ASSERT(objectStore);
-    RELEASE_ASSERT(m_transactions.contains(transactionIdentifier));
</del><ins>+    if (!objectStore)
+        return IDBError(IDBExceptionCode::Unknown, WTF::ASCIILiteral(&quot;No backing store object store found&quot;));
</ins><span class="cx"> 
</span><del>-    objectStore-&gt;deleteRecord(keyData);
</del><ins>+    objectStore-&gt;deleteRange(range);
</ins><span class="cx">     return IDBError();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryIDBBackingStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx">     virtual IDBError deleteObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, const String&amp; objectStoreName) override final;
</span><span class="cx">     virtual IDBError clearObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier) override final;
</span><span class="cx">     virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp;, bool&amp; keyExists) override final;
</span><del>-    virtual IDBError deleteRecord(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp;) override final;
</del><ins>+    virtual IDBError deleteRange(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;) override final;
</ins><span class="cx">     virtual IDBError putRecord(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; value) override final;
</span><span class="cx">     virtual IDBError getRecord(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;, ThreadSafeDataBuffer&amp; outValue) override final;
</span><span class="cx">     virtual IDBError getCount(const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;, uint64_t&amp; outCount) override final;
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -106,6 +106,30 @@
</span><span class="cx">     m_orderedKeys-&gt;erase(key);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void MemoryObjectStore::deleteRange(const IDBKeyRangeData&amp; inputRange)
+{
+    LOG(IndexedDB, &quot;MemoryObjectStore::deleteRange&quot;);
+
+    ASSERT(m_writeTransaction);
+
+    if (inputRange.isExactlyOneKey()) {
+        deleteRecord(inputRange.lowerKey);
+        return;
+    }
+
+    IDBKeyRangeData range = inputRange;
+    while (true) {
+        auto key = lowestKeyWithRecordInRange(range);
+        if (key.isNull())
+            break;
+
+        deleteRecord(key);
+
+        range.lowerKey = key;
+        range.lowerOpen = true;
+    }
+}
+
</ins><span class="cx"> void MemoryObjectStore::putRecord(MemoryBackingStoreTransaction&amp; transaction, const IDBKeyData&amp; keyData, const ThreadSafeDataBuffer&amp; value)
</span><span class="cx"> {
</span><span class="cx">     LOG(IndexedDB, &quot;MemoryObjectStore::putRecord&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverMemoryObjectStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -58,6 +58,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool containsRecord(const IDBKeyData&amp;);
</span><span class="cx">     void deleteRecord(const IDBKeyData&amp;);
</span><ins>+    void deleteRange(const IDBKeyRangeData&amp;);
</ins><span class="cx">     void putRecord(MemoryBackingStoreTransaction&amp;, const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; value);
</span><span class="cx"> 
</span><span class="cx">     void setKeyValue(const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; value);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -392,7 +392,7 @@
</span><span class="cx">     // ...If a record already exists in store ...
</span><span class="cx">     // then remove the record from store using the steps for deleting records from an object store...
</span><span class="cx">     // This is important because formally deleting it from from the object store also removes it from the appropriate indexes.
</span><del>-    error = m_backingStore-&gt;deleteRecord(transactionIdentifier, objectStoreIdentifier, usedKey);
</del><ins>+    error = m_backingStore-&gt;deleteRange(transactionIdentifier, objectStoreIdentifier, usedKey);
</ins><span class="cx">     if (!error.isNull()) {
</span><span class="cx">         m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
</span><span class="cx">         return;
</span><span class="lines">@@ -473,6 +473,33 @@
</span><span class="cx">     performCountCallback(callbackIdentifier, error, count);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UniqueIDBDatabase::deleteRecord(const IDBRequestData&amp; requestData, const IDBKeyRangeData&amp; keyRangeData, ErrorCallback callback)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::deleteRecord&quot;);
+
+    uint64_t callbackID = storeCallback(callback);
+    m_server.postDatabaseTask(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::performDeleteRecord, callbackID, requestData.transactionIdentifier(), requestData.objectStoreIdentifier(), keyRangeData));
+}
+
+void UniqueIDBDatabase::performDeleteRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp; range)
+{
+    ASSERT(!isMainThread());
+    LOG(IndexedDB, &quot;(db) UniqueIDBDatabase::performDeleteRecord&quot;);
+
+    IDBError error = m_backingStore-&gt;deleteRange(transactionIdentifier, objectStoreIdentifier, range);
+
+    m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &amp;UniqueIDBDatabase::didPerformDeleteRecord, callbackIdentifier, error));
+}
+
+void UniqueIDBDatabase::didPerformDeleteRecord(uint64_t callbackIdentifier, const IDBError&amp; error)
+{
+    ASSERT(isMainThread());
+    LOG(IndexedDB, &quot;(main) UniqueIDBDatabase::didPerformDeleteRecord&quot;);
+
+    performErrorCallback(callbackIdentifier, error);
+}
+
</ins><span class="cx"> void UniqueIDBDatabase::commitTransaction(UniqueIDBDatabaseTransaction&amp; transaction, ErrorCallback callback)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx">     void putOrAdd(const IDBRequestData&amp;, const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; valueData, IndexedDB::ObjectStoreOverwriteMode, KeyDataCallback);
</span><span class="cx">     void getRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;, ValueDataCallback);
</span><span class="cx">     void getCount(const IDBRequestData&amp;, const IDBKeyRangeData&amp;, CountCallback);
</span><ins>+    void deleteRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;, ErrorCallback);
</ins><span class="cx">     void commitTransaction(UniqueIDBDatabaseTransaction&amp;, ErrorCallback);
</span><span class="cx">     void abortTransaction(UniqueIDBDatabaseTransaction&amp;, ErrorCallback);
</span><span class="cx">     void transactionDestroyed(UniqueIDBDatabaseTransaction&amp;);
</span><span class="lines">@@ -107,6 +108,7 @@
</span><span class="cx">     void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx">     void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;);
</span><span class="cx">     void performGetCount(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;);
</span><ins>+    void performDeleteRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier&amp; transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&amp;);
</ins><span class="cx">     void performActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBTransactionInfo&amp;);
</span><span class="cx"> 
</span><span class="cx">     // Main thread callbacks
</span><span class="lines">@@ -117,6 +119,7 @@
</span><span class="cx">     void didPerformPutOrAdd(uint64_t callbackIdentifier, const IDBError&amp;, const IDBKeyData&amp;);
</span><span class="cx">     void didPerformGetRecord(uint64_t callbackIdentifier, const IDBError&amp;, const ThreadSafeDataBuffer&amp;);
</span><span class="cx">     void didPerformGetCount(uint64_t callbackIdentifier, const IDBError&amp;, uint64_t);
</span><ins>+    void didPerformDeleteRecord(uint64_t callbackIdentifier, const IDBError&amp;);
</ins><span class="cx">     void didPerformCommitTransaction(uint64_t callbackIdentifier, const IDBError&amp;, const IDBResourceIdentifier&amp; transactionIdentifier);
</span><span class="cx">     void didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError&amp;, const IDBResourceIdentifier&amp; transactionIdentifier);
</span><span class="cx">     void didPerformActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBError&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -198,6 +198,23 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void UniqueIDBDatabaseTransaction::deleteRecord(const IDBRequestData&amp; requestData, const IDBKeyRangeData&amp; keyRangeData)
+{
+    LOG(IndexedDB, &quot;UniqueIDBDatabaseTransaction::deleteRecord&quot;);
+
+    ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier());
+
+    RefPtr&lt;UniqueIDBDatabaseTransaction&gt; protectedThis(this);
+    m_databaseConnection-&gt;database().deleteRecord(requestData, keyRangeData, [this, protectedThis, requestData](const IDBError&amp; error) {
+        LOG(IndexedDB, &quot;UniqueIDBDatabaseTransaction::deleteRecord (callback)&quot;);
+
+        if (error.isNull())
+            m_databaseConnection-&gt;connectionToClient().didDeleteRecord(IDBResultData::deleteRecordSuccess(requestData.requestIdentifier()));
+        else
+            m_databaseConnection-&gt;connectionToClient().didDeleteRecord(IDBResultData::error(requestData.requestIdentifier(), error));
+    });
+}
+
</ins><span class="cx"> const Vector&lt;uint64_t&gt;&amp; UniqueIDBDatabaseTransaction::objectStoreIdentifiers()
</span><span class="cx"> {
</span><span class="cx">     if (!m_objectStoreIdentifiers.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbserverUniqueIDBDatabaseTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -70,6 +70,7 @@
</span><span class="cx">     void putOrAdd(const IDBRequestData&amp;, const IDBKeyData&amp;, const ThreadSafeDataBuffer&amp; valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx">     void getRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;);
</span><span class="cx">     void getCount(const IDBRequestData&amp;, const IDBKeyRangeData&amp;);
</span><ins>+    void deleteRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void didActivateInBackingStore(const IDBError&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResultDatacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -125,6 +125,11 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+IDBResultData IDBResultData::deleteRecordSuccess(const IDBResourceIdentifier&amp; requestIdentifier)
+{
+    return { IDBResultType::DeleteRecordSuccess, requestIdentifier };
+}
+
</ins><span class="cx"> const IDBDatabaseInfo&amp; IDBResultData::databaseInfo() const
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(m_databaseInfo);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedIDBResultDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx">     PutOrAddSuccess,
</span><span class="cx">     GetRecordSuccess,
</span><span class="cx">     GetCountSuccess,
</span><ins>+    DeleteRecordSuccess,
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> namespace IDBServer {
</span><span class="lines">@@ -68,6 +69,7 @@
</span><span class="cx">     static IDBResultData putOrAddSuccess(const IDBResourceIdentifier&amp;, const IDBKeyData&amp;);
</span><span class="cx">     static IDBResultData getRecordSuccess(const IDBResourceIdentifier&amp;, const ThreadSafeDataBuffer&amp; valueData);
</span><span class="cx">     static IDBResultData getCountSuccess(const IDBResourceIdentifier&amp;, uint64_t count);
</span><ins>+    static IDBResultData deleteRecordSuccess(const IDBResourceIdentifier&amp;);
</ins><span class="cx"> 
</span><span class="cx">     IDBResultData(const IDBResultData&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -167,6 +167,14 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InProcessIDBServer::didDeleteRecord(const IDBResultData&amp; resultData)
+{
+    RefPtr&lt;InProcessIDBServer&gt; self(this);
+    RunLoop::current().dispatch([this, self, resultData] {
+        m_connectionToServer-&gt;didDeleteRecord(resultData);
+    });
+}
+
</ins><span class="cx"> void InProcessIDBServer::abortTransaction(IDBResourceIdentifier&amp; resourceIdentifier)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InProcessIDBServer&gt; self(this);
</span><span class="lines">@@ -234,6 +242,16 @@
</span><span class="cx">         m_server-&gt;getCount(requestData, keyRangeData);
</span><span class="cx">     });
</span><span class="cx"> }
</span><ins>+
+void InProcessIDBServer::deleteRecord(const IDBRequestData&amp; requestData, const IDBKeyRangeData&amp; keyRangeData)
+{
+    RefPtr&lt;InProcessIDBServer&gt; self(this);
+
+    RunLoop::current().dispatch([this, self, requestData, keyRangeData] {
+        m_server-&gt;deleteRecord(requestData, keyRangeData);
+    });
+}
+
</ins><span class="cx"> void InProcessIDBServer::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&amp; info)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;InProcessIDBServer&gt; self(this);
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesindexeddbsharedInProcessIDBServerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (191927 => 191928)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h        2015-11-03 01:06:53 UTC (rev 191928)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx">     virtual void putOrAdd(const IDBRequestData&amp;, IDBKey*, SerializedScriptValue&amp;, const IndexedDB::ObjectStoreOverwriteMode) override final;
</span><span class="cx">     virtual void getRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;) override final;
</span><span class="cx">     virtual void getCount(const IDBRequestData&amp;, const IDBKeyRangeData&amp;) override final;
</span><ins>+    virtual void deleteRecord(const IDBRequestData&amp;, const IDBKeyRangeData&amp;) override final;
</ins><span class="cx">     virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&amp;) override final;
</span><span class="cx">     virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) override final;
</span><span class="cx"> 
</span><span class="lines">@@ -79,6 +80,7 @@
</span><span class="cx">     virtual void didPutOrAdd(const IDBResultData&amp;) override final;
</span><span class="cx">     virtual void didGetRecord(const IDBResultData&amp;) override final;
</span><span class="cx">     virtual void didGetCount(const IDBResultData&amp;) override final;
</span><ins>+    virtual void didDeleteRecord(const IDBResultData&amp;) override final;
</ins><span class="cx">     virtual void fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection&amp;, uint64_t requestedVersion) override final;
</span><span class="cx">     virtual void didStartTransaction(const IDBResourceIdentifier&amp; transactionIdentifier, const IDBError&amp;) override final;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>