Skip to content
  • commit-queue@webkit.org's avatar
    IndexedDB: Implement spec behavior for multiEntry indexes with invalid/duplicate subkeys · d6d57718
    commit-queue@webkit.org authored
    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: http://svn.webkit.org/repository/webkit/trunk@120967 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    d6d57718