IndexedDB: Fire error at request when abort is called in upgradeneeded
authordgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Aug 2012 01:08:45 +0000 (01:08 +0000)
committerdgrogan@chromium.org <dgrogan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Aug 2012 01:08:45 +0000 (01:08 +0000)
commit3456cd0b63590692fa4880354fba5e18fadb8aec
treefce5dd8b03638bccc991db2ecf86f677d482fdff
parent3488533f237cd262df553a7ee9b61260007369ea
IndexedDB: Fire error at request when abort is called in upgradeneeded
https://bugs.webkit.org/show_bug.cgi?id=94402

Reviewed by Tony Chang.

Source/WebCore:

Tests - updated intversion-abort-in-initial-upgradeneeded-expected.txt

* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
(WebCore::IDBDatabaseBackendImpl::transactionFinishedAndAbortFired):
(WebCore::IDBDatabaseBackendImpl::transactionFinishedAndCompleteFired):
(WebCore):
(WebCore::IDBDatabaseBackendImpl::runIntVersionChangeTransaction):
Now that second-half open calls don't get abandoned on the queue, we
can ASSERT that there's at most one of them at any time.

* Modules/indexeddb/IDBDatabaseBackendImpl.h:
(IDBDatabaseBackendImpl):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::dispatchEvent):
Move setting m_didFireUpgradeNeededEvent before dispatching the event.
If abort is called in the event handler an error event will be
enqueued and ASSERT_WITH_MESSAGE(m_readyState == PENDING ||
m_didFireUpgradeNeededEvent, ...) needs to pass.

* Modules/indexeddb/IDBTransactionBackendImpl.cpp:
(WebCore::IDBTransactionBackendImpl::abort):
(WebCore::IDBTransactionBackendImpl::commit):

LayoutTests:

* storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt:
Only remaining error in this test is versions not being reset in
memory.

* storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js:
(deleteSuccess):
(upgradeNeeded):
(onAbort):
(onError):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/storage/indexeddb/intversion-abort-in-initial-upgradeneeded-expected.txt
LayoutTests/storage/indexeddb/resources/intversion-abort-in-initial-upgradeneeded.js
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h
Source/WebCore/Modules/indexeddb/IDBRequest.cpp
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp