<!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 <beidson@apple.com>
+
+ 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 <ryanhaddad@apple.com>
</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 "Mon Jan 03 2000 16:00:00 GMT-0800 (PST)", and there should now be 1 less things total.
+Count is 112
+Deleted "Mon Jan 03 2000 16:00:00 GMT-0800 (PST)", and there should now be 0 less things total.
+Count is 112
+Deleted "balyhoo", and there should now be 0 less things total.
+Count is 112
+Deleted "[object IDBKeyRange]", and there should now be 0 less things total.
+Count is 112
+Deleted "[object IDBKeyRange]", and there should now be 1 less things total.
+Count is 111
+Deleted "[object IDBKeyRange]", and there should now be 1 less things total.
+Count is 110
+Deleted "[object IDBKeyRange]", and there should now be 5 less things total.
+Count is 105
+Deleted "[object IDBKeyRange]", and there should now be 98 less things total.
+Count is 7
+Deleted "[object IDBKeyRange]", 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()<br>
+<div id="logger"></div>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function log(message)
+{
+ document.getElementById("logger").innerHTML += message + "<br>";
+}
+
+function logCount()
+{
+ var req = objectStore.count();
+ req.onsuccess = function() {
+ log("Count is " + req.result);
+ }
+}
+
+function done()
+{
+ log("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open("IDBObjectStoreDelete1Database", 1);
+var database;
+var objectStore;
+
+var date1 = new Date("1999-12-28T23:00:00");
+var date2 = new Date("1999-12-29T23:00:00");
+var date3 = new Date("1999-12-30T23:00:00");
+var date4 = new Date("1999-12-31T23:00:00");
+var date5 = new Date("2000-01-01T00:00:00");
+var date6 = new Date("2000-01-02T00:00:00");
+var date7 = new Date("2000-01-03T00:00:00");
+var date8 = new Date("2000-01-04T00:00:00");
+
+createRequest.onupgradeneeded = function(event) {
+ log("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var versionTransaction = createRequest.transaction;
+ database = event.target.result;
+ objectStore = database.createObjectStore("TestObjectStore");
+
+ // Just for the heck of it.
+ objectStore.delete("foo");
+ objectStore.put("boo", "foo");
+ objectStore.delete("foo");
+
+ objectStore.put("boo", "foo");
+ objectStore.put("bop", "fop");
+ objectStore.put("boq", "foq");
+ objectStore.put("bor", "for");
+ objectStore.put("bos", "fos");
+
+ for (var i = 0; i < 100; ++i)
+ objectStore.put("number " + i, i);
+
+ objectStore.put("date 1", date1);
+ objectStore.put("date 2", date2);
+ objectStore.put("date 3", date3);
+ objectStore.put("date 4", date4);
+ objectStore.put("date 5", date5);
+ objectStore.put("date 6", date6);
+ objectStore.put("date 7", date7);
+ objectStore.put("date 8", date8);
+
+ logCount();
+
+ versionTransaction.onabort = function(event) {
+ log("Initial upgrade versionchange transaction unexpected abort");
+ done();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ log("Initial upgrade versionchange transaction complete");
+ continueTest1();
+ }
+
+ versionTransaction.onerror = function(event) {
+ log("Initial upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+}
+
+function continueTest1()
+{
+ var transaction = database.transaction("TestObjectStore", "readwrite");
+ objectStore = transaction.objectStore("TestObjectStore");
+
+ // 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,
+ "balyhoo", 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("foo", "fos", true, true), 3
+ ];
+ var currentThing = 0;
+
+ var runDeleteTests = function()
+ {
+ if (!thingsToDelete[currentThing])
+ return;
+
+ objectStore.delete(thingsToDelete[currentThing]).onsuccess = function() {
+ log("Deleted \"" + thingsToDelete[currentThing] + "\", and there should now be " + thingsToDelete[currentThing + 1] + " less things total.");
+ logCount();
+ currentThing += 2;
+ runDeleteTests();
+ }
+ }
+ runDeleteTests();
+
+ transaction.onabort = function(event) {
+ log("readwrite transaction unexpected abort" + event);
+ done();
+ }
+
+ transaction.oncomplete = function(event) {
+ log("readwrite transaction complete");
+ done();
+ }
+
+ transaction.onerror = function(event) {
+ log("readwrite transaction unexpected error" + event);
+ done();
+ }
+}
+
+</script>
</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 "foo" has value: undefined
+readwrite transaction aborted
+Record for "foo" 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.<br>
+<div id="logger"></div>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function log(message)
+{
+ document.getElementById("logger").innerHTML += message + "<br>";
+}
+
+function logCount()
+{
+ var req = objectStore.count();
+ req.onsuccess = function() {
+ log("Count is " + req.result);
+ }
+}
+
+function done()
+{
+ log("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open("IDBObjectStoreDelete2Database", 1);
+var database;
+
+createRequest.onupgradeneeded = function(event) {
+ log("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var versionTransaction = createRequest.transaction;
+ database = event.target.result;
+ database.createObjectStore("TestObjectStore").put("bar", "foo");
+
+ versionTransaction.onabort = function(event) {
+ log("Initial upgrade versionchange transaction unexpected abort");
+ done();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ log("Initial upgrade versionchange transaction complete");
+ continueTest1();
+ }
+
+ versionTransaction.onerror = function(event) {
+ log("Initial upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+}
+
+function continueTest1()
+{
+ var transaction = database.transaction("TestObjectStore", "readwrite");
+ transaction.objectStore("TestObjectStore").delete("foo").onsuccess = function()
+ {
+ var request = transaction.objectStore("TestObjectStore").get("foo");
+ request.onsuccess = function()
+ {
+ log("After delete, record for \"foo\" has value: " + request.result);
+ transaction.abort();
+ }
+ }
+
+ transaction.onabort = function(event) {
+ log("readwrite transaction aborted");
+ continueTest2();
+ }
+
+ transaction.oncomplete = function(event) {
+ log("readwrite transaction unexpected complete");
+ done();
+ }
+
+ transaction.onerror = function(event) {
+ log("readwrite transaction unexpected error");
+ done();
+ }
+}
+
+function continueTest2()
+{
+ var transaction = database.transaction("TestObjectStore", "readonly");
+
+ var request = transaction.objectStore("TestObjectStore").get("foo");
+ request.onsuccess = function()
+ {
+ log("Record for \"foo\" has final value: " + request.result);
+ }
+
+ transaction.onabort = function(event)
+ {
+ log("readonly transaction unexpected abort");
+ done();
+ }
+
+ transaction.oncomplete = function(event)
+ {
+ log("readonly transaction complete");
+ done();
+ }
+
+ transaction.onerror = function(event)
+ {
+ log("readonly transaction unexpected error");
+ done();
+ }
+}
+
+</script>
</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().<br>
+<div id="logger"></div>
+<script>
+
+if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+}
+
+function log(message)
+{
+ document.getElementById("logger").innerHTML += message + "<br>";
+}
+
+function done()
+{
+ log("Done");
+ if (window.testRunner)
+ testRunner.notifyDone();
+}
+
+var createRequest = window.indexedDB.open("IDBObjectStoreDeleteFailuresDatabase", 1);
+var database;
+
+createRequest.onupgradeneeded = function(event) {
+ log("Initial upgrade needed: Old version - " + event.oldVersion + " New version - " + event.newVersion);
+
+ var versionTransaction = createRequest.transaction;
+ database = event.target.result;
+ var objectStore = database.createObjectStore("TestObjectStore");
+ var request = objectStore.put("bar", "foo");
+
+ request.onsuccess = function() {
+ try {
+ objectStore.delete(NaN);
+ } catch(e) {
+ log("Failed to delete record from object store with an invalid key");
+ }
+
+ database.deleteObjectStore("TestObjectStore");
+
+ try {
+ objectStore.delete("foo");
+ } catch(e) {
+ log("Failed to delete record from object store that has been deleted");
+ }
+
+ // Recreate the objectstore because we'll need it in phase 2.
+ var objectStore = database.createObjectStore("TestObjectStore");
+ objectStore.put("bar", "foo");
+ }
+
+ versionTransaction.onabort = function(event) {
+ log("Initial upgrade versionchange transaction unexpected aborted");
+ done();
+ }
+
+ versionTransaction.oncomplete = function(event) {
+ log("Initial upgrade versionchange transaction complete");
+ continueTest1();
+ }
+
+ versionTransaction.onerror = function(event) {
+ log("Initial upgrade versionchange transaction unexpected error" + event);
+ done();
+ }
+}
+
+function continueTest1()
+{
+ var transaction = database.transaction("TestObjectStore", "readonly");
+ var objectStore = transaction.objectStore("TestObjectStore");
+
+ try {
+ objectStore.delete("foo");
+ } catch(e) {
+ log("Failed to delete a record in read-only transaction");
+ }
+
+ var transaction = database.transaction("TestObjectStore", "readwrite");
+ var objectStore = transaction.objectStore("TestObjectStore");
+
+ // 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("foo").onsuccess = function() {
+ if (!canFinish)
+ spinGet();
+ }
+ }
+ spinGet();
+
+ var testWhileInactive = function() {
+ try {
+ objectStore.delete("foo");
+ } catch(e) {
+ log("Failed to delete record with inactive transaction");
+ }
+ canFinish = true;
+ }
+
+ setTimeout(testWhileInactive, 0);
+
+ transaction.onabort = function(event) {
+ log("readwrite transaction unexpected abort" + event);
+ done();
+ }
+
+ transaction.oncomplete = function(event) {
+ log("readwrite transaction complete");
+ done();
+ }
+
+ transaction.onerror = function(event) {
+ log("readwrite transaction unexpected error" + event);
+ done();
+ }
+}
+
+</script>
</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 <beidson@apple.com>
+
+ 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 <aestes@apple.com>
</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() && !lowerKey.isNull())
+ return false;
+
+ if (!upperKey.isValid() && !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<IDBKeyRange> 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<class Encoder> void encode(Encoder&) const;
</span><span class="cx"> template<class Decoder> static bool decode(Decoder&, IDBKeyRangeData&);
</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& operation, const IDBKeyRangeData& keyRangeData)
+{
+ LOG(IndexedDB, "IDBConnectionToServer::deleteRecord");
+
+ ASSERT(!keyRangeData.isNull);
+
+ saveOperation(operation);
+ m_delegate->deleteRecord(IDBRequestData(operation), keyRangeData);
+}
+
+void IDBConnectionToServer::didDeleteRecord(const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBConnectionToServer::didDeleteRecord");
+ completeOperation(resultData);
+}
+
</ins><span class="cx"> void IDBConnectionToServer::establishTransaction(IDBTransaction& transaction)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBConnectionToServer::establishTransaction");
</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&, const IDBKeyRangeData&);
</span><span class="cx"> void didGetCount(const IDBResultData&);
</span><span class="cx">
</span><ins>+ void deleteRecord(TransactionOperation&, const IDBKeyRangeData&);
+ void didDeleteRecord(const IDBResultData&);
+
</ins><span class="cx"> void commitTransaction(IDBTransaction&);
</span><span class="cx"> void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
</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&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) = 0;
</span><span class="cx"> virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) = 0;
</span><span class="cx"> virtual void getCount(const IDBRequestData&, const IDBKeyRangeData&) = 0;
</span><ins>+ virtual void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&) = 0;
</ins><span class="cx"> virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&) = 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() && !keyRangeData.lowerKey.isNull())
- || (!keyRangeData.upperKey.isValid() && !keyRangeData.upperKey.isNull())) {
</del><ins>+ if (!keyRangeData.isValid()) {
</ins><span class="cx"> ec = static_cast<ExceptionCode>(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<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&)
</del><ins>+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* context, IDBKeyRange* keyRange, ExceptionCode& ec)
</ins><span class="cx"> {
</span><del>- RELEASE_ASSERT_NOT_REACHED();
</del><ins>+ LOG(IndexedDB, "IDBObjectStore::deleteFunction");
+
+ if (m_transaction->isReadOnly()) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::ReadOnlyError);
+ return nullptr;
+ }
+
+ if (!m_transaction->isActive()) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::TransactionInactiveError);
+ return nullptr;
+ }
+
+ if (m_deleted) {
+ ec = INVALID_STATE_ERR;
+ return nullptr;
+ }
+
+ IDBKeyRangeData keyRangeData(keyRange);
+ if (!keyRangeData.isValid()) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ return nullptr;
+ }
+
+ Ref<IDBRequest> request = m_transaction->requestDeleteRecord(*context, *this, keyRangeData);
+ return WTF::move(request);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext*, const Deprecated::ScriptValue&, ExceptionCode&)
</del><ins>+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* context, const Deprecated::ScriptValue& key, ExceptionCode& ec)
</ins><span class="cx"> {
</span><del>- RELEASE_ASSERT_NOT_REACHED();
</del><ins>+ DOMRequestState requestState(context);
+ RefPtr<IDBKey> idbKey = scriptValueToIDBKey(&requestState, key);
+ if (!idbKey || idbKey->type() == KeyType::Invalid) {
+ ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
+ return nullptr;
+ }
+
+ return deleteFunction(context, &IDBKeyRange::create(idbKey.get()).get(), ec);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<WebCore::IDBRequest> IDBObjectStore::clear(ScriptExecutionContext* context, ExceptionCode& 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<IDBRequest> IDBTransaction::requestDeleteRecord(ScriptExecutionContext& context, IDBObjectStore& objectStore, const IDBKeyRangeData& range)
+{
+ LOG(IndexedDB, "IDBTransaction::requestDeleteRecord");
+ ASSERT(isActive());
+ ASSERT(!range.isNull);
+
+ Ref<IDBRequest> request = IDBRequest::create(context, objectStore, *this);
+ addRequest(request.get());
+
+ scheduleOperation(createTransactionOperation(*this, request.get(), &IDBTransaction::didDeleteRecordOnServer, &IDBTransaction::deleteRecordOnServer, range));
+ return request;
+}
+
+void IDBTransaction::deleteRecordOnServer(TransactionOperation& operation, const IDBKeyRangeData& keyRange)
+{
+ LOG(IndexedDB, "IDBTransaction::deleteRecordOnServer");
+
+ serverConnection().deleteRecord(operation, keyRange);
+}
+
+void IDBTransaction::didDeleteRecordOnServer(IDBRequest& request, const IDBResultData& resultData)
+{
+ LOG(IndexedDB, "IDBTransaction::didDeleteRecordOnServer");
+
+ request.setResultToUndefined();
+ request.requestCompleted(resultData);
+}
+
</ins><span class="cx"> Ref<IDBRequest> IDBTransaction::requestClearObjectStore(ScriptExecutionContext& context, IDBObjectStore& objectStore)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBTransaction::requestClearObjectStore");
</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<IDBRequest> requestPutOrAdd(ScriptExecutionContext&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> Ref<IDBRequest> requestGetRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
</span><ins>+ Ref<IDBRequest> requestDeleteRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
</ins><span class="cx"> Ref<IDBRequest> requestClearObjectStore(ScriptExecutionContext&, IDBObjectStore&);
</span><span class="cx"> Ref<IDBRequest> requestCount(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
</span><span class="cx">
</span><span class="lines">@@ -140,6 +141,9 @@
</span><span class="cx"> void getCountOnServer(TransactionOperation&, const IDBKeyRangeData&);
</span><span class="cx"> void didGetCountOnServer(IDBRequest&, const IDBResultData&);
</span><span class="cx">
</span><ins>+ void deleteRecordOnServer(TransactionOperation&, const IDBKeyRangeData&);
+ void didDeleteRecordOnServer(IDBRequest&, const IDBResultData&);
+
</ins><span class="cx"> void deleteObjectStoreOnServer(TransactionOperation&, const String& objectStoreName);
</span><span class="cx"> void didDeleteObjectStoreOnServer(const IDBResultData&);
</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& transactionIdentifier, const String& objectStoreName) = 0;
</span><span class="cx"> virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
</span><span class="cx"> virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0;
</span><del>- virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) = 0;
</del><ins>+ virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) = 0;
</ins><span class="cx"> virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) = 0;
</span><span class="cx"> virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) = 0;
</span><span class="cx"> virtual IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, uint64_t& 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->didGetCount(result);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBConnectionToClient::didDeleteRecord(const IDBResultData& result)
+{
+ m_delegate->didDeleteRecord(result);
+}
+
</ins><span class="cx"> void IDBConnectionToClient::didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError& error)
</span><span class="cx"> {
</span><span class="cx"> m_delegate->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&);
</span><span class="cx"> void didGetRecord(const IDBResultData&);
</span><span class="cx"> void didGetCount(const IDBResultData&);
</span><ins>+ void didDeleteRecord(const IDBResultData&);
</ins><span class="cx">
</span><span class="cx"> void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion);
</span><span class="cx"> void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
</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&) = 0;
</span><span class="cx"> virtual void didGetRecord(const IDBResultData&) = 0;
</span><span class="cx"> virtual void didGetCount(const IDBResultData&) = 0;
</span><ins>+ virtual void didDeleteRecord(const IDBResultData&) = 0;
</ins><span class="cx">
</span><span class="cx"> virtual void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion) = 0;
</span><span class="cx"> virtual void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) = 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->getCount(requestData, keyRangeData);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void IDBServer::deleteRecord(const IDBRequestData& requestData, const IDBKeyRangeData& keyRangeData)
+{
+ LOG(IndexedDB, "IDBServer::deleteRecord");
+
+ auto transaction = m_transactions.get(requestData.transactionIdentifier());
+ if (!transaction)
+ return;
+
+ transaction->deleteRecord(requestData, keyRangeData);
+}
+
</ins><span class="cx"> void IDBServer::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo& info)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "IDBServer::establishTransaction");
</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&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
</span><span class="cx"> void getCount(const IDBRequestData&, const IDBKeyRangeData&);
</span><ins>+ void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&);
</ins><span class="cx"> void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&);
</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 "IDBKeyRangeData.h"
</ins><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MemoryObjectStore.h"
</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& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData& keyData)
</del><ins>+IDBError MemoryIDBBackingStore::deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range)
</ins><span class="cx"> {
</span><del>- LOG(IndexedDB, "MemoryIDBBackingStore::deleteRecord");
</del><ins>+ LOG(IndexedDB, "MemoryIDBBackingStore::deleteRange");
</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("No backing store transaction found to delete from"));
+
</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("No backing store object store found"));
</ins><span class="cx">
</span><del>- objectStore->deleteRecord(keyData);
</del><ins>+ objectStore->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& transactionIdentifier, const String& objectStoreName) override final;
</span><span class="cx"> virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
</span><span class="cx"> virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
</span><del>- virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) override final;
</del><ins>+ virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) override final;
</ins><span class="cx"> virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) override final;
</span><span class="cx"> virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) override final;
</span><span class="cx"> virtual IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, uint64_t& 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->erase(key);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void MemoryObjectStore::deleteRange(const IDBKeyRangeData& inputRange)
+{
+ LOG(IndexedDB, "MemoryObjectStore::deleteRange");
+
+ 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& transaction, const IDBKeyData& keyData, const ThreadSafeDataBuffer& value)
</span><span class="cx"> {
</span><span class="cx"> LOG(IndexedDB, "MemoryObjectStore::putRecord");
</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&);
</span><span class="cx"> void deleteRecord(const IDBKeyData&);
</span><ins>+ void deleteRange(const IDBKeyRangeData&);
</ins><span class="cx"> void putRecord(MemoryBackingStoreTransaction&, const IDBKeyData&, const ThreadSafeDataBuffer& value);
</span><span class="cx">
</span><span class="cx"> void setKeyValue(const IDBKeyData&, const ThreadSafeDataBuffer& 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->deleteRecord(transactionIdentifier, objectStoreIdentifier, usedKey);
</del><ins>+ error = m_backingStore->deleteRange(transactionIdentifier, objectStoreIdentifier, usedKey);
</ins><span class="cx"> if (!error.isNull()) {
</span><span class="cx"> m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &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& requestData, const IDBKeyRangeData& keyRangeData, ErrorCallback callback)
+{
+ ASSERT(isMainThread());
+ LOG(IndexedDB, "(main) UniqueIDBDatabase::deleteRecord");
+
+ uint64_t callbackID = storeCallback(callback);
+ m_server.postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performDeleteRecord, callbackID, requestData.transactionIdentifier(), requestData.objectStoreIdentifier(), keyRangeData));
+}
+
+void UniqueIDBDatabase::performDeleteRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range)
+{
+ ASSERT(!isMainThread());
+ LOG(IndexedDB, "(db) UniqueIDBDatabase::performDeleteRecord");
+
+ IDBError error = m_backingStore->deleteRange(transactionIdentifier, objectStoreIdentifier, range);
+
+ m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformDeleteRecord, callbackIdentifier, error));
+}
+
+void UniqueIDBDatabase::didPerformDeleteRecord(uint64_t callbackIdentifier, const IDBError& error)
+{
+ ASSERT(isMainThread());
+ LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformDeleteRecord");
+
+ performErrorCallback(callbackIdentifier, error);
+}
+
</ins><span class="cx"> void UniqueIDBDatabase::commitTransaction(UniqueIDBDatabaseTransaction& 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&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode, KeyDataCallback);
</span><span class="cx"> void getRecord(const IDBRequestData&, const IDBKeyRangeData&, ValueDataCallback);
</span><span class="cx"> void getCount(const IDBRequestData&, const IDBKeyRangeData&, CountCallback);
</span><ins>+ void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&, ErrorCallback);
</ins><span class="cx"> void commitTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
</span><span class="cx"> void abortTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
</span><span class="cx"> void transactionDestroyed(UniqueIDBDatabaseTransaction&);
</span><span class="lines">@@ -107,6 +108,7 @@
</span><span class="cx"> void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
</span><span class="cx"> void performGetCount(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
</span><ins>+ void performDeleteRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
</ins><span class="cx"> void performActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBTransactionInfo&);
</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&, const IDBKeyData&);
</span><span class="cx"> void didPerformGetRecord(uint64_t callbackIdentifier, const IDBError&, const ThreadSafeDataBuffer&);
</span><span class="cx"> void didPerformGetCount(uint64_t callbackIdentifier, const IDBError&, uint64_t);
</span><ins>+ void didPerformDeleteRecord(uint64_t callbackIdentifier, const IDBError&);
</ins><span class="cx"> void didPerformCommitTransaction(uint64_t callbackIdentifier, const IDBError&, const IDBResourceIdentifier& transactionIdentifier);
</span><span class="cx"> void didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError&, const IDBResourceIdentifier& transactionIdentifier);
</span><span class="cx"> void didPerformActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBError&);
</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& requestData, const IDBKeyRangeData& keyRangeData)
+{
+ LOG(IndexedDB, "UniqueIDBDatabaseTransaction::deleteRecord");
+
+ ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier());
+
+ RefPtr<UniqueIDBDatabaseTransaction> protectedThis(this);
+ m_databaseConnection->database().deleteRecord(requestData, keyRangeData, [this, protectedThis, requestData](const IDBError& error) {
+ LOG(IndexedDB, "UniqueIDBDatabaseTransaction::deleteRecord (callback)");
+
+ if (error.isNull())
+ m_databaseConnection->connectionToClient().didDeleteRecord(IDBResultData::deleteRecordSuccess(requestData.requestIdentifier()));
+ else
+ m_databaseConnection->connectionToClient().didDeleteRecord(IDBResultData::error(requestData.requestIdentifier(), error));
+ });
+}
+
</ins><span class="cx"> const Vector<uint64_t>& 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&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
</span><span class="cx"> void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
</span><span class="cx"> void getCount(const IDBRequestData&, const IDBKeyRangeData&);
</span><ins>+ void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&);
</ins><span class="cx">
</span><span class="cx"> void didActivateInBackingStore(const IDBError&);
</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& requestIdentifier)
+{
+ return { IDBResultType::DeleteRecordSuccess, requestIdentifier };
+}
+
</ins><span class="cx"> const IDBDatabaseInfo& 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&, const IDBKeyData&);
</span><span class="cx"> static IDBResultData getRecordSuccess(const IDBResourceIdentifier&, const ThreadSafeDataBuffer& valueData);
</span><span class="cx"> static IDBResultData getCountSuccess(const IDBResourceIdentifier&, uint64_t count);
</span><ins>+ static IDBResultData deleteRecordSuccess(const IDBResourceIdentifier&);
</ins><span class="cx">
</span><span class="cx"> IDBResultData(const IDBResultData&);
</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& resultData)
+{
+ RefPtr<InProcessIDBServer> self(this);
+ RunLoop::current().dispatch([this, self, resultData] {
+ m_connectionToServer->didDeleteRecord(resultData);
+ });
+}
+
</ins><span class="cx"> void InProcessIDBServer::abortTransaction(IDBResourceIdentifier& resourceIdentifier)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<InProcessIDBServer> self(this);
</span><span class="lines">@@ -234,6 +242,16 @@
</span><span class="cx"> m_server->getCount(requestData, keyRangeData);
</span><span class="cx"> });
</span><span class="cx"> }
</span><ins>+
+void InProcessIDBServer::deleteRecord(const IDBRequestData& requestData, const IDBKeyRangeData& keyRangeData)
+{
+ RefPtr<InProcessIDBServer> self(this);
+
+ RunLoop::current().dispatch([this, self, requestData, keyRangeData] {
+ m_server->deleteRecord(requestData, keyRangeData);
+ });
+}
+
</ins><span class="cx"> void InProcessIDBServer::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo& info)
</span><span class="cx"> {
</span><span class="cx"> RefPtr<InProcessIDBServer> 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&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) override final;
</span><span class="cx"> virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) override final;
</span><span class="cx"> virtual void getCount(const IDBRequestData&, const IDBKeyRangeData&) override final;
</span><ins>+ virtual void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&) override final;
</ins><span class="cx"> virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&) 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&) override final;
</span><span class="cx"> virtual void didGetRecord(const IDBResultData&) override final;
</span><span class="cx"> virtual void didGetCount(const IDBResultData&) override final;
</span><ins>+ virtual void didDeleteRecord(const IDBResultData&) override final;
</ins><span class="cx"> virtual void fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection&, uint64_t requestedVersion) override final;
</span><span class="cx"> virtual void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) override final;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>