Changeset 195765 in webkit
- Timestamp:
- Jan 28, 2016 11:20:25 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r195752 r195765 1 2016-01-28 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Index uniqueness broken in the SQLite backend. 4 https://bugs.webkit.org/show_bug.cgi?id=153596 5 6 Reviewed by Alex Christensen. 7 8 * platform/mac-wk1/TestExpectations: 9 1 10 2016-01-28 Zalan Bujtas <zalan@apple.com> 2 11 -
trunk/LayoutTests/platform/mac-wk1/TestExpectations
r195709 r195765 459 459 storage/indexeddb/get-keyrange.html [ Failure ] 460 460 storage/indexeddb/index-duplicate-keypaths.html [ Failure ] 461 storage/indexeddb/index-multientry.html [ Failure ]462 storage/indexeddb/index-population.html [ Failure ]463 storage/indexeddb/index-unique.html [ Failure ]464 461 storage/indexeddb/key-generator.html [ Failure ] 465 storage/indexeddb/lazy-index-population.html [ Failure ]466 storage/indexeddb/lazy-index-types.html [ Failure ]467 462 storage/indexeddb/modern/cursor-7.html [ Failure ] 468 storage/indexeddb/modern/deleteindex-1.html [ Failure ]469 storage/indexeddb/modern/deleteindex-2.html [ Failure ]470 463 storage/indexeddb/modern/get-keyrange.html [ Failure ] 471 464 storage/indexeddb/modern/idbobjectstore-delete-1.html [ Failure ] 472 465 storage/indexeddb/modern/index-3.html [ Failure ] 473 storage/indexeddb/modern/index-4.html [ Failure ]474 466 storage/indexeddb/mozilla/cursor-mutation.html [ Failure ] 475 467 storage/indexeddb/mozilla/cursors.html [ Failure ] 476 storage/indexeddb/mozilla/index-prev-no-duplicate.html [ Failure ]477 storage/indexeddb/mozilla/indexes.html [ Failure ]478 468 storage/indexeddb/objectstore-autoincrement.html [ Failure ] 479 storage/indexeddb/objectstore-basics.html [ Failure ]480 storage/indexeddb/opencursor-key.html [ Failure ]481 469 482 470 # SQLite backend tests that timeout -
trunk/Source/WebCore/ChangeLog
r195764 r195765 1 2016-01-28 Brady Eidson <beidson@apple.com> 2 3 Modern IDB: Index uniqueness broken in the SQLite backend. 4 https://bugs.webkit.org/show_bug.cgi?id=153596 5 6 Reviewed by Alex Christensen. 7 8 No new tests (Many failing tests now pass, others improve). 9 10 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 11 (WebCore::IDBServer::SQLiteIDBBackingStore::createIndex): 12 (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedHasIndexRecord): 13 (WebCore::IDBServer::SQLiteIDBBackingStore::uncheckedPutIndexKey): 14 (WebCore::IDBServer::SQLiteIDBBackingStore::updateOneIndexForAddRecord): 15 (WebCore::IDBServer::SQLiteIDBBackingStore::updateAllIndexesForAddRecord): 16 (WebCore::IDBServer::SQLiteIDBBackingStore::addRecord): 17 (WebCore::IDBServer::SQLiteIDBBackingStore::updateIndexesForAddRecord): Deleted. 18 * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 19 1 20 2016-01-08 Jer Noble <jer.noble@apple.com> 2 21 -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r195697 r195765 712 712 IDBError SQLiteIDBBackingStore::createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo& info) 713 713 { 714 LOG(IndexedDB, "SQLiteIDBBackingStore::createIndex - ObjectStore %" PRIu64 ", Index %" PRIu64, info.objectStoreIdentifier(), info.identifier()); 714 715 ASSERT(m_sqliteDB); 715 716 ASSERT(m_sqliteDB->isOpen()); … … 753 754 } 754 755 755 JSLockHolder locker(vm());756 757 756 while (!cursor->currentKey().isNull()) { 758 757 auto& key = cursor->currentKey(); 759 auto& valueBuffer = cursor->currentValueBuffer(); 760 761 auto value = deserializeIDBValueBuffer(m_globalObject->globalExec(), Vector<uint8_t>(valueBuffer), true); 762 763 IndexKey indexKey; 764 generateIndexKeyForValue(*m_globalObject->globalExec(), info, value.jsValue(), indexKey); 765 766 if (!info.multiEntry()) { 767 IDBError error = uncheckedPutIndexRecord(info.objectStoreIdentifier(), info.identifier(), key, indexKey.asOneKey()); 768 if (!error.isNull()) { 769 LOG_ERROR("Unable to put index record for newly created index"); 770 return error; 771 } 772 } 773 774 Vector<IDBKeyData> indexKeys = indexKey.multiEntry(); 775 776 if (info.unique()) { 777 bool hasRecord; 778 IDBError error; 779 for (auto& indexKey : indexKeys) { 780 error = uncheckedHasIndexRecord(info.identifier(), indexKey, hasRecord); 781 if (hasRecord) 782 return IDBError(IDBDatabaseException::ConstraintError); 783 if (!error.isNull()) 784 return error; 785 } 786 } 787 788 for (auto& indexKey : indexKeys) { 789 IDBError error = uncheckedPutIndexRecord(info.objectStoreIdentifier(), info.identifier(), key, indexKey); 790 if (!error.isNull()) { 791 LOG_ERROR("Unable to put index record for newly created index"); 792 return error; 793 } 758 auto valueBuffer = ThreadSafeDataBuffer::copyVector(cursor->currentValueBuffer()); 759 760 IDBError error = updateOneIndexForAddRecord(info, key, valueBuffer); 761 if (!error.isNull()) { 762 // FIXME: Remove this newly added index. 763 return error; 794 764 } 795 765 … … 803 773 } 804 774 805 IDBError SQLiteIDBBackingStore::uncheckedHasIndexRecord( int64_t indexID, const IDBKeyData& indexKey, bool& hasRecord)775 IDBError SQLiteIDBBackingStore::uncheckedHasIndexRecord(const IDBIndexInfo& info, const IDBKeyData& indexKey, bool& hasRecord) 806 776 { 807 777 hasRecord = false; … … 813 783 } 814 784 815 SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT rowid FROM IndexRecords WHERE indexID = ? AND key = CAST(? AS TEXT);"));785 SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("SELECT rowid FROM IndexRecords WHERE indexID = ? AND objectStoreID = ? AND key = CAST(? AS TEXT);")); 816 786 if (sql.prepare() != SQLITE_OK 817 || sql.bindInt64(1, indexID) != SQLITE_OK 818 || sql.bindBlob(2, indexKeyBuffer->data(), indexKeyBuffer->size()) != SQLITE_OK) { 787 || sql.bindInt64(1, info.identifier()) != SQLITE_OK 788 || sql.bindInt64(2, info.objectStoreIdentifier()) != SQLITE_OK 789 || sql.bindBlob(3, indexKeyBuffer->data(), indexKeyBuffer->size()) != SQLITE_OK) { 819 790 LOG_ERROR("Error checking for index record in database"); 820 791 return { IDBDatabaseException::UnknownError, ASCIILiteral("Error checking for index record in database") }; … … 837 808 IDBError SQLiteIDBBackingStore::uncheckedPutIndexKey(const IDBIndexInfo& info, const IDBKeyData& key, const IndexKey& indexKey) 838 809 { 839 if (!info.multiEntry()) { 840 auto error = uncheckedPutIndexRecord(info.objectStoreIdentifier(), info.identifier(), key, indexKey.asOneKey()); 841 if (!error.isNull()) 842 LOG_ERROR("Unable to put index record for newly created index"); 843 844 return error; 845 } 846 847 Vector<IDBKeyData> indexKeys = indexKey.multiEntry(); 810 LOG(IndexedDB, "SQLiteIDBBackingStore::uncheckedPutIndexKey - (%" PRIu64 ") %s, %s", info.identifier(), key.loggingString().utf8().data(), indexKey.asOneKey().loggingString().utf8().data()); 811 812 Vector<IDBKeyData> indexKeys; 813 if (info.multiEntry()) 814 indexKeys = indexKey.multiEntry(); 815 else 816 indexKeys.append(indexKey.asOneKey()); 848 817 849 818 if (info.unique()) { … … 851 820 IDBError error; 852 821 for (auto& indexKey : indexKeys) { 853 error = uncheckedHasIndexRecord(info .identifier(), indexKey, hasRecord);822 error = uncheckedHasIndexRecord(info, indexKey, hasRecord); 854 823 if (!error.isNull()) 855 824 return error; … … 1066 1035 } 1067 1036 1068 IDBError SQLiteIDBBackingStore::updateIndexesForAddRecord(const IDBObjectStoreInfo& info, const IDBKeyData& key, const ThreadSafeDataBuffer& value) 1037 IDBError SQLiteIDBBackingStore::updateOneIndexForAddRecord(const IDBIndexInfo& info, const IDBKeyData& key, const ThreadSafeDataBuffer& value) 1038 { 1039 JSLockHolder locker(vm()); 1040 1041 auto jsValue = deserializeIDBValueDataToJSValue(*globalObject().globalExec(), value); 1042 if (jsValue.isUndefinedOrNull()) 1043 return { }; 1044 1045 IndexKey indexKey; 1046 generateIndexKeyForValue(*m_globalObject->globalExec(), info, jsValue, indexKey); 1047 1048 if (indexKey.isNull()) 1049 return { }; 1050 1051 return uncheckedPutIndexKey(info, key, indexKey); 1052 } 1053 1054 IDBError SQLiteIDBBackingStore::updateAllIndexesForAddRecord(const IDBObjectStoreInfo& info, const IDBKeyData& key, const ThreadSafeDataBuffer& value) 1069 1055 { 1070 1056 JSLockHolder locker(vm()); … … 1131 1117 } 1132 1118 1133 auto error = update IndexesForAddRecord(objectStoreInfo, keyData, value);1119 auto error = updateAllIndexesForAddRecord(objectStoreInfo, keyData, value); 1134 1120 1135 1121 // FIXME: If there was an error indexing this record, remove it. -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
r195689 r195765 89 89 90 90 IDBError deleteRecord(SQLiteIDBTransaction&, int64_t objectStoreID, const IDBKeyData&); 91 IDBError uncheckedGetKeyGeneratorValue(int64_t objectStoreID, uint64_t& outValue); 92 IDBError uncheckedSetKeyGeneratorValue(int64_t objectStoreID, uint64_t value); 93 94 IDBError updateAllIndexesForAddRecord(const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value); 95 IDBError updateOneIndexForAddRecord(const IDBIndexInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value); 91 96 IDBError uncheckedPutIndexKey(const IDBIndexInfo&, const IDBKeyData& keyValue, const IndexKey&); 92 97 IDBError uncheckedPutIndexRecord(int64_t objectStoreID, int64_t indexID, const IDBKeyData& keyValue, const IDBKeyData& indexKey); 93 IDBError uncheckedHasIndexRecord(int64_t indexID, const IDBKeyData&, bool& hasRecord); 94 IDBError uncheckedGetKeyGeneratorValue(int64_t objectStoreID, uint64_t& outValue); 95 IDBError uncheckedSetKeyGeneratorValue(int64_t objectStoreID, uint64_t value); 96 IDBError updateIndexesForAddRecord(const IDBObjectStoreInfo&, const IDBKeyData&, const ThreadSafeDataBuffer& value); 98 IDBError uncheckedHasIndexRecord(const IDBIndexInfo&, const IDBKeyData&, bool& hasRecord); 97 99 98 100 JSC::VM& vm();
Note: See TracChangeset
for help on using the changeset viewer.