Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b5d274d82a73a96011e412c2d46d824ba4b42b3e
https://github.com/WebKit/WebKit/commit/b5d274d82a73a96011e412c2d46d824ba4b42b3e
Author: Sihui Liu <[email protected]>
Date: 2025-02-26 (Wed, 26 Feb 2025)
Changed paths:
A
LayoutTests/storage/indexeddb/resources/transaction-abort-revert-records.js
A
LayoutTests/storage/indexeddb/transaction-abort-revert-records-expected.txt
A
LayoutTests/storage/indexeddb/transaction-abort-revert-records-private-expected.txt
A
LayoutTests/storage/indexeddb/transaction-abort-revert-records-private.html
A LayoutTests/storage/indexeddb/transaction-abort-revert-records.html
M Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp
M Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h
M Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp
M Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h
Log Message:
-----------
[IndexedDB] Added records should be removed if transaction aborts
https://bugs.webkit.org/show_bug.cgi?id=288346
rdar://problem/145501159
Reviewed by Brady Eidson.
In current implementation, the memory backend does not roll back added records
when transaction aborts. See the new test
for an example: before this patch,
transaction-abort-revert-records-private.html would fail for keys added in
versionchnage transaction still present after the transaction is aborted.
The cause is MemoryBackingStoreTransaction only tracks records that are removed
from object store during transaction,
but not records that are newly added. To fix that, now MemoryObjectStore tracks
both added keys and removed records.
When transaction aborts, MemoryObjectStore deletes added records and re-adds
deleted records. By moving the ownership of
changed records from MemoryBackingStoreTransaction to MemoryObjectStore,
MemoryObjectStore does not need to notify
MemoryBackingStoreTransaction about changes, which makes the lifetime
management more clear.
Tests: storage/indexeddb/transaction-abort-revert-records.html
storage/indexeddb/transaction-abort-revert-records-private.html
* LayoutTests/storage/indexeddb/resources/transaction-abort-revert-records.js:
Added.
(prepareDatabase):
(onDatabasePrepared):
(onDatabaseUpgrade):
(onTranactionAbort):
(onDatabaseError):
(onDatabaseOpen):
(onGetAllKeysSuccess):
(onGetSuccess):
* LayoutTests/storage/indexeddb/transaction-abort-revert-records-expected.txt:
Added.
*
LayoutTests/storage/indexeddb/transaction-abort-revert-records-private-expected.txt:
Added.
* LayoutTests/storage/indexeddb/transaction-abort-revert-records-private.html:
Added.
* LayoutTests/storage/indexeddb/transaction-abort-revert-records.html: Added.
* Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.cpp:
(WebCore::IDBServer::MemoryBackingStoreTransaction::addExistingObjectStore):
(WebCore::IDBServer::MemoryBackingStoreTransaction::abort):
(WebCore::IDBServer::MemoryBackingStoreTransaction::objectStoreCleared):
Deleted.
(WebCore::IDBServer::MemoryBackingStoreTransaction::recordValueChanged):
Deleted.
* Source/WebCore/Modules/indexeddb/server/MemoryBackingStoreTransaction.h:
* Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.cpp:
(WebCore::IDBServer::MemoryObjectStore::writeTransactionStarted):
(WebCore::IDBServer::MemoryObjectStore::transactionAborted):
(WebCore::IDBServer::MemoryObjectStore::writeTransactionFinished):
(WebCore::IDBServer::MemoryObjectStore::clear):
(WebCore::IDBServer::MemoryObjectStore::deleteRecord):
(WebCore::IDBServer::MemoryObjectStore::addRecord):
(WebCore::IDBServer::MemoryObjectStore::replaceKeyValueStore): Deleted.
(WebCore::IDBServer::MemoryObjectStore::unregisterIndex): Deleted.
* Source/WebCore/Modules/indexeddb/server/MemoryObjectStore.h:
Canonical link: https://commits.webkit.org/291126@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes