[w3c/IndexedDB] Exceptions during database upgrade no longer closes the connection (Issue #473)

stelar7 created an issue (w3c/IndexedDB#473)

After https://github.com/w3c/IndexedDB/pull/458, the condition for closing with an error was changed to check the requests error.
Unfortunately that will never be true, as we pass that point before the request has its error set.

Following the flow, it seems to go like this:
[open](https://www.w3.org/TR/IndexedDB/#opening) -> [upgrade](https://www.w3.org/TR/IndexedDB/#upgrade-transaction-steps) -> 
TASK A -> [upgrade needed](https://www.w3.org/TR/IndexedDB/#eventdef-idbopendbrequest-upgradeneeded) -> did throw = true -> [abort](https://www.w3.org/TR/IndexedDB/#abort-a-transaction) -> transaction finished -> 
TASK B -> request gets its error set.

Since the transaction gets marked as finished before TASK B is done, we will return to finish TASK A with TASK B still pending.
Upgrade will then check if the transaction is finished, (which it is at this point), go back to open, where step 10.8 will not see the error being set.

Could a possible solution here be to move the state update to a later point? (queue a database task to set transaction's state to finished as new step 8 in abort?)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/IndexedDB/issues/473
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/IndexedDB/issues/473@github.com>

Received on Friday, 15 August 2025 09:36:17 UTC