IndexedDB: Support Array-type key paths
authorjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 18:46:07 +0000 (18:46 +0000)
committerjsbell@chromium.org <jsbell@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 22 May 2012 18:46:07 +0000 (18:46 +0000)
commit800c49d288ad7570ae55f334bca10e3bdd3e5617
tree10b3cd75090eb6a45e33a6ebf40417522fb4a1f4
parent4515da470b53f7fc6a231300de65672cd719a140
IndexedDB: Support Array-type key paths
https://bugs.webkit.org/show_bug.cgi?id=84207

Reviewed by Tony Chang.

Source/WebCore:

Implement IDB spec behavior that key paths can be arrays of strings; when
evaluated, these yield arrays of keys, providing compound key support. Also
changes exception types to match the spec.

Test: storage/indexeddb/keypath-arrays.html
Test: storage/indexeddb/keypath-basics.html

* Modules/indexeddb/IDBDatabase.cpp:
(WebCore::IDBDatabase::createObjectStore): Look for both string and array in option dict,
throw exceptions for forbidden combinations of key generator and key paths.
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::createIndex): Handle special cases (accepted and forbidden).
(WebCore):
* Modules/indexeddb/IDBObjectStore.h:
(IDBObjectStore):
(WebCore::IDBObjectStore::createIndex): Overloads to satisfy IDL overloads and optional dicts.
* Modules/indexeddb/IDBObjectStore.idl: Add DOMString array overload.
* bindings/v8/IDBBindingUtilities.cpp: Implement spec logic for evaluating array key paths.
(WebCore::createIDBKeyFromSerializedValueAndKeyPath):
(WebCore):

LayoutTests:

* storage/indexeddb/keypath-arrays-expected.txt: Added.
* storage/indexeddb/keypath-arrays.html: Added.
* storage/indexeddb/keypath-basics-expected.txt:
* storage/indexeddb/mozilla/create-objectstore-basics-expected.txt:
* storage/indexeddb/mozilla/resources/create-objectstore-basics.js:
(cleanDatabase):
* storage/indexeddb/objectStore-required-arguments-expected.txt:
* storage/indexeddb/resources/keypath-arrays.js: Added.
(test.request.onsuccess):
(test):
(openSuccess.request.onsuccess):
(openSuccess):
(testKeyPaths.checkStore.request.onsuccess):
(testKeyPaths.checkStore):
(testKeyPaths.checkIndex.request.onsuccess):
(testKeyPaths.checkIndex):
(testKeyPaths):
* storage/indexeddb/resources/keypath-basics.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@118011 268f45cc-cd09-0410-ab3c-d52691b4dbfc
15 files changed:
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/keypath-arrays-expected.txt [new file with mode: 0644]
LayoutTests/storage/indexeddb/keypath-arrays.html [new file with mode: 0644]
LayoutTests/storage/indexeddb/keypath-basics-expected.txt
LayoutTests/storage/indexeddb/mozilla/create-objectstore-basics-expected.txt
LayoutTests/storage/indexeddb/mozilla/resources/create-objectstore-basics.js
LayoutTests/storage/indexeddb/objectStore-required-arguments-expected.txt
LayoutTests/storage/indexeddb/resources/keypath-arrays.js [new file with mode: 0644]
LayoutTests/storage/indexeddb/resources/keypath-basics.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
Source/WebCore/Modules/indexeddb/IDBObjectStore.h
Source/WebCore/Modules/indexeddb/IDBObjectStore.idl
Source/WebCore/bindings/v8/IDBBindingUtilities.cpp