Diff
Modified: trunk/LayoutTests/ChangeLog (191927 => 191928)
--- trunk/LayoutTests/ChangeLog 2015-11-03 00:46:01 UTC (rev 191927)
+++ trunk/LayoutTests/ChangeLog 2015-11-03 01:06:53 UTC (rev 191928)
@@ -1,3 +1,17 @@
+2015-11-02 Brady Eidson <beid...@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.
+
2015-11-02 Ryan Haddad <ryanhad...@apple.com>
Marking imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-chunked-trailer.htm as flaky on mac
Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1-expected.txt (0 => 191928)
--- 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)
@@ -0,0 +1,25 @@
+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
+
Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-1.html (0 => 191928)
--- 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)
@@ -0,0 +1,140 @@
+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>
Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2-expected.txt (0 => 191928)
--- 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)
@@ -0,0 +1,9 @@
+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
+
Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-2.html (0 => 191928)
--- 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)
@@ -0,0 +1,114 @@
+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>
Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures-expected.txt (0 => 191928)
--- 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)
@@ -0,0 +1,10 @@
+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
+
Added: trunk/LayoutTests/storage/indexeddb/modern/idbobjectstore-delete-failures.html (0 => 191928)
--- 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)
@@ -0,0 +1,120 @@
+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>
Modified: trunk/Source/WebCore/ChangeLog (191927 => 191928)
--- 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)
@@ -1,3 +1,75 @@
+2015-11-02 Brady Eidson <beid...@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:
+
2015-11-02 Andy Estes <aes...@apple.com>
Fix the iOS build again.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.cpp (191927 => 191928)
--- 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)
@@ -79,6 +79,20 @@
return !lowerKey.compare(upperKey);
}
+bool IDBKeyRangeData::isValid() const
+{
+ if (isNull)
+ return false;
+
+ if (!lowerKey.isValid() && !lowerKey.isNull())
+ return false;
+
+ if (!upperKey.isValid() && !upperKey.isNull())
+ return false;
+
+ return true;
+}
+
} // namespace WebCore
#endif // ENABLE(INDEXED_DATABASE)
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRangeData.h (191927 => 191928)
--- 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)
@@ -65,6 +65,7 @@
WEBCORE_EXPORT PassRefPtr<IDBKeyRange> maybeCreateIDBKeyRange() const;
WEBCORE_EXPORT bool isExactlyOneKey() const;
+ bool isValid() const;
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static bool decode(Decoder&, IDBKeyRangeData&);
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp (191927 => 191928)
--- 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)
@@ -186,6 +186,22 @@
completeOperation(resultData);
}
+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);
+}
+
void IDBConnectionToServer::establishTransaction(IDBTransaction& transaction)
{
LOG(IndexedDB, "IDBConnectionToServer::establishTransaction");
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h (191927 => 191928)
--- 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)
@@ -79,6 +79,9 @@
void getCount(TransactionOperation&, const IDBKeyRangeData&);
void didGetCount(const IDBResultData&);
+ void deleteRecord(TransactionOperation&, const IDBKeyRangeData&);
+ void didDeleteRecord(const IDBResultData&);
+
void commitTransaction(IDBTransaction&);
void didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h (191927 => 191928)
--- 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)
@@ -62,6 +62,7 @@
virtual void putOrAdd(const IDBRequestData&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) = 0;
virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) = 0;
virtual void getCount(const IDBRequestData&, const IDBKeyRangeData&) = 0;
+ virtual void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&) = 0;
virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&) = 0;
virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) = 0;
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBObjectStoreImpl.cpp (191927 => 191928)
--- 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)
@@ -162,9 +162,7 @@
}
IDBKeyRangeData keyRangeData(keyRange);
- if (keyRangeData.isNull
- || (!keyRangeData.lowerKey.isValid() && !keyRangeData.lowerKey.isNull())
- || (!keyRangeData.upperKey.isValid() && !keyRangeData.upperKey.isNull())) {
+ if (!keyRangeData.isValid()) {
ec = static_cast<ExceptionCode>(IDBExceptionCode::DataError);
return nullptr;
}
@@ -277,14 +275,45 @@
}
-RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext*, IDBKeyRange*, ExceptionCode&)
+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* context, IDBKeyRange* keyRange, ExceptionCode& ec)
{
- RELEASE_ASSERT_NOT_REACHED();
+ 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);
}
-RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext*, const Deprecated::ScriptValue&, ExceptionCode&)
+RefPtr<WebCore::IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* context, const Deprecated::ScriptValue& key, ExceptionCode& ec)
{
- RELEASE_ASSERT_NOT_REACHED();
+ 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);
}
RefPtr<WebCore::IDBRequest> IDBObjectStore::clear(ScriptExecutionContext* context, ExceptionCode& ec)
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.cpp (191927 => 191928)
--- 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)
@@ -460,6 +460,34 @@
request.requestCompleted(resultData);
}
+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);
+}
+
Ref<IDBRequest> IDBTransaction::requestClearObjectStore(ScriptExecutionContext& context, IDBObjectStore& objectStore)
{
LOG(IndexedDB, "IDBTransaction::requestClearObjectStore");
Modified: trunk/Source/WebCore/Modules/indexeddb/client/IDBTransactionImpl.h (191927 => 191928)
--- 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)
@@ -91,6 +91,7 @@
Ref<IDBRequest> requestPutOrAdd(ScriptExecutionContext&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode);
Ref<IDBRequest> requestGetRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
+ Ref<IDBRequest> requestDeleteRecord(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
Ref<IDBRequest> requestClearObjectStore(ScriptExecutionContext&, IDBObjectStore&);
Ref<IDBRequest> requestCount(ScriptExecutionContext&, IDBObjectStore&, const IDBKeyRangeData&);
@@ -140,6 +141,9 @@
void getCountOnServer(TransactionOperation&, const IDBKeyRangeData&);
void didGetCountOnServer(IDBRequest&, const IDBResultData&);
+ void deleteRecordOnServer(TransactionOperation&, const IDBKeyRangeData&);
+ void didDeleteRecordOnServer(IDBRequest&, const IDBResultData&);
+
void deleteObjectStoreOnServer(TransactionOperation&, const String& objectStoreName);
void didDeleteObjectStoreOnServer(const IDBResultData&);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h (191927 => 191928)
--- 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)
@@ -57,7 +57,7 @@
virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, const String& objectStoreName) = 0;
virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) = 0;
virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0;
- virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) = 0;
+ virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) = 0;
virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) = 0;
virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) = 0;
virtual IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, uint64_t& outCount) = 0;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp (191927 => 191928)
--- 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)
@@ -93,6 +93,11 @@
m_delegate->didGetCount(result);
}
+void IDBConnectionToClient::didDeleteRecord(const IDBResultData& result)
+{
+ m_delegate->didDeleteRecord(result);
+}
+
void IDBConnectionToClient::didCommitTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError& error)
{
m_delegate->didCommitTransaction(transactionIdentifier, error);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h (191927 => 191928)
--- 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)
@@ -58,6 +58,7 @@
void didPutOrAdd(const IDBResultData&);
void didGetRecord(const IDBResultData&);
void didGetCount(const IDBResultData&);
+ void didDeleteRecord(const IDBResultData&);
void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion);
void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h (191927 => 191928)
--- 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)
@@ -54,6 +54,7 @@
virtual void didPutOrAdd(const IDBResultData&) = 0;
virtual void didGetRecord(const IDBResultData&) = 0;
virtual void didGetCount(const IDBResultData&) = 0;
+ virtual void didDeleteRecord(const IDBResultData&) = 0;
virtual void fireVersionChangeEvent(UniqueIDBDatabaseConnection&, uint64_t requestedVersion) = 0;
virtual void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) = 0;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp (191927 => 191928)
--- 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)
@@ -224,6 +224,17 @@
transaction->getCount(requestData, keyRangeData);
}
+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);
+}
+
void IDBServer::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo& info)
{
LOG(IndexedDB, "IDBServer::establishTransaction");
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h (191927 => 191928)
--- 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)
@@ -65,6 +65,7 @@
void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
void getCount(const IDBRequestData&, const IDBKeyRangeData&);
+ void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&);
void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&);
void databaseConnectionClosed(uint64_t databaseConnectionIdentifier);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp (191927 => 191928)
--- 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)
@@ -28,6 +28,7 @@
#if ENABLE(INDEXED_DATABASE)
+#include "IDBKeyRangeData.h"
#include "Logging.h"
#include "MemoryObjectStore.h"
@@ -210,17 +211,20 @@
return IDBError();
}
-IDBError MemoryIDBBackingStore::deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData& keyData)
+IDBError MemoryIDBBackingStore::deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData& range)
{
- LOG(IndexedDB, "MemoryIDBBackingStore::deleteRecord");
+ LOG(IndexedDB, "MemoryIDBBackingStore::deleteRange");
ASSERT(objectStoreIdentifier);
+ if (!m_transactions.contains(transactionIdentifier))
+ return IDBError(IDBExceptionCode::Unknown, WTF::ASCIILiteral("No backing store transaction found to delete from"));
+
MemoryObjectStore* objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier);
- RELEASE_ASSERT(objectStore);
- RELEASE_ASSERT(m_transactions.contains(transactionIdentifier));
+ if (!objectStore)
+ return IDBError(IDBExceptionCode::Unknown, WTF::ASCIILiteral("No backing store object store found"));
- objectStore->deleteRecord(keyData);
+ objectStore->deleteRange(range);
return IDBError();
}
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h (191927 => 191928)
--- 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)
@@ -56,7 +56,7 @@
virtual IDBError deleteObjectStore(const IDBResourceIdentifier& transactionIdentifier, const String& objectStoreName) override final;
virtual IDBError clearObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier) override final;
virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) override final;
- virtual IDBError deleteRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&) override final;
+ virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) override final;
virtual IDBError putRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& value) override final;
virtual IDBError getRecord(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, ThreadSafeDataBuffer& outValue) override final;
virtual IDBError getCount(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&, uint64_t& outCount) override final;
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp (191927 => 191928)
--- 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)
@@ -106,6 +106,30 @@
m_orderedKeys->erase(key);
}
+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;
+ }
+}
+
void MemoryObjectStore::putRecord(MemoryBackingStoreTransaction& transaction, const IDBKeyData& keyData, const ThreadSafeDataBuffer& value)
{
LOG(IndexedDB, "MemoryObjectStore::putRecord");
Modified: trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h (191927 => 191928)
--- 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)
@@ -58,6 +58,7 @@
bool containsRecord(const IDBKeyData&);
void deleteRecord(const IDBKeyData&);
+ void deleteRange(const IDBKeyRangeData&);
void putRecord(MemoryBackingStoreTransaction&, const IDBKeyData&, const ThreadSafeDataBuffer& value);
void setKeyValue(const IDBKeyData&, const ThreadSafeDataBuffer& value);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp (191927 => 191928)
--- 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)
@@ -392,7 +392,7 @@
// ...If a record already exists in store ...
// then remove the record from store using the steps for deleting records from an object store...
// This is important because formally deleting it from from the object store also removes it from the appropriate indexes.
- error = m_backingStore->deleteRecord(transactionIdentifier, objectStoreIdentifier, usedKey);
+ error = m_backingStore->deleteRange(transactionIdentifier, objectStoreIdentifier, usedKey);
if (!error.isNull()) {
m_server.postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformPutOrAdd, callbackIdentifier, error, usedKey));
return;
@@ -473,6 +473,33 @@
performCountCallback(callbackIdentifier, error, count);
}
+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);
+}
+
void UniqueIDBDatabase::commitTransaction(UniqueIDBDatabaseTransaction& transaction, ErrorCallback callback)
{
ASSERT(isMainThread());
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h (191927 => 191928)
--- 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)
@@ -76,6 +76,7 @@
void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode, KeyDataCallback);
void getRecord(const IDBRequestData&, const IDBKeyRangeData&, ValueDataCallback);
void getCount(const IDBRequestData&, const IDBKeyRangeData&, CountCallback);
+ void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&, ErrorCallback);
void commitTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
void abortTransaction(UniqueIDBDatabaseTransaction&, ErrorCallback);
void transactionDestroyed(UniqueIDBDatabaseTransaction&);
@@ -107,6 +108,7 @@
void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
void performGetCount(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
+ void performDeleteRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&);
void performActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBTransactionInfo&);
// Main thread callbacks
@@ -117,6 +119,7 @@
void didPerformPutOrAdd(uint64_t callbackIdentifier, const IDBError&, const IDBKeyData&);
void didPerformGetRecord(uint64_t callbackIdentifier, const IDBError&, const ThreadSafeDataBuffer&);
void didPerformGetCount(uint64_t callbackIdentifier, const IDBError&, uint64_t);
+ void didPerformDeleteRecord(uint64_t callbackIdentifier, const IDBError&);
void didPerformCommitTransaction(uint64_t callbackIdentifier, const IDBError&, const IDBResourceIdentifier& transactionIdentifier);
void didPerformAbortTransaction(uint64_t callbackIdentifier, const IDBError&, const IDBResourceIdentifier& transactionIdentifier);
void didPerformActivateTransactionInBackingStore(uint64_t callbackIdentifier, const IDBError&);
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp (191927 => 191928)
--- 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)
@@ -198,6 +198,23 @@
});
}
+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));
+ });
+}
+
const Vector<uint64_t>& UniqueIDBDatabaseTransaction::objectStoreIdentifiers()
{
if (!m_objectStoreIdentifiers.isEmpty())
Modified: trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h (191927 => 191928)
--- 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)
@@ -70,6 +70,7 @@
void putOrAdd(const IDBRequestData&, const IDBKeyData&, const ThreadSafeDataBuffer& valueData, IndexedDB::ObjectStoreOverwriteMode);
void getRecord(const IDBRequestData&, const IDBKeyRangeData&);
void getCount(const IDBRequestData&, const IDBKeyRangeData&);
+ void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&);
void didActivateInBackingStore(const IDBError&);
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp (191927 => 191928)
--- 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)
@@ -125,6 +125,11 @@
return result;
}
+IDBResultData IDBResultData::deleteRecordSuccess(const IDBResourceIdentifier& requestIdentifier)
+{
+ return { IDBResultType::DeleteRecordSuccess, requestIdentifier };
+}
+
const IDBDatabaseInfo& IDBResultData::databaseInfo() const
{
RELEASE_ASSERT(m_databaseInfo);
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h (191927 => 191928)
--- 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)
@@ -50,6 +50,7 @@
PutOrAddSuccess,
GetRecordSuccess,
GetCountSuccess,
+ DeleteRecordSuccess,
};
namespace IDBServer {
@@ -68,6 +69,7 @@
static IDBResultData putOrAddSuccess(const IDBResourceIdentifier&, const IDBKeyData&);
static IDBResultData getRecordSuccess(const IDBResourceIdentifier&, const ThreadSafeDataBuffer& valueData);
static IDBResultData getCountSuccess(const IDBResourceIdentifier&, uint64_t count);
+ static IDBResultData deleteRecordSuccess(const IDBResourceIdentifier&);
IDBResultData(const IDBResultData&);
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp (191927 => 191928)
--- 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)
@@ -167,6 +167,14 @@
});
}
+void InProcessIDBServer::didDeleteRecord(const IDBResultData& resultData)
+{
+ RefPtr<InProcessIDBServer> self(this);
+ RunLoop::current().dispatch([this, self, resultData] {
+ m_connectionToServer->didDeleteRecord(resultData);
+ });
+}
+
void InProcessIDBServer::abortTransaction(IDBResourceIdentifier& resourceIdentifier)
{
RefPtr<InProcessIDBServer> self(this);
@@ -234,6 +242,16 @@
m_server->getCount(requestData, keyRangeData);
});
}
+
+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);
+ });
+}
+
void InProcessIDBServer::establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo& info)
{
RefPtr<InProcessIDBServer> self(this);
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h (191927 => 191928)
--- 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)
@@ -64,6 +64,7 @@
virtual void putOrAdd(const IDBRequestData&, IDBKey*, SerializedScriptValue&, const IndexedDB::ObjectStoreOverwriteMode) override final;
virtual void getRecord(const IDBRequestData&, const IDBKeyRangeData&) override final;
virtual void getCount(const IDBRequestData&, const IDBKeyRangeData&) override final;
+ virtual void deleteRecord(const IDBRequestData&, const IDBKeyRangeData&) override final;
virtual void establishTransaction(uint64_t databaseConnectionIdentifier, const IDBTransactionInfo&) override final;
virtual void databaseConnectionClosed(uint64_t databaseConnectionIdentifier) override final;
@@ -79,6 +80,7 @@
virtual void didPutOrAdd(const IDBResultData&) override final;
virtual void didGetRecord(const IDBResultData&) override final;
virtual void didGetCount(const IDBResultData&) override final;
+ virtual void didDeleteRecord(const IDBResultData&) override final;
virtual void fireVersionChangeEvent(IDBServer::UniqueIDBDatabaseConnection&, uint64_t requestedVersion) override final;
virtual void didStartTransaction(const IDBResourceIdentifier& transactionIdentifier, const IDBError&) override final;