Keep newly created IDBIndex objects in deleted map when IDBTransaction is aborted
https://bugs.webkit.org/show_bug.cgi?id=220489
<rdar://problem/
70498831>
Patch by Sihui Liu <sihui_liu@appe.com> on 2021-01-11
Reviewed by Youenn Fablet.
Source/WebCore:
When an upgrade transaction is aborted, we move objects from m_deletedIndexes to m_referencedIndexes to revert
the index deletion operation. When updating m_referencedIndexes, we did not check whether key already exists.
Therefore, some indexes in m_referencedIndexes would be replaced and destroyed (since m_referencedIndexes holds
unique pointers) when the index is still referenced by JS.
Tests: storage/indexeddb/modern/abort-index-info-private.html
storage/indexeddb/modern/abort-index-info.html
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::rollbackForVersionChangeAbort):
LayoutTests:
* storage/indexeddb/modern/abort-index-info-expected.txt: Added.
* storage/indexeddb/modern/abort-index-info-private-expected.txt: Added.
* storage/indexeddb/modern/abort-index-info-private.html: Added.
* storage/indexeddb/modern/abort-index-info.html: Added.
* storage/indexeddb/modern/resources/abort-index-info.js: Added.
(prepareDatabase):
(versionChangeSuccessCallback.secondRequest.onerror):
(versionChangeSuccessCallback):
(secondUpgradeNeeded):
(checkState):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271368
268f45cc-cd09-0410-ab3c-
d52691b4dbfc