Title: [120888] trunk
Revision
120888
Author
[email protected]
Date
2012-06-20 17:31:41 -0700 (Wed, 20 Jun 2012)

Log Message

IndexedDB: Remove redundant IDBObjectStore.delete() overloads
https://bugs.webkit.org/show_bug.cgi?id=89587

Reviewed by Darin Fisher.

Source/WebCore:

The IDBObjectStore.delete(IDBKey) overload can delegate to the delete(IDBKeyRange)
overload. Also cleaned up redundant checks in related overloads.

Test: storage/indexeddb/deleted-objects.html

* Modules/indexeddb/IDBCursorBackendImpl.cpp:
(WebCore::IDBCursorBackendImpl::deleteFunction): Call keyRange variant instead.
* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::get): Remove redundant deleted/invalid IDBKey checks.
(WebCore::IDBIndex::getKey): Remove redundant deleted/invalid IDBKey checks.
* Modules/indexeddb/IDBKeyRange.cpp: Null IDBKeys are not acceptable; currently
not passed in by any callers.
(WebCore::IDBKeyRange::only):
(WebCore::IDBKeyRange::lowerBound):
(WebCore::IDBKeyRange::upperBound):
(WebCore::IDBKeyRange::bound):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::get): Was missing deleted check in IDBKeyRange overload.
Removed redundant checks in IDBKey overload.
(WebCore::IDBObjectStore::deleteFunction): Delegate to IDBKeyRange overload.
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: Remove IDBKey overload.
* Modules/indexeddb/IDBObjectStoreBackendImpl.h: Remove IDBKey overload.
(IDBObjectStoreBackendImpl):
* Modules/indexeddb/IDBObjectStoreBackendInterface.h: Remove IDBKey overload.

Source/WebKit/chromium:

* public/WebIDBObjectStore.h: Add note to remove overload when Chromium is updated.
(WebIDBObjectStore):
* src/IDBObjectStoreBackendProxy.cpp: Delete IDBKey overload.
* src/IDBObjectStoreBackendProxy.h: Delete IDBKey overload.
(IDBObjectStoreBackendProxy):
* src/WebIDBObjectStoreImpl.cpp: Delete IDBKey overload.
* src/WebIDBObjectStoreImpl.h: Delete IDBKey overload.
(WebIDBObjectStoreImpl):

LayoutTests:

* storage/indexeddb/deleted-objects-expected.txt:
* storage/indexeddb/resources/deleted-objects.js: Test IDBKeyRange overloads.
(openDatabase.request.onsuccess.request.onsuccess):
(openDatabase.request.onsuccess):
(openDatabase):

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (120887 => 120888)


--- trunk/LayoutTests/ChangeLog	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/LayoutTests/ChangeLog	2012-06-21 00:31:41 UTC (rev 120888)
@@ -1,3 +1,16 @@
+2012-06-20  Joshua Bell  <[email protected]>
+
+        IndexedDB: Remove redundant IDBObjectStore.delete() overloads
+        https://bugs.webkit.org/show_bug.cgi?id=89587
+
+        Reviewed by Darin Fisher.
+
+        * storage/indexeddb/deleted-objects-expected.txt:
+        * storage/indexeddb/resources/deleted-objects.js: Test IDBKeyRange overloads.
+        (openDatabase.request.onsuccess.request.onsuccess):
+        (openDatabase.request.onsuccess):
+        (openDatabase):
+
 2012-06-20  Shinya Kawanaka  <[email protected]>
 
         [Shadow][Editing] Selection will break editing boundaries in Shadow DOM.

Modified: trunk/LayoutTests/storage/indexeddb/deleted-objects-expected.txt (120887 => 120888)


