Changeset 207761 in webkit
- Timestamp:
- Oct 24, 2016 9:24:09 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 58 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207757 r207761 1 2016-10-24 Brady Eidson <beidson@apple.com> 2 3 IndexedDB 2.0: Support IDBIndex name assignment. 4 <rdar://problem/28806932> and https://bugs.webkit.org/show_bug.cgi?id=163805 5 6 Reviewed by Alex Christensen. 7 8 * storage/indexeddb/modern/index-rename-1-expected.txt: Added. 9 * storage/indexeddb/modern/index-rename-1-private-expected.txt: Added. 10 * storage/indexeddb/modern/index-rename-1-private.html: Added. 11 * storage/indexeddb/modern/index-rename-1.html: Added. 12 * storage/indexeddb/modern/resources/index-rename-1.js: Added. 13 14 * storage/indexeddb/readonly-expected.txt: 15 * storage/indexeddb/readonly-private-expected.txt: 16 * storage/indexeddb/resources/readonly.js: Removed the test that verifies that index names are 17 readonly as they are no longer readonly. 18 1 19 2016-10-24 Dave Hyatt <hyatt@apple.com> 2 20 -
trunk/LayoutTests/imported/w3c/ChangeLog
r207710 r207761 1 2016-10-24 Brady Eidson <beidson@apple.com> 2 3 IndexedDB 2.0: Support IDBIndex name assignment. 4 <rdar://problem/28806932> and https://bugs.webkit.org/show_bug.cgi?id=163805 5 6 Reviewed by Alex Christensen. 7 8 * web-platform-tests/IndexedDB/idbindex-rename-errors-expected.txt: 9 * web-platform-tests/IndexedDB/idbindex-rename-expected.txt: 10 1 11 2016-10-22 Ryosuke Niwa <rniwa@webkit.org> 2 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-rename-errors-expected.txt
r206999 r207761 1 1 2 FAIL IndexedDB deleted index rename throws assert_throws: function "() => index.name = 'renamed_by_author'" did not throw 3 FAIL IndexedDB index rename throws in a readonly transaction assert_throws: function "() => index.name = 'renamed_by_author'" did not throw 4 FAIL IndexedDB index rename throws in a readwrite transaction assert_throws: function "() => index.name = 'renamed_by_author'" did not throw 5 FAIL IndexedDB index rename throws in an inactive transaction assert_throws: function "() => authorIndex.name = 'renamed_by_author'" did not throw 6 FAIL IndexedDB index rename to the name of another index throws assert_throws: function "() => index.name = 'by_title'" did not throw 7 FAIL IndexedDB index rename handles exceptions when stringifying names assert_throws: IDBObjectStore rename should re-raise toString() exception function "() => { 8 index.name = { 9 toSt..." did not throw 2 PASS IndexedDB deleted index rename throws 3 PASS IndexedDB index rename throws in a readonly transaction 4 PASS IndexedDB index rename throws in a readwrite transaction 5 FAIL IndexedDB index rename throws in an inactive transaction assert_throws: function "() => authorIndex.name = 'renamed_by_author'" threw object "InvalidStateError (DOM Exception 11): Failed set property..." that is not a DOMException TransactionInactiveError: property "code" is equal to 11, expected 0 6 FAIL IndexedDB index rename to the name of another index throws assert_throws: function "() => index.name = 'by_title'" threw object "InvalidStateError (DOM Exception 11): Failed set property..." that is not a DOMException ConstraintError: property "code" is equal to 11, expected 0 7 PASS IndexedDB index rename handles exceptions when stringifying names 10 8 -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbindex-rename-expected.txt
r206999 r207761 1 1 2 FAIL IndexedDB index rename in new transaction assert_equals: IDBIndex name should change immediately after a rename expected "renamed_by_author" but got "by_author" 3 FAIL IndexedDB index rename in the transaction where it is created assert_equals: IDBIndex name should change immediately after a rename expected "renamed_by_author" but got "by_author" 2 PASS IndexedDB index rename in new transaction 3 PASS IndexedDB index rename in the transaction where it is created 4 4 PASS IndexedDB index rename to the same name succeeds 5 FAIL IndexedDB index rename to the name of a deleted index succeeds assert_array_equals: IDBObjectStore.indexNames should immediately reflect the rename property 0, expected "by_title" but got "by_author" 6 FAIL IndexedDB index swapping via renames succeeds Failed to execute 'index' on 'IDBObjectStore': The specified index was not found. 7 FAIL IndexedDB index rename stringifies non-string names assert_equals: IDBIndex name should change immediately after a rename to a number expected "42" but got "by_author" 8 FAIL IndexedDB index can be renamed to "" assert_equals: IDBIndex name should change immediately after the rename expected "" but got "by_author" 9 FAIL IndexedDB index can be renamed to "\u0000" assert_equals: IDBIndex name should change immediately after the rename expected "\0" but got "by_author" 10 FAIL IndexedDB index can be renamed to "\uDC00\uD800" assert_equals: IDBIndex name should change immediately after the rename expected "í°í " but got "by_author" 5 PASS IndexedDB index rename to the name of a deleted index succeeds 6 PASS IndexedDB index swapping via renames succeeds 7 PASS IndexedDB index rename stringifies non-string names 8 PASS IndexedDB index can be renamed to "" 9 PASS IndexedDB index can be renamed to "\u0000" 10 PASS IndexedDB index can be renamed to "\uDC00\uD800" 11 11 -
trunk/LayoutTests/storage/indexeddb/readonly-expected.txt
r207641 r207761 36 36 PASS cursor.primaryKey is still first 37 37 index = objectStore.createIndex('first', 'first'); 38 trying to set readonly property index.name39 index.name = 'bar'40 PASS index.name is still first41 38 trying to set readonly property index.objectStore 42 39 index.objectStore = this -
trunk/LayoutTests/storage/indexeddb/readonly-private-expected.txt
r207641 r207761 36 36 PASS cursor.primaryKey is still first 37 37 index = objectStore.createIndex('first', 'first'); 38 trying to set readonly property index.name39 index.name = 'bar'40 PASS index.name is still first41 38 trying to set readonly property index.objectStore 42 39 index.objectStore = this -
trunk/LayoutTests/storage/indexeddb/resources/readonly.js
r207641 r207761 64 64 65 65 index = evalAndLog("index = objectStore.createIndex('first', 'first');"); 66 setReadonlyProperty("index.name", "'bar'");67 66 setReadonlyProperty("index.objectStore", "this"); 68 67 setReadonlyProperty("index.keyPath", "'bar'"); -
trunk/Source/WebCore/ChangeLog
r207759 r207761 1 2016-10-24 Brady Eidson <beidson@apple.com> 2 3 IndexedDB 2.0: Support IDBIndex name assignment. 4 <rdar://problem/28806932> and https://bugs.webkit.org/show_bug.cgi?id=163805 5 6 Reviewed by Alex Christensen. 7 8 Tests: storage/indexeddb/modern/index-rename-1-private.html 9 storage/indexeddb/modern/index-rename-1.html 10 11 Touches a *lot* of code sites, but none of them are particularly interesting. 12 They are all just getting the new name spread out to all of the various objects that need it. 13 14 * Modules/indexeddb/IDBDatabase.cpp: 15 (WebCore::IDBDatabase::renameIndex): 16 * Modules/indexeddb/IDBDatabase.h: 17 18 * Modules/indexeddb/IDBIndex.cpp: 19 (WebCore::IDBIndex::IDBIndex): 20 (WebCore::IDBIndex::setName): 21 (WebCore::IDBIndex::rollbackInfoForVersionChangeAbort): 22 * Modules/indexeddb/IDBIndex.h: 23 * Modules/indexeddb/IDBIndex.idl: 24 25 * Modules/indexeddb/IDBObjectStore.cpp: 26 (WebCore::IDBObjectStore::rollbackForVersionChangeAbort): 27 (WebCore::IDBObjectStore::renameReferencedIndex): 28 (WebCore::IDBObjectStore::rollbackInfoForVersionChangeAbort): Deleted. 29 * Modules/indexeddb/IDBObjectStore.h: 30 31 * Modules/indexeddb/IDBTransaction.cpp: 32 (WebCore::IDBTransaction::internalAbort): 33 (WebCore::IDBTransaction::renameIndex): 34 (WebCore::IDBTransaction::renameIndexOnServer): 35 (WebCore::IDBTransaction::didRenameIndexOnServer): 36 * Modules/indexeddb/IDBTransaction.h: 37 38 * Modules/indexeddb/client/IDBConnectionProxy.cpp: 39 (WebCore::IDBClient::IDBConnectionProxy::renameIndex): 40 * Modules/indexeddb/client/IDBConnectionProxy.h: 41 42 * Modules/indexeddb/client/IDBConnectionToServer.cpp: 43 (WebCore::IDBClient::IDBConnectionToServer::renameIndex): 44 (WebCore::IDBClient::IDBConnectionToServer::didRenameIndex): 45 * Modules/indexeddb/client/IDBConnectionToServer.h: 46 * Modules/indexeddb/client/IDBConnectionToServerDelegate.h: 47 48 * Modules/indexeddb/client/TransactionOperation.h: 49 (WebCore::IDBClient::createTransactionOperation): 50 51 * Modules/indexeddb/server/IDBBackingStore.h: 52 53 * Modules/indexeddb/server/IDBConnectionToClient.cpp: 54 (WebCore::IDBServer::IDBConnectionToClient::didRenameIndex): 55 * Modules/indexeddb/server/IDBConnectionToClient.h: 56 * Modules/indexeddb/server/IDBConnectionToClientDelegate.h: 57 58 * Modules/indexeddb/server/IDBServer.cpp: 59 (WebCore::IDBServer::IDBServer::renameIndex): 60 * Modules/indexeddb/server/IDBServer.h: 61 62 * Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp: 63 (WebCore::IDBServer::MemoryBackingStoreTransaction::indexRenamed): 64 (WebCore::IDBServer::MemoryBackingStoreTransaction::abort): 65 * Modules/indexeddb/server/MemoryBackingStoreTransaction.h: 66 67 * Modules/indexeddb/server/MemoryIDBBackingStore.cpp: 68 (WebCore::IDBServer::MemoryIDBBackingStore::renameIndex): 69 * Modules/indexeddb/server/MemoryIDBBackingStore.h: 70 71 * Modules/indexeddb/server/MemoryIndex.h: 72 (WebCore::IDBServer::MemoryIndex::rename): 73 74 * Modules/indexeddb/server/MemoryObjectStore.cpp: 75 (WebCore::IDBServer::MemoryObjectStore::renameIndex): 76 * Modules/indexeddb/server/MemoryObjectStore.h: 77 78 * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: 79 (WebCore::IDBServer::SQLiteIDBBackingStore::renameIndex): 80 * Modules/indexeddb/server/SQLiteIDBBackingStore.h: 81 82 * Modules/indexeddb/server/UniqueIDBDatabase.cpp: 83 (WebCore::IDBServer::UniqueIDBDatabase::renameIndex): 84 (WebCore::IDBServer::UniqueIDBDatabase::performRenameIndex): 85 (WebCore::IDBServer::UniqueIDBDatabase::didPerformRenameIndex): 86 * Modules/indexeddb/server/UniqueIDBDatabase.h: 87 88 * Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp: 89 (WebCore::IDBServer::UniqueIDBDatabaseConnection::didRenameIndex): 90 * Modules/indexeddb/server/UniqueIDBDatabaseConnection.h: 91 92 * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp: 93 (WebCore::IDBServer::UniqueIDBDatabaseTransaction::renameIndex): 94 * Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h: 95 96 * Modules/indexeddb/shared/IDBIndexInfo.h: 97 (WebCore::IDBIndexInfo::rename): 98 99 * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp: 100 (WebCore::IDBObjectStoreInfo::infoForExistingIndex): 101 * Modules/indexeddb/shared/IDBObjectStoreInfo.h: 102 103 * Modules/indexeddb/shared/IDBResultData.cpp: 104 (WebCore::IDBResultData::renameIndexSuccess): 105 * Modules/indexeddb/shared/IDBResultData.h: 106 107 * Modules/indexeddb/shared/InProcessIDBServer.cpp: 108 (WebCore::InProcessIDBServer::didRenameIndex): 109 (WebCore::InProcessIDBServer::renameIndex): 110 * Modules/indexeddb/shared/InProcessIDBServer.h: 111 1 112 2016-10-24 Dave Hyatt <hyatt@apple.com> 2 113 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.cpp
r207641 r207761 35 35 #include "IDBConnectionToServer.h" 36 36 #include "IDBDatabaseException.h" 37 #include "IDBIndex.h" 37 38 #include "IDBObjectStore.h" 38 39 #include "IDBOpenDBRequest.h" … … 116 117 117 118 m_versionChangeTransaction->renameObjectStore(objectStore, newName); 119 } 120 121 void IDBDatabase::renameIndex(IDBIndex& index, const String& newName) 122 { 123 ASSERT(currentThread() == originThreadID()); 124 ASSERT(m_versionChangeTransaction); 125 ASSERT(m_info.hasObjectStore(index.objectStore().info().name())); 126 ASSERT(m_info.infoForExistingObjectStore(index.objectStore().info().name())->hasIndex(index.info().name())); 127 128 m_info.infoForExistingObjectStore(index.objectStore().info().name())->infoForExistingIndex(index.info().identifier())->rename(newName); 129 130 m_versionChangeTransaction->renameIndex(index, newName); 118 131 } 119 132 -
trunk/Source/WebCore/Modules/indexeddb/IDBDatabase.h
r207641 r207761 64 64 65 65 void renameObjectStore(IDBObjectStore&, const String& newName); 66 void renameIndex(IDBIndex&, const String& newName); 66 67 67 68 // EventTarget -
trunk/Source/WebCore/Modules/indexeddb/IDBIndex.cpp
r206976 r207761 46 46 : ActiveDOMObject(&context) 47 47 , m_info(info) 48 , m_originalInfo(info) 48 49 , m_objectStore(objectStore) 49 50 { … … 79 80 } 80 81 82 ExceptionOr<void> IDBIndex::setName(const String& name) 83 { 84 ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID()); 85 86 if (m_deleted) 87 return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBIndex': The index has been deleted.") }; 88 89 if (m_objectStore.isDeleted()) 90 return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBIndex': The index's object store has been deleted.") }; 91 92 if (!m_objectStore.transaction().isVersionChange()) 93 return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBIndex': The index's transaction is not a version change transaction.") }; 94 95 if (!m_objectStore.transaction().isActive()) 96 return Exception { INVALID_STATE_ERR, ASCIILiteral("Failed set property 'name' on 'IDBIndex': The index's transaction is not active.") }; 97 98 if (m_info.name() == name) 99 return { }; 100 101 if (m_objectStore.info().hasIndex(name)) 102 return Exception { INVALID_STATE_ERR, makeString("Failed set property 'name' on 'IDBIndex': The owning object store already has an index named '", name, "'.") }; 103 104 m_objectStore.transaction().database().renameIndex(*this, name); 105 m_info.rename(name); 106 107 return { }; 108 } 109 81 110 IDBObjectStore& IDBIndex::objectStore() 82 111 { … … 101 130 ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID()); 102 131 return m_info.multiEntry(); 132 } 133 134 void IDBIndex::rollbackInfoForVersionChangeAbort() 135 { 136 ASSERT(currentThread() == m_objectStore.transaction().database().originThreadID()); 137 m_info = m_originalInfo; 103 138 } 104 139 -
trunk/Source/WebCore/Modules/indexeddb/IDBIndex.h
r206976 r207761 49 49 50 50 const String& name() const; 51 ExceptionOr<void> setName(const String&); 51 52 IDBObjectStore& objectStore(); 52 53 const IDBKeyPath& keyPath() const; 53 54 bool unique() const; 54 55 bool multiEntry() const; 56 57 void rollbackInfoForVersionChangeAbort(); 55 58 56 59 ExceptionOr<Ref<IDBRequest>> openCursor(JSC::ExecState&, IDBKeyRange*, const String& direction); … … 88 91 89 92 IDBIndexInfo m_info; 93 IDBIndexInfo m_originalInfo; 90 94 91 95 bool m_deleted { false }; -
trunk/Source/WebCore/Modules/indexeddb/IDBIndex.idl
r206976 r207761 31 31 SkipVTableValidation, 32 32 ] interface IDBIndex { 33 readonlyattribute DOMString name;33 [SetterMayThrowException] attribute DOMString name; 34 34 readonly attribute IDBObjectStore objectStore; 35 35 [ImplementationReturnType=IDBKeyPath] readonly attribute any keyPath; -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp
r207641 r207761 527 527 } 528 528 529 void IDBObjectStore::rollback InfoForVersionChangeAbort()529 void IDBObjectStore::rollbackForVersionChangeAbort() 530 530 { 531 531 ASSERT(currentThread() == m_transaction->database().originThreadID()); 532 532 m_info = m_originalInfo; 533 534 Locker<Lock> locker(m_referencedIndexLock); 535 for (auto& index : m_referencedIndexes.values()) 536 index->rollbackInfoForVersionChangeAbort(); 533 537 } 534 538 … … 540 544 } 541 545 546 void IDBObjectStore::renameReferencedIndex(IDBIndex& index, const String& newName) 547 { 548 LOG(IndexedDB, "IDBObjectStore::renameReferencedIndex"); 549 550 auto* indexInfo = m_info.infoForExistingIndex(index.info().identifier()); 551 ASSERT(indexInfo); 552 indexInfo->rename(newName); 553 554 ASSERT(m_referencedIndexes.contains(index.info().name())); 555 ASSERT(!m_referencedIndexes.contains(newName)); 556 ASSERT(m_referencedIndexes.get(index.info().name()) == &index); 557 558 m_referencedIndexes.set(newName, m_referencedIndexes.take(index.info().name())); 559 } 560 542 561 } // namespace WebCore 543 562 -
trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.h
r207641 r207761 94 94 const IDBObjectStoreInfo& info() const { return m_info; } 95 95 96 void rollback InfoForVersionChangeAbort();96 void rollbackForVersionChangeAbort(); 97 97 98 98 void visitReferencedIndexes(JSC::SlotVisitor&) const; 99 void renameReferencedIndex(IDBIndex&, const String& newName); 99 100 100 101 private: -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp
r207641 r207761 280 280 if (isVersionChange()) { 281 281 for (auto& objectStore : m_referencedObjectStores.values()) 282 objectStore->rollback InfoForVersionChangeAbort();282 objectStore->rollbackForVersionChangeAbort(); 283 283 } 284 284 … … 676 676 // Otherwise, failure to create an index forced abortion of the transaction. 677 677 abortDueToFailedRequest(DOMError::create(IDBDatabaseException::getErrorName(resultData.error().code()), resultData.error().message())); 678 } 679 680 void IDBTransaction::renameIndex(IDBIndex& index, const String& newName) 681 { 682 LOG(IndexedDB, "IDBTransaction::renameIndex"); 683 ASSERT(isVersionChange()); 684 ASSERT(scriptExecutionContext()); 685 ASSERT(currentThread() == m_database->originThreadID()); 686 687 ASSERT(m_referencedObjectStores.contains(index.objectStore().info().name())); 688 ASSERT(m_referencedObjectStores.get(index.objectStore().info().name()) == &index.objectStore()); 689 690 index.objectStore().renameReferencedIndex(index, newName); 691 692 uint64_t objectStoreIdentifier = index.objectStore().info().identifier(); 693 uint64_t indexIdentifier = index.info().identifier(); 694 auto operation = IDBClient::createTransactionOperation(*this, &IDBTransaction::didRenameIndexOnServer, &IDBTransaction::renameIndexOnServer, objectStoreIdentifier, indexIdentifier, newName); 695 scheduleOperation(WTFMove(operation)); 696 } 697 698 void IDBTransaction::renameIndexOnServer(IDBClient::TransactionOperation& operation, const uint64_t& objectStoreIdentifier, const uint64_t& indexIdentifier, const String& newName) 699 { 700 LOG(IndexedDB, "IDBTransaction::renameIndexOnServer"); 701 ASSERT(currentThread() == m_database->originThreadID()); 702 ASSERT(isVersionChange()); 703 704 m_database->connectionProxy().renameIndex(operation, objectStoreIdentifier, indexIdentifier, newName); 705 } 706 707 void IDBTransaction::didRenameIndexOnServer(const IDBResultData& resultData) 708 { 709 LOG(IndexedDB, "IDBTransaction::didRenameIndexOnServer"); 710 ASSERT(currentThread() == m_database->originThreadID()); 711 ASSERT_UNUSED(resultData, resultData.type() == IDBResultType::RenameIndexSuccess || resultData.type() == IDBResultType::Error); 678 712 } 679 713 -
trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.h
r207641 r207761 116 116 void renameObjectStore(IDBObjectStore&, const String& newName); 117 117 std::unique_ptr<IDBIndex> createIndex(IDBObjectStore&, const IDBIndexInfo&); 118 void renameIndex(IDBIndex&, const String& newName); 118 119 119 120 Ref<IDBRequest> requestPutOrAdd(JSC::ExecState&, IDBObjectStore&, IDBKey*, SerializedScriptValue&, IndexedDB::ObjectStoreOverwriteMode); … … 179 180 void didCreateIndexOnServer(const IDBResultData&); 180 181 182 void renameIndexOnServer(IDBClient::TransactionOperation&, const uint64_t& objectStoreIdentifier, const uint64_t& indexIdentifier, const String& newName); 183 void didRenameIndexOnServer(const IDBResultData&); 184 181 185 void clearObjectStoreOnServer(IDBClient::TransactionOperation&, const uint64_t& objectStoreIdentifier); 182 186 void didClearObjectStoreOnServer(IDBRequest&, const IDBResultData&); -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.cpp
r207641 r207761 134 134 } 135 135 136 void IDBConnectionProxy::renameIndex(TransactionOperation& operation, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 137 { 138 const IDBRequestData requestData(operation); 139 saveOperation(operation); 140 141 callConnectionOnMainThread(&IDBConnectionToServer::renameIndex, requestData, objectStoreIdentifier, indexIdentifier, newName); 142 } 143 136 144 void IDBConnectionProxy::deleteObjectStore(TransactionOperation& operation, const String& objectStoreName) 137 145 { -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionProxy.h
r207641 r207761 79 79 void iterateCursor(TransactionOperation&, const IDBKeyData&, unsigned long count); 80 80 void renameObjectStore(TransactionOperation&, uint64_t objectStoreIdentifier, const String& newName); 81 void renameIndex(TransactionOperation&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName); 81 82 82 83 void fireVersionChangeEvent(uint64_t databaseConnectionIdentifier, const IDBResourceIdentifier& requestIdentifier, uint64_t requestedVersion); -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.cpp
r207641 r207761 173 173 } 174 174 175 void IDBConnectionToServer::renameIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 176 { 177 LOG(IndexedDB, "IDBConnectionToServer::renameIndex"); 178 ASSERT(isMainThread()); 179 180 m_delegate->renameIndex(requestData, objectStoreIdentifier, indexIdentifier, newName); 181 } 182 183 void IDBConnectionToServer::didRenameIndex(const IDBResultData& resultData) 184 { 185 LOG(IndexedDB, "IDBConnectionToServer::didRenameIndex"); 186 m_proxy->completeOperation(resultData); 187 } 188 175 189 void IDBConnectionToServer::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& key, const IDBValue& value, const IndexedDB::ObjectStoreOverwriteMode overwriteMode) 176 190 { -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServer.h
r207641 r207761 81 81 WEBCORE_EXPORT void didDeleteIndex(const IDBResultData&); 82 82 83 void renameIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName); 84 WEBCORE_EXPORT void didRenameIndex(const IDBResultData&); 85 83 86 void putOrAdd(const IDBRequestData&, const IDBKeyData&, const IDBValue&, const IndexedDB::ObjectStoreOverwriteMode); 84 87 WEBCORE_EXPORT void didPutOrAdd(const IDBResultData&); -
trunk/Source/WebCore/Modules/indexeddb/client/IDBConnectionToServerDelegate.h
r207641 r207761 68 68 virtual void createIndex(const IDBRequestData&, const IDBIndexInfo&) = 0; 69 69 virtual void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) = 0; 70 virtual void renameIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) = 0; 70 71 virtual void putOrAdd(const IDBRequestData&, const IDBKeyData&, const IDBValue&, const IndexedDB::ObjectStoreOverwriteMode) = 0; 71 72 virtual void getRecord(const IDBRequestData&, const IDBGetRecordData&) = 0; -
trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h
r202821 r207761 195 195 } 196 196 197 template<typename MP1, typename P1, typename MP2, typename P2, typename MP3, typename P3> 198 RefPtr<TransactionOperation> createTransactionOperation( 199 IDBTransaction& transaction, 200 void (IDBTransaction::*complete)(const IDBResultData&), 201 void (IDBTransaction::*perform)(TransactionOperation&, MP1, MP2, MP3), 202 const P1& parameter1, 203 const P2& parameter2, 204 const P3& parameter3) 205 { 206 auto operation = new TransactionOperationImpl<MP1, MP2, MP3>(transaction, complete, perform, parameter1, parameter2, parameter3); 207 return adoptRef(operation); 208 } 209 197 210 template<typename MP1, typename P1> 198 211 RefPtr<TransactionOperation> createTransactionOperation( -
trunk/Source/WebCore/Modules/indexeddb/server/IDBBackingStore.h
r207641 r207761 75 75 virtual IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) = 0; 76 76 virtual IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) = 0; 77 virtual IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) = 0; 77 78 virtual IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) = 0; 78 79 virtual IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) = 0; -
trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.cpp
r207641 r207761 94 94 } 95 95 96 void IDBConnectionToClient::didRenameIndex(const IDBResultData& result) 97 { 98 m_delegate->didRenameIndex(result); 99 } 100 96 101 void IDBConnectionToClient::didPutOrAdd(const IDBResultData& result) 97 102 { -
trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClient.h
r207641 r207761 60 60 void didCreateIndex(const IDBResultData&); 61 61 void didDeleteIndex(const IDBResultData&); 62 void didRenameIndex(const IDBResultData&); 62 63 void didPutOrAdd(const IDBResultData&); 63 64 void didGetRecord(const IDBResultData&); -
trunk/Source/WebCore/Modules/indexeddb/server/IDBConnectionToClientDelegate.h
r207641 r207761 58 58 virtual void didCreateIndex(const IDBResultData&) = 0; 59 59 virtual void didDeleteIndex(const IDBResultData&) = 0; 60 virtual void didRenameIndex(const IDBResultData&) = 0; 60 61 virtual void didPutOrAdd(const IDBResultData&) = 0; 61 62 virtual void didGetRecord(const IDBResultData&) = 0; -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.cpp
r207641 r207761 261 261 } 262 262 263 void IDBServer::renameIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 264 { 265 LOG(IndexedDB, "IDBServer::renameIndex"); 266 267 auto transaction = m_transactions.get(requestData.transactionIdentifier()); 268 if (!transaction) 269 return; 270 271 ASSERT(transaction->isVersionChange()); 272 transaction->renameIndex(requestData, objectStoreIdentifier, indexIdentifier, newName); 273 } 274 263 275 void IDBServer::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const IDBValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode) 264 276 { -
trunk/Source/WebCore/Modules/indexeddb/server/IDBServer.h
r207641 r207761 72 72 WEBCORE_EXPORT void createIndex(const IDBRequestData&, const IDBIndexInfo&); 73 73 WEBCORE_EXPORT void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName); 74 WEBCORE_EXPORT void renameIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName); 74 75 WEBCORE_EXPORT void putOrAdd(const IDBRequestData&, const IDBKeyData&, const IDBValue&, IndexedDB::ObjectStoreOverwriteMode); 75 76 WEBCORE_EXPORT void getRecord(const IDBRequestData&, const IDBGetRecordData&); -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp
r207641 r207761 161 161 } 162 162 163 void MemoryBackingStoreTransaction::indexRenamed(MemoryIndex& index, const String& oldName) 164 { 165 ASSERT(m_objectStores.contains(&index.objectStore())); 166 ASSERT(m_info.mode() == IndexedDB::TransactionMode::VersionChange); 167 168 // We only care about the first rename in a given transaction, because if the transaction is aborted we want 169 // to go back to the first 'oldName' 170 m_originalIndexNames.add(&index, oldName); 171 } 172 163 173 void MemoryBackingStoreTransaction::indexCleared(MemoryIndex& index, std::unique_ptr<IndexValueStore>&& valueStore) 164 174 { … … 203 213 204 214 TemporaryChange<bool> change(m_isAborting, true); 215 216 for (auto iterator : m_originalIndexNames) 217 iterator.key->rename(iterator.value); 218 m_originalIndexNames.clear(); 205 219 206 220 for (auto iterator : m_originalObjectStoreNames) -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h
r207641 r207761 66 66 void objectStoreCleared(MemoryObjectStore&, std::unique_ptr<KeyValueMap>&&, std::unique_ptr<std::set<IDBKeyData>>&&); 67 67 void objectStoreRenamed(MemoryObjectStore&, const String& oldName); 68 void indexRenamed(MemoryIndex&, const String& oldName); 68 69 void indexCleared(MemoryIndex&, std::unique_ptr<IndexValueStore>&&); 69 70 … … 98 99 HashMap<MemoryObjectStore*, std::unique_ptr<std::set<IDBKeyData>>> m_clearedOrderedKeys; 99 100 HashMap<MemoryObjectStore*, String> m_originalObjectStoreNames; 101 HashMap<MemoryIndex*, String> m_originalIndexNames; 100 102 HashMap<MemoryIndex*, std::unique_ptr<IndexValueStore>> m_clearedIndexValueStores; 101 103 }; -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.cpp
r207641 r207761 249 249 } 250 250 251 IDBError MemoryIDBBackingStore::renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 252 { 253 LOG(IndexedDB, "MemoryIDBBackingStore::renameIndex"); 254 255 ASSERT(m_databaseInfo); 256 auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier); 257 if (!objectStoreInfo) 258 return IDBError(IDBDatabaseException::ConstraintError); 259 260 auto* indexInfo = objectStoreInfo->infoForExistingIndex(indexIdentifier); 261 if (!indexInfo) 262 return IDBError(IDBDatabaseException::ConstraintError); 263 264 auto transaction = m_transactions.get(transactionIdentifier); 265 ASSERT(transaction); 266 ASSERT(transaction->isVersionChange()); 267 268 auto objectStore = m_objectStoresByIdentifier.get(objectStoreIdentifier); 269 ASSERT(objectStore); 270 if (!objectStore) 271 return IDBError(IDBDatabaseException::ConstraintError); 272 273 auto* index = objectStore->indexForIdentifier(indexIdentifier); 274 ASSERT(index); 275 if (!index) 276 return IDBError(IDBDatabaseException::ConstraintError); 277 278 String oldName = index->info().name(); 279 objectStore->renameIndex(*index, newName); 280 transaction->indexRenamed(*index, oldName); 281 282 indexInfo->rename(newName); 283 284 return IDBError(); 285 } 286 251 287 void MemoryIDBBackingStore::removeObjectStoreForVersionChangeAbort(MemoryObjectStore& objectStore) 252 288 { -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIDBBackingStore.h
r207641 r207761 59 59 IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) final; 60 60 IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) final; 61 IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) final; 61 62 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) final; 62 63 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) final; -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryIndex.h
r199668 r207761 63 63 const IDBIndexInfo& info() const { return m_info; } 64 64 65 void rename(const String& newName) { m_info.rename(newName); } 66 65 67 IDBGetResult getResultForKeyRange(IndexedDB::IndexRecordType, const IDBKeyRangeData&) const; 66 68 uint64_t countForKeyRange(const IDBKeyRangeData&); -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
r201665 r207761 476 476 } 477 477 478 void MemoryObjectStore::renameIndex(MemoryIndex& index, const String& newName) 479 { 480 ASSERT(m_indexesByName.get(index.info().name()) == &index); 481 ASSERT(!m_indexesByName.contains(newName)); 482 ASSERT(m_info.infoForExistingIndex(index.info().name())); 483 484 m_info.infoForExistingIndex(index.info().name())->rename(newName); 485 m_indexesByName.set(newName, m_indexesByName.take(index.info().name())); 486 index.rename(newName); 487 } 488 478 489 } // namespace IDBServer 479 490 } // namespace WebCore -
trunk/Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h
r207641 r207761 99 99 100 100 void rename(const String& newName) { m_info.rename(newName); } 101 void renameIndex(MemoryIndex&, const String& newName); 101 102 102 103 private: -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.cpp
r207641 r207761 1276 1276 } 1277 1277 1278 IDBError SQLiteIDBBackingStore::renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 1279 { 1280 LOG(IndexedDB, "SQLiteIDBBackingStore::renameIndex - object store %" PRIu64 ", index %" PRIu64, objectStoreIdentifier, indexIdentifier); 1281 1282 ASSERT(m_sqliteDB); 1283 ASSERT(m_sqliteDB->isOpen()); 1284 1285 auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier); 1286 if (!objectStoreInfo) 1287 return { IDBDatabaseException::UnknownError, ASCIILiteral("Could not rename index") }; 1288 1289 auto* indexInfo = objectStoreInfo->infoForExistingIndex(indexIdentifier); 1290 if (!indexInfo) 1291 return { IDBDatabaseException::UnknownError, ASCIILiteral("Could not rename index") }; 1292 1293 auto* transaction = m_transactions.get(transactionIdentifier); 1294 if (!transaction || !transaction->inProgress()) { 1295 LOG_ERROR("Attempt to rename an index without an in-progress transaction"); 1296 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an index without an in-progress transaction") }; 1297 } 1298 1299 if (transaction->mode() != IndexedDB::TransactionMode::VersionChange) { 1300 LOG_ERROR("Attempt to rename an index in a non-version-change transaction"); 1301 return { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename an index in a non-version-change transaction") }; 1302 } 1303 1304 { 1305 SQLiteStatement sql(*m_sqliteDB, ASCIILiteral("UPDATE IndexInfo SET name = ? WHERE objectStoreID = ? AND id = ?;")); 1306 if (sql.prepare() != SQLITE_OK 1307 || sql.bindText(1, newName) != SQLITE_OK 1308 || sql.bindInt64(2, objectStoreIdentifier) != SQLITE_OK 1309 || sql.bindInt64(3, indexIdentifier) != SQLITE_OK 1310 || sql.step() != SQLITE_DONE) { 1311 LOG_ERROR("Could not update name for index id (%" PRIi64 ", %" PRIi64 ") in IndexInfo table (%i) - %s", objectStoreIdentifier, indexIdentifier, m_sqliteDB->lastError(), m_sqliteDB->lastErrorMsg()); 1312 return { IDBDatabaseException::UnknownError, ASCIILiteral("Could not rename index") }; 1313 } 1314 } 1315 1316 indexInfo->rename(newName); 1317 1318 return { }; 1319 } 1320 1278 1321 IDBError SQLiteIDBBackingStore::keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreID, const IDBKeyData& keyData, bool& keyExists) 1279 1322 { -
trunk/Source/WebCore/Modules/indexeddb/server/SQLiteIDBBackingStore.h
r207641 r207761 63 63 IDBError createIndex(const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&) final; 64 64 IDBError deleteIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier) final; 65 IDBError renameIndex(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) final; 65 66 IDBError keyExistsInObjectStore(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, bool& keyExists) final; 66 67 IDBError deleteRange(const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&) final; -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.cpp
r207641 r207761 820 820 } 821 821 822 void UniqueIDBDatabase::renameIndex(UniqueIDBDatabaseTransaction& transaction, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName, ErrorCallback callback) 823 { 824 ASSERT(isMainThread()); 825 LOG(IndexedDB, "(main) UniqueIDBDatabase::renameIndex"); 826 827 uint64_t callbackID = storeCallbackOrFireError(callback); 828 if (!callbackID) 829 return; 830 831 auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier); 832 if (!objectStoreInfo) { 833 performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename index in non-existant object store") }); 834 return; 835 } 836 837 auto* indexInfo = objectStoreInfo->infoForExistingIndex(indexIdentifier); 838 if (!indexInfo) { 839 performErrorCallback(callbackID, { IDBDatabaseException::UnknownError, ASCIILiteral("Attempt to rename non-existant index") }); 840 return; 841 } 842 843 postDatabaseTask(createCrossThreadTask(*this, &UniqueIDBDatabase::performRenameIndex, callbackID, transaction.info().identifier(), objectStoreIdentifier, indexIdentifier, newName)); 844 } 845 846 void UniqueIDBDatabase::performRenameIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 847 { 848 ASSERT(!isMainThread()); 849 LOG(IndexedDB, "(db) UniqueIDBDatabase::performRenameIndex"); 850 851 ASSERT(m_backingStore); 852 m_backingStore->renameIndex(transactionIdentifier, objectStoreIdentifier, indexIdentifier, newName); 853 854 IDBError error; 855 postDatabaseTaskReply(createCrossThreadTask(*this, &UniqueIDBDatabase::didPerformRenameIndex, callbackIdentifier, error, objectStoreIdentifier, indexIdentifier, newName)); 856 } 857 858 void UniqueIDBDatabase::didPerformRenameIndex(uint64_t callbackIdentifier, const IDBError& error, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 859 { 860 ASSERT(isMainThread()); 861 LOG(IndexedDB, "(main) UniqueIDBDatabase::didPerformRenameIndex"); 862 863 if (error.isNull()) { 864 auto* objectStoreInfo = m_databaseInfo->infoForExistingObjectStore(objectStoreIdentifier); 865 ASSERT(objectStoreInfo); 866 if (objectStoreInfo) { 867 auto* indexInfo = objectStoreInfo->infoForExistingIndex(indexIdentifier); 868 ASSERT(indexInfo); 869 indexInfo->rename(newName); 870 } 871 } 872 873 performErrorCallback(callbackIdentifier, error); 874 } 875 822 876 void UniqueIDBDatabase::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const IDBValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode, KeyDataCallback callback) 823 877 { -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabase.h
r207641 r207761 92 92 void createIndex(UniqueIDBDatabaseTransaction&, const IDBIndexInfo&, ErrorCallback); 93 93 void deleteIndex(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, const String& indexName, ErrorCallback); 94 void renameIndex(UniqueIDBDatabaseTransaction&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName, ErrorCallback); 94 95 void putOrAdd(const IDBRequestData&, const IDBKeyData&, const IDBValue&, IndexedDB::ObjectStoreOverwriteMode, KeyDataCallback); 95 96 void getRecord(const IDBRequestData&, const IDBGetRecordData&, GetResultCallback); … … 150 151 void performCreateIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, const IDBIndexInfo&); 151 152 void performDeleteIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier); 153 void performRenameIndex(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName); 152 154 void performPutOrAdd(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyData&, const IDBValue&, IndexedDB::ObjectStoreOverwriteMode); 153 155 void performGetRecord(uint64_t callbackIdentifier, const IDBResourceIdentifier& transactionIdentifier, uint64_t objectStoreIdentifier, const IDBKeyRangeData&); … … 169 171 void didPerformCreateIndex(uint64_t callbackIdentifier, const IDBError&, const IDBIndexInfo&); 170 172 void didPerformDeleteIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier); 173 void didPerformRenameIndex(uint64_t callbackIdentifier, const IDBError&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName); 171 174 void didPerformPutOrAdd(uint64_t callbackIdentifier, const IDBError&, const IDBKeyData&); 172 175 void didPerformGetRecord(uint64_t callbackIdentifier, const IDBError&, const IDBGetResult&); -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.cpp
r207641 r207761 213 213 } 214 214 215 void UniqueIDBDatabaseConnection::didRenameIndex(const IDBResultData& resultData) 216 { 217 LOG(IndexedDB, "UniqueIDBDatabaseConnection::didRenameIndex"); 218 219 m_connectionToClient.didRenameIndex(resultData); 220 } 221 215 222 } // namespace IDBServer 216 223 } // namespace WebCore -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseConnection.h
r207641 r207761 74 74 void didCreateIndex(const IDBResultData&); 75 75 void didDeleteIndex(const IDBResultData&); 76 void didRenameIndex(const IDBResultData&); 76 77 void didFireVersionChangeEvent(const IDBResourceIdentifier& requestIdentifier); 77 78 void didFinishHandlingVersionChange(const IDBResourceIdentifier& transactionIdentifier); -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.cpp
r207641 r207761 205 205 } 206 206 207 void UniqueIDBDatabaseTransaction::renameIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 208 { 209 LOG(IndexedDB, "UniqueIDBDatabaseTransaction::renameIndex"); 210 211 ASSERT(isVersionChange()); 212 ASSERT(m_transactionInfo.identifier() == requestData.transactionIdentifier()); 213 214 RefPtr<UniqueIDBDatabaseTransaction> protectedThis(this); 215 m_databaseConnection->database().renameIndex(*this, objectStoreIdentifier, indexIdentifier, newName, [this, protectedThis, requestData](const IDBError& error) { 216 LOG(IndexedDB, "UniqueIDBDatabaseTransaction::renameIndex (callback)"); 217 if (error.isNull()) 218 m_databaseConnection->didRenameIndex(IDBResultData::renameIndexSuccess(requestData.requestIdentifier())); 219 else 220 m_databaseConnection->didRenameIndex(IDBResultData::error(requestData.requestIdentifier(), error)); 221 }); 222 } 223 224 207 225 void UniqueIDBDatabaseTransaction::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const IDBValue& value, IndexedDB::ObjectStoreOverwriteMode overwriteMode) 208 226 { -
trunk/Source/WebCore/Modules/indexeddb/server/UniqueIDBDatabaseTransaction.h
r207641 r207761 74 74 void createIndex(const IDBRequestData&, const IDBIndexInfo&); 75 75 void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName); 76 void renameIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName); 76 77 void putOrAdd(const IDBRequestData&, const IDBKeyData&, const IDBValue&, IndexedDB::ObjectStoreOverwriteMode); 77 78 void getRecord(const IDBRequestData&, const IDBGetRecordData&); -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBIndexInfo.h
r202806 r207761 47 47 bool unique() const { return m_unique; } 48 48 bool multiEntry() const { return m_multiEntry; } 49 50 void rename(const String& newName) { m_name = newName; } 49 51 50 52 template<class Encoder> void encode(Encoder&) const; -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp
r204394 r207761 86 86 } 87 87 88 IDBIndexInfo* IDBObjectStoreInfo::infoForExistingIndex(uint64_t identifier) 89 { 90 auto iterator = m_indexMap.find(identifier); 91 if (iterator == m_indexMap.end()) 92 return nullptr; 93 94 return &iterator->value; 95 } 96 88 97 IDBObjectStoreInfo IDBObjectStoreInfo::isolatedCopy() const 89 98 { -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.h
r207641 r207761 58 58 bool hasIndex(uint64_t indexIdentifier) const; 59 59 IDBIndexInfo* infoForExistingIndex(const String& name); 60 IDBIndexInfo* infoForExistingIndex(uint64_t identifier); 60 61 61 62 Vector<String> indexNames() const; … … 80 81 81 82 HashMap<uint64_t, IDBIndexInfo> m_indexMap; 82 83 83 }; 84 84 -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.cpp
r207641 r207761 160 160 } 161 161 162 IDBResultData IDBResultData::renameIndexSuccess(const IDBResourceIdentifier& requestIdentifier) 163 { 164 return { IDBResultType::RenameIndexSuccess, requestIdentifier }; 165 } 166 162 167 IDBResultData IDBResultData::putOrAddSuccess(const IDBResourceIdentifier& requestIdentifier, const IDBKeyData& resultKey) 163 168 { -
trunk/Source/WebCore/Modules/indexeddb/shared/IDBResultData.h
r207641 r207761 59 59 IterateCursorSuccess, 60 60 RenameObjectStoreSuccess, 61 RenameIndexSuccess, 61 62 }; 62 63 … … 78 79 static IDBResultData createIndexSuccess(const IDBResourceIdentifier&); 79 80 static IDBResultData deleteIndexSuccess(const IDBResourceIdentifier&); 81 static IDBResultData renameIndexSuccess(const IDBResourceIdentifier&); 80 82 static IDBResultData putOrAddSuccess(const IDBResourceIdentifier&, const IDBKeyData&); 81 83 static IDBResultData getRecordSuccess(const IDBResourceIdentifier&, const IDBGetResult&); -
trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.cpp
r207641 r207761 175 175 } 176 176 177 void InProcessIDBServer::didRenameIndex(const IDBResultData& resultData) 178 { 179 RunLoop::current().dispatch([this, protectedThis = makeRef(*this), resultData] { 180 m_connectionToServer->didRenameIndex(resultData); 181 }); 182 } 183 177 184 void InProcessIDBServer::didPutOrAdd(const IDBResultData& resultData) 178 185 { … … 280 287 } 281 288 289 void InProcessIDBServer::renameIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 290 { 291 RunLoop::current().dispatch([this, protectedThis = makeRef(*this), requestData, objectStoreIdentifier, indexIdentifier, newName] { 292 m_server->renameIndex(requestData, objectStoreIdentifier, indexIdentifier, newName); 293 }); 294 } 295 282 296 void InProcessIDBServer::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const IDBValue& value, const IndexedDB::ObjectStoreOverwriteMode overwriteMode) 283 297 { -
trunk/Source/WebCore/Modules/indexeddb/shared/InProcessIDBServer.h
r207641 r207761 69 69 void createIndex(const IDBRequestData&, const IDBIndexInfo&) final; 70 70 void deleteIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) final; 71 void renameIndex(const IDBRequestData&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) final; 71 72 void putOrAdd(const IDBRequestData&, const IDBKeyData&, const IDBValue&, const IndexedDB::ObjectStoreOverwriteMode) final; 72 73 void getRecord(const IDBRequestData&, const IDBGetRecordData&) final; … … 95 96 void didCreateIndex(const IDBResultData&) final; 96 97 void didDeleteIndex(const IDBResultData&) final; 98 void didRenameIndex(const IDBResultData&) final; 97 99 void didPutOrAdd(const IDBResultData&) final; 98 100 void didGetRecord(const IDBResultData&) final; -
trunk/Source/WebKit2/ChangeLog
r207735 r207761 1 2016-10-24 Brady Eidson <beidson@apple.com> 2 3 IndexedDB 2.0: Support IDBIndex name assignment. 4 <rdar://problem/28806932> and https://bugs.webkit.org/show_bug.cgi?id=163805 5 6 Reviewed by Alex Christensen. 7 8 * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp: 9 (WebKit::WebIDBConnectionToClient::didRenameIndex): 10 (WebKit::WebIDBConnectionToClient::renameIndex): 11 * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h: 12 * DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in: 13 14 * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp: 15 (WebKit::WebIDBConnectionToServer::renameIndex): 16 (WebKit::WebIDBConnectionToServer::didRenameIndex): 17 * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h: 18 * WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in: 19 1 20 2016-10-23 Michael Catanzaro <mcatanzaro@igalia.com> 2 21 -
trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.cpp
r207641 r207761 128 128 } 129 129 130 void WebIDBConnectionToClient::didRenameIndex(const WebCore::IDBResultData& resultData) 131 { 132 send(Messages::WebIDBConnectionToServer::DidRenameIndex(resultData)); 133 } 134 130 135 void WebIDBConnectionToClient::didPutOrAdd(const WebCore::IDBResultData& resultData) 131 136 { … … 261 266 } 262 267 268 void WebIDBConnectionToClient::renameIndex(const IDBRequestData& request, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 269 { 270 DatabaseProcess::singleton().idbServer().renameIndex(request, objectStoreIdentifier, indexIdentifier, newName); 271 } 272 263 273 void WebIDBConnectionToClient::putOrAdd(const IDBRequestData& request, const IDBKeyData& key, const IDBValue& value, unsigned overwriteMode) 264 274 { -
trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.h
r207641 r207761 69 69 void didCreateIndex(const WebCore::IDBResultData&) final; 70 70 void didDeleteIndex(const WebCore::IDBResultData&) final; 71 void didRenameIndex(const WebCore::IDBResultData&) final; 71 72 void didPutOrAdd(const WebCore::IDBResultData&) final; 72 73 void didGetRecord(const WebCore::IDBResultData&) final; … … 98 99 void createIndex(const WebCore::IDBRequestData&, const WebCore::IDBIndexInfo&); 99 100 void deleteIndex(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName); 101 void renameIndex(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName); 100 102 void putOrAdd(const WebCore::IDBRequestData&, const WebCore::IDBKeyData&, const WebCore::IDBValue&, unsigned overwriteMode); 101 103 void getRecord(const WebCore::IDBRequestData&, const WebCore::IDBGetRecordData&); -
trunk/Source/WebKit2/DatabaseProcess/IndexedDB/WebIDBConnectionToClient.messages.in
r207641 r207761 35 35 CreateIndex(WebCore::IDBRequestData requestData, WebCore::IDBIndexInfo info); 36 36 DeleteIndex(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier, String indexName); 37 RenameIndex(WebCore::IDBRequestData requestData, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, String newName); 37 38 PutOrAdd(WebCore::IDBRequestData requestData, WebCore::IDBKeyData key, WebCore::IDBValue value, unsigned overwriteMode); 38 39 GetRecord(WebCore::IDBRequestData requestData, struct WebCore::IDBGetRecordData getRecordData); -
trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp
r207641 r207761 139 139 } 140 140 141 void WebIDBConnectionToServer::renameIndex(const IDBRequestData& requestData, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) 142 { 143 send(Messages::WebIDBConnectionToClient::RenameIndex(requestData, objectStoreIdentifier, indexIdentifier, newName)); 144 } 145 141 146 void WebIDBConnectionToServer::putOrAdd(const IDBRequestData& requestData, const IDBKeyData& keyData, const IDBValue& value, const IndexedDB::ObjectStoreOverwriteMode mode) 142 147 { … … 252 257 { 253 258 m_connectionToServer->didDeleteIndex(result); 259 } 260 261 void WebIDBConnectionToServer::didRenameIndex(const IDBResultData& result) 262 { 263 m_connectionToServer->didRenameIndex(result); 254 264 } 255 265 -
trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.h
r207641 r207761 58 58 void createIndex(const WebCore::IDBRequestData&, const WebCore::IDBIndexInfo&) final; 59 59 void deleteIndex(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, const String& indexName) final; 60 void renameIndex(const WebCore::IDBRequestData&, uint64_t objectStoreIdentifier, uint64_t indexIdentifier, const String& newName) final; 60 61 void putOrAdd(const WebCore::IDBRequestData&, const WebCore::IDBKeyData&, const WebCore::IDBValue&, const WebCore::IndexedDB::ObjectStoreOverwriteMode) final; 61 62 void getRecord(const WebCore::IDBRequestData&, const WebCore::IDBGetRecordData&) final; … … 87 88 void didCreateIndex(const WebCore::IDBResultData&); 88 89 void didDeleteIndex(const WebCore::IDBResultData&); 90 void didRenameIndex(const WebCore::IDBResultData&); 89 91 void didPutOrAdd(const WebCore::IDBResultData&); 90 92 void didGetRecord(const WebIDBResult&); -
trunk/Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in
r207641 r207761 34 34 DidCreateIndex(WebCore::IDBResultData result) 35 35 DidDeleteIndex(WebCore::IDBResultData result) 36 DidRenameIndex(WebCore::IDBResultData result) 36 37 DidPutOrAdd(WebCore::IDBResultData result) 37 38 DidGetRecord(WebKit::WebIDBResult result)
Note: See TracChangeset
for help on using the changeset viewer.