IndexedDB: Implement spec behavior for multiEntry indexes with invalid/duplicate...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Jun 2012 22:28:40 +0000 (22:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Jun 2012 22:28:40 +0000 (22:28 +0000)
commit135ff1ded9e48d916eb377b666be2786dbe0a32c
tree237de12fc0dabe58be8c1b705137c6840e4e30f0
parent496bc4fb253c0302d704f4da1d17a47c4460943c
IndexedDB: Implement spec behavior for multiEntry indexes with invalid/duplicate subkeys
https://bugs.webkit.org/show_bug.cgi?id=86123

Patch by Alec Flett <alecflett@chromium.org> on 2012-06-21
Reviewed by Darin Fisher.

Source/WebCore:

Distinguish between an actual invalid IDBKey, and an array of
possibly-invalid subkeys by making IDBKey::isValid() check subkeys
if the type is an array.

Introduce a new way to transform an IDBKey into a
multiEntry-specific IDBKey, (IDBKey::createMultiEntryArray)
throwing out duplicates and invalid keys. Use it when storing
index entries for multiEntry indexes.

No new tests: existing tests have been altered to include new behavior.

* Modules/indexeddb/IDBCursor.cpp:
(WebCore::IDBCursor::continueFunction):
* Modules/indexeddb/IDBFactory.cpp:
(WebCore::IDBFactory::cmp):
* Modules/indexeddb/IDBIndex.cpp:
(WebCore::IDBIndex::get):
(WebCore::IDBIndex::getKey):
* Modules/indexeddb/IDBKey.cpp:
(WebCore::IDBKey::isValid):
(WebCore):
* Modules/indexeddb/IDBKey.h:
(WebCore::IDBKey::createMultiEntryArray):
(IDBKey):
* Modules/indexeddb/IDBKeyRange.cpp:
(WebCore::IDBKeyRange::only):
(WebCore::IDBKeyRange::lowerBound):
(WebCore::IDBKeyRange::upperBound):
(WebCore::IDBKeyRange::bound):
* Modules/indexeddb/IDBLevelDBBackingStore.cpp:
(WebCore::IDBLevelDBBackingStore::putObjectStoreRecord):
(WebCore::IDBLevelDBBackingStore::putIndexDataForRecord):
* Modules/indexeddb/IDBLevelDBCoding.cpp:
(WebCore::IDBLevelDBCoding::encodeIDBKey):
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::get):
(WebCore::IDBObjectStore::add):
(WebCore::IDBObjectStore::put):
* Modules/indexeddb/IDBObjectStoreBackendImpl.cpp:
(WebCore::IDBObjectStoreBackendImpl::putInternal):
(WebCore):
* bindings/v8/IDBBindingUtilities.cpp:
(WebCore::createIDBKeyFromValue):

Source/WebKit/chromium:

Add matching isValid() to WebIDBKey to match the one in IDBKey.

* public/WebIDBKey.h:
* src/WebIDBKey.cpp:
(WebKit::WebIDBKey::isValid):
(WebKit):
* src/WebIDBKeyRange.cpp:
(WebKit::WebIDBKeyRange::assign):

LayoutTests:

* storage/indexeddb/index-multientry-expected.txt:
* storage/indexeddb/resources/index-multientry.js:
(addData):
(verifyIndexes.request.onsuccess):
(verifyIndexes):
(verifyUniqueConstraint.request.onsuccess.request.onsuccess.request.onerror):
(verifyUniqueConstraint.request.onsuccess.request.onsuccess):
(verifyUniqueConstraint.request.onsuccess):
(verifyUniqueConstraint):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/index-multientry-expected.txt
LayoutTests/storage/indexeddb/resources/index-multientry.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBCursor.cpp
Source/WebCore/Modules/indexeddb/IDBFactory.cpp
Source/WebCore/Modules/indexeddb/IDBKey.cpp
Source/WebCore/Modules/indexeddb/IDBKey.h
Source/WebCore/Modules/indexeddb/IDBLevelDBBackingStore.cpp
Source/WebCore/Modules/indexeddb/IDBLevelDBCoding.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStoreBackendImpl.cpp
Source/WebCore/bindings/v8/IDBBindingUtilities.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebIDBKey.h
Source/WebKit/chromium/src/WebIDBKey.cpp
Source/WebKit/chromium/src/WebIDBKeyRange.cpp