--- trunk/LayoutTests/storage/indexeddb/deleted-objects-expected.txt	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/LayoutTests/storage/indexeddb/deleted-objects-expected.txt	2012-06-21 00:31:41 UTC (rev 120888)
@@ -32,10 +32,18 @@
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.delete(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 Expecting exception from deletedStore.get(0)
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.get(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 Expecting exception from deletedStore.clear()
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
@@ -44,6 +52,22 @@
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.openCursor(0)
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.openCursor(0, 'next')
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.openCursor(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.openCursor(IDBKeyRange.only(0), 'next')
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 Expecting exception from deletedStore.createIndex('name', 'path')
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
@@ -60,27 +84,83 @@
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.count(0)
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedStore.count(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 
 Expecting exception from deletedIndex.openCursor()
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openCursor(0)
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openCursor(0, 'next')
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openCursor(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openCursor(IDBKeyRange.only(0), 'next')
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 Expecting exception from deletedIndex.openKeyCursor()
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openKeyCursor(0)
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openKeyCursor(0, 'next')
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openKeyCursor(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.openKeyCursor(IDBKeyRange.only(0), 'next')
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 Expecting exception from deletedIndex.get(0)
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.get(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 Expecting exception from deletedIndex.getKey(0)
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.getKey(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 Expecting exception from deletedIndex.count()
 PASS Exception was thrown.
 PASS code is DOMException.INVALID_STATE_ERR
 PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.count(0)
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
+Expecting exception from deletedIndex.count(IDBKeyRange.only(0))
+PASS Exception was thrown.
+PASS code is DOMException.INVALID_STATE_ERR
+PASS ename is 'InvalidStateError'
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/storage/indexeddb/resources/deleted-objects.js (120887 => 120888)


--- trunk/LayoutTests/storage/indexeddb/resources/deleted-objects.js	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/LayoutTests/storage/indexeddb/resources/deleted-objects.js	2012-06-21 00:31:41 UTC (rev 120888)
@@ -40,20 +40,40 @@
             evalAndExpectException("deletedStore.put(0, 0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.add(0, 0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.delete(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.delete(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.get(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.get(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.clear()", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.openCursor()", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.openCursor(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.openCursor(0, 'next')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.openCursor(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.openCursor(IDBKeyRange.only(0), 'next')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.createIndex('name', 'path')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.index('name')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.deleteIndex('name')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedStore.count()", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.count(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedStore.count(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
 
             debug("");
             evalAndExpectException("deletedIndex.openCursor()", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openCursor(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openCursor(0, 'next')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openCursor(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openCursor(IDBKeyRange.only(0), 'next')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedIndex.openKeyCursor()", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openKeyCursor(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openKeyCursor(0, 'next')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openKeyCursor(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.openKeyCursor(IDBKeyRange.only(0), 'next')", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedIndex.get(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.get(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedIndex.getKey(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.getKey(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
             evalAndExpectException("deletedIndex.count()", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.count(0)", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
+            evalAndExpectException("deletedIndex.count(IDBKeyRange.only(0))", "DOMException.INVALID_STATE_ERR", "'InvalidStateError'");
 
             trans._onabort_ = unexpectedAbortCallback;
             trans._oncomplete_ = finishJSTest;

Modified: trunk/Source/WebCore/ChangeLog (120887 => 120888)


--- trunk/Source/WebCore/ChangeLog	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/ChangeLog	2012-06-21 00:31:41 UTC (rev 120888)
@@ -1,3 +1,35 @@
+2012-06-20  Joshua Bell  <[email protected]>
+
+        IndexedDB: Remove redundant IDBObjectStore.delete() overloads
+        https://bugs.webkit.org/show_bug.cgi?id=89587
+
+        Reviewed by Darin Fisher.
+
+        The IDBObjectStore.delete(IDBKey) overload can delegate to the delete(IDBKeyRange)
+        overload. Also cleaned up redundant checks in related overloads.
+
+        Test: storage/indexeddb/deleted-objects.html
+
+        * Modules/indexeddb/IDBCursorBackendImpl.cpp:
+        (WebCore::IDBCursorBackendImpl::deleteFunction): Call keyRange variant instead.
+        * Modules/indexeddb/IDBIndex.cpp:
+        (WebCore::IDBIndex::get): Remove redundant deleted/invalid IDBKey checks.
+        (WebCore::IDBIndex::getKey): Remove redundant deleted/invalid IDBKey checks.
+        * Modules/indexeddb/IDBKeyRange.cpp: Null IDBKeys are not acceptable; currently
+        not passed in by any callers.
+        (WebCore::IDBKeyRange::only):
+        (WebCore::IDBKeyRange::lowerBound):
+        (WebCore::IDBKeyRange::upperBound):
+        (WebCore::IDBKeyRange::bound):
+        * Modules/indexeddb/IDBObjectStore.cpp:
+        (WebCore::IDBObjectStore::get): Was missing deleted check in IDBKeyRange overload.
+        Removed redundant checks in IDBKey overload.
+        (WebCore::IDBObjectStore::deleteFunction): Delegate to IDBKeyRange overload.
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.cpp: Remove IDBKey overload.
+        * Modules/indexeddb/IDBObjectStoreBackendImpl.h: Remove IDBKey overload.
+        (IDBObjectStoreBackendImpl):
+        * Modules/indexeddb/IDBObjectStoreBackendInterface.h: Remove IDBKey overload.
+
 2012-06-20  Shinya Kawanaka  <[email protected]>
 
         [Shadow][Editing] Selection will break editing boundaries in Shadow DOM.

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp (120887 => 120888)


--- trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBCursorBackendImpl.cpp	2012-06-21 00:31:41 UTC (rev 120888)
@@ -171,7 +171,10 @@
         return;
     }
 
-    m_objectStore->deleteFunction(m_cursor->primaryKey(), prpCallbacks, m_transaction.get(), ec);
+    RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(m_cursor->primaryKey(), ec);
+    ASSERT(!ec);
+
+    m_objectStore->deleteFunction(keyRange.release(), prpCallbacks, m_transaction.get(), ec);
 }
 
 void IDBCursorBackendImpl::prefetchContinue(int numberToFetch, PassRefPtr<IDBCallbacks> prpCallbacks, ExceptionCode& ec)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp (120887 => 120888)


--- trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp	2012-06-21 00:31:41 UTC (rev 120888)
@@ -186,19 +186,9 @@
 PassRefPtr<IDBRequest> IDBIndex::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBIndex::get");
-    if (m_deleted) {
-        ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
-        return 0;
-    }
-    if (key && (key->type() == IDBKey::InvalidType)) {
-        ec = IDBDatabaseException::DATA_ERR;
-        return 0;
-    }
-
     RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec);
     if (ec)
         return 0;
-
     return get(context, keyRange.release(), ec);
 }
 
@@ -226,15 +216,6 @@
 PassRefPtr<IDBRequest> IDBIndex::getKey(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBIndex::getKey");
-    if (m_deleted) {
-        ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
-        return 0;
-    }
-    if (key && (key->type() == IDBKey::InvalidType)) {
-        ec = IDBDatabaseException::DATA_ERR;
-        return 0;
-    }
-
     RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec);
     if (ec)
         return 0;

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp (120887 => 120888)


--- trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBKeyRange.cpp	2012-06-21 00:31:41 UTC (rev 120888)
@@ -44,7 +44,7 @@
 PassRefPtr<IDBKeyRange> IDBKeyRange::only(PassRefPtr<IDBKey> prpKey, ExceptionCode& ec)
 {
     RefPtr<IDBKey> key = prpKey;
-    if (key && (key->type() == IDBKey::InvalidType)) {
+    if (!key || !key->isValid()) {
         ec = IDBDatabaseException::DATA_ERR;
         return 0;
     }
@@ -54,7 +54,7 @@
 
 PassRefPtr<IDBKeyRange> IDBKeyRange::lowerBound(PassRefPtr<IDBKey> bound, bool open, ExceptionCode& ec)
 {
-    if (bound && (bound->type() == IDBKey::InvalidType)) {
+    if (!bound || !bound->isValid()) {
         ec = IDBDatabaseException::DATA_ERR;
         return 0;
     }
@@ -64,7 +64,7 @@
 
 PassRefPtr<IDBKeyRange> IDBKeyRange::upperBound(PassRefPtr<IDBKey> bound, bool open, ExceptionCode& ec)
 {
-    if (bound && (bound->type() == IDBKey::InvalidType)) {
+    if (!bound || !bound->isValid()) {
         ec = IDBDatabaseException::DATA_ERR;
         return 0;
     }
@@ -74,15 +74,15 @@
 
 PassRefPtr<IDBKeyRange> IDBKeyRange::bound(PassRefPtr<IDBKey> lower, PassRefPtr<IDBKey> upper, bool lowerOpen, bool upperOpen, ExceptionCode& ec)
 {
-    if ((lower && (lower->type() == IDBKey::InvalidType)) || (upper && (upper->type() == IDBKey::InvalidType))) {
+    if (!lower || !lower->isValid() || !upper || !upper->isValid()) {
         ec = IDBDatabaseException::DATA_ERR;
         return 0;
     }
-    if (lower && upper && upper->isLessThan(lower.get())) {
+    if (upper->isLessThan(lower.get())) {
         ec = IDBDatabaseException::DATA_ERR;
         return 0;
     }
-    if (lower && upper && upper->isEqual(lower.get()) && (lowerOpen || upperOpen)) {
+    if (upper->isEqual(lower.get()) && (lowerOpen || upperOpen)) {
         ec = IDBDatabaseException::DATA_ERR;
         return 0;
     }

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (120887 => 120888)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp	2012-06-21 00:31:41 UTC (rev 120888)
@@ -88,7 +88,10 @@
 PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKeyRange> keyRange, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::get");
-
+    if (m_deleted) {
+        ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
+        return 0;
+    }
     if (!keyRange) {
         ec = IDBDatabaseException::DATA_ERR;
         return 0;
@@ -105,16 +108,6 @@
 PassRefPtr<IDBRequest> IDBObjectStore::get(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::get");
-    if (m_deleted) {
-        ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
-        return 0;
-    }
-
-    if (!key || (key->type() == IDBKey::InvalidType)) {
-        ec = IDBDatabaseException::DATA_ERR;
-        return 0;
-    }
-
     RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec);
     if (ec)
         return 0;
@@ -216,27 +209,10 @@
 PassRefPtr<IDBRequest> IDBObjectStore::deleteFunction(ScriptExecutionContext* context, PassRefPtr<IDBKey> key, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStore::delete");
-    if (m_deleted) {
-        ec = IDBDatabaseException::IDB_INVALID_STATE_ERR;
+    RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec);
+    if (ec)
         return 0;
-    }
-    if (m_transaction->isReadOnly()) {
-        ec = IDBDatabaseException::READ_ONLY_ERR;
-        return 0;
-    }
-
-    if (!key || !key->isValid()) {
-        ec = IDBDatabaseException::DATA_ERR;
-        return 0;
-    }
-
-    RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
-    m_backend->deleteFunction(key, request, m_transaction->backend(), ec);
-    if (ec) {
-        request->markEarlyDeath();
-        return 0;
-    }
-    return request.release();
+    return deleteFunction(context, keyRange.release(), ec);
 }
 
 PassRefPtr<IDBRequest> IDBObjectStore::clear(ScriptExecutionContext* context, ExceptionCode& ec)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp (120887 => 120888)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp	2012-06-21 00:31:41 UTC (rev 120888)
@@ -337,22 +337,6 @@
     callbacks->onSuccess(key.get());
 }
 
-void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKey> prpKey, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
-{
-    IDB_TRACE("IDBObjectStoreBackendImpl::delete");
-    RefPtr<IDBKey> key = prpKey;
-    if (!key || !key->isValid()) {
-        ec = IDBDatabaseException::DATA_ERR;
-        return;
-    }
-
-    RefPtr<IDBKeyRange> keyRange = IDBKeyRange::only(key, ec);
-    if (ec)
-        return;
-
-    deleteFunction(keyRange.release(), prpCallbacks, transaction, ec);
-}
-
 void IDBObjectStoreBackendImpl::deleteFunction(PassRefPtr<IDBKeyRange> prpKeyRange, PassRefPtr<IDBCallbacks> prpCallbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
 {
     IDB_TRACE("IDBObjectStoreBackendImpl::delete");

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h (120887 => 120888)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.h	2012-06-21 00:31:41 UTC (rev 120888)
@@ -68,7 +68,6 @@
 
     virtual void get(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
-    virtual void deleteFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
     virtual void clear(PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&);
 

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h (120887 => 120888)


--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendInterface.h	2012-06-21 00:31:41 UTC (rev 120888)
@@ -61,7 +61,6 @@
         CursorUpdate
     };
     virtual void put(PassRefPtr<SerializedScriptValue>, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
-    virtual void deleteFunction(PassRefPtr<IDBKey>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
     virtual void deleteFunction(PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;
 
     virtual void clear(PassRefPtr<IDBCallbacks>, IDBTransactionBackendInterface*, ExceptionCode&) = 0;

Modified: trunk/Source/WebKit/chromium/ChangeLog (120887 => 120888)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-06-21 00:31:41 UTC (rev 120888)
@@ -1,3 +1,19 @@
+2012-06-20  Joshua Bell  <[email protected]>
+
+        IndexedDB: Remove redundant IDBObjectStore.delete() overloads
+        https://bugs.webkit.org/show_bug.cgi?id=89587
+
+        Reviewed by Darin Fisher.
+
+        * public/WebIDBObjectStore.h: Add note to remove overload when Chromium is updated.
+        (WebIDBObjectStore):
+        * src/IDBObjectStoreBackendProxy.cpp: Delete IDBKey overload.
+        * src/IDBObjectStoreBackendProxy.h: Delete IDBKey overload.
+        (IDBObjectStoreBackendProxy):
+        * src/WebIDBObjectStoreImpl.cpp: Delete IDBKey overload.
+        * src/WebIDBObjectStoreImpl.h: Delete IDBKey overload.
+        (WebIDBObjectStoreImpl):
+
 2012-06-20  Garret Kelly  <[email protected]>
 
         Moving cookieEnabled/setCookieEnabled from Page to Settings, and

Modified: trunk/Source/WebKit/chromium/public/WebIDBObjectStore.h (120887 => 120888)


--- trunk/Source/WebKit/chromium/public/WebIDBObjectStore.h	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebKit/chromium/public/WebIDBObjectStore.h	2012-06-21 00:31:41 UTC (rev 120888)
@@ -73,6 +73,7 @@
     };
 
     virtual void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
+    // FIXME: Remove the following overload when all callers are updated.
     virtual void deleteFunction(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
     virtual void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }
     virtual void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); }

Modified: trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp (120887 => 120888)


--- trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp	2012-06-21 00:31:41 UTC (rev 120888)
@@ -95,14 +95,6 @@
     m_webIDBObjectStore->put(value, key, static_cast<WebIDBObjectStore::PutMode>(putMode), new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
 }
 
-void IDBObjectStoreBackendProxy::deleteFunction(PassRefPtr<IDBKey> key, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
-{
-    // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,
-    // all implementations of IDB interfaces are proxy objects.
-    IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction);
-    m_webIDBObjectStore->deleteFunction(key, new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec);
-}
-
 void IDBObjectStoreBackendProxy::deleteFunction(PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks, IDBTransactionBackendInterface* transaction, ExceptionCode& ec)
 {
     // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer,

Modified: trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h (120887 => 120888)


--- trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h	2012-06-21 00:31:41 UTC (rev 120888)
@@ -50,7 +50,6 @@
 
     virtual void get(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual void put(PassRefPtr<WebCore::SerializedScriptValue>, PassRefPtr<WebCore::IDBKey>, PutMode, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
-    virtual void deleteFunction(PassRefPtr<WebCore::IDBKey>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual void deleteFunction(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
     virtual void clear(PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&);
 

Modified: trunk/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp (120887 => 120888)


--- trunk/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp	2012-06-21 00:31:41 UTC (rev 120888)
@@ -83,11 +83,6 @@
     m_objectStore->put(value, key, static_cast<IDBObjectStoreBackendInterface::PutMode>(putMode), IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
 }
 
-void WebIDBObjectStoreImpl::deleteFunction(const WebIDBKey& key, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
-{
-    m_objectStore->deleteFunction(key, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);
-}
-
 void WebIDBObjectStoreImpl::deleteFunction(const WebIDBKeyRange& keyRange, WebIDBCallbacks* callbacks, const WebIDBTransaction& transaction, WebExceptionCode& ec)
 {
     m_objectStore->deleteFunction(keyRange, IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec);

Modified: trunk/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h (120887 => 120888)


--- trunk/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h	2012-06-21 00:10:42 UTC (rev 120887)
+++ trunk/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h	2012-06-21 00:31:41 UTC (rev 120888)
@@ -52,7 +52,6 @@
 
     void get(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
     void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
-    void deleteFunction(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
     void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
     void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to