You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling indexedDB.open("test", 1) will cause an upgrade, and then step 10.5 could change the state (via autocommit, or user action), but then we instantly set it back to inactive in step 10.6
Should step 11 instead be waiting for the task created in step 10 to finish? Or am I missing something here?
Once we get to close a database connection step 3. we will be stuck in an infinite loop, because at no point has the transaction gone to the finished state. (The onupgradeneeded callback does nothing that would cause an abort or commit)
Is there a spec step im missing that handles this case?
The text was updated successfully, but these errors were encountered:
stelar7
changed the title
Database upgrade loop question
Database upgrade wait loop question
Jan 1, 2025
stelar7
changed the title
Database upgrade wait loop question
Wait loop questions
Jan 1, 2025
During the firing the version change event (10.5), script may make additional requests. These would keep the transaction alive, so going inactive at 10.6 would not cause the transaction to auto-commit. So waiting for the transaction to finish in step 11 is intentional.
In the case where no requests are made (e.g. your code example), the relevant prose is in the transaction lifetime definition: "The implementation must attempt to commit a transaction when all requests placed against the transaction have completed and their returned results handled, no new requests have been placed against the transaction, and the transaction has not been aborted" The intention is that once we reach a state where all existing requests are completed and new requests can be made, the transaction should attempt to commit.
The statement could be made more explicit e.g. by stating "The implementation must attempt to commit a transaction when it is inactive, all requests..."
Making the whole transaction lifecycle more algorithmic would also be nice. :)
In Upgrading a database step 11 is supposed to wait for the transaction to finish.
A transaction is finished once it enters the
finished
state (aftercommit
orabort
)Calling
indexedDB.open("test", 1)
will cause an upgrade, and then step 10.5 could change the state (via autocommit, or user action), but then we instantly set it back to inactive in step 10.6Given the following snippet:
Once we get to close a database connection step 3. we will be stuck in an infinite loop, because at no point has the transaction gone to the finished state. (The
onupgradeneeded
callback does nothing that would cause an abort or commit)The text was updated successfully, but these errors were encountered: