Skip to content

Return transaction from upgrade a database #458

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Return transaction from upgrade a database
  • Loading branch information
stelar7 committed May 22, 2025
commit 11bb776681db0a0c063908759dd54aeb471cf5fa
8 changes: 5 additions & 3 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -4957,14 +4957,13 @@ To <dfn>open a database connection</dfn> with |storageKey| which requested the [
[=/connections=] in |openConnections| are
[=connection/closed=].

1. Run [=upgrade a database=]
using |connection|, |version| and |request|.
1. Let |transaction| be the result of running [=upgrade a database=] with |connection|, |version| and |request|.

1. If |connection| was [=connection/closed=],
return a newly [=exception/created=]
"{{AbortError}}" {{DOMException}} and abort these steps.

1. If the [=/upgrade transaction=] was aborted, run the steps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you need to return a value from upgrade a database as the request's transaction will be set to the transaction, although only if it succeeded. If it was aborted, the request's transaction will be null and done flag will be false. So this can change to something like "If |request|'s [=request/transaction=] is null, run the steps to..."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this analysis, @evanstade. Agreed - I think this recommendation is sufficient. Even easier than what I recommended over in #433 (comment)

1. If |transaction| was aborted, run the steps
to [=close a database connection=] with |connection|,
return a newly [=exception/created=]
"{{AbortError}}" {{DOMException}} and abort these steps.
Expand Down Expand Up @@ -5300,6 +5299,8 @@ To <dfn>upgrade a database</dfn> with |connection| (a [=/connection=]), a new |v

1. Wait for |transaction| to [=transaction/finish=].

1. Return |transaction|.

NOTE:
Some of the algorithms invoked during the [=/transaction=]'s
[=transaction/lifetime=], such as the steps to [=commit a
Expand Down Expand Up @@ -6718,6 +6719,7 @@ For the revision history of the second edition, see [that document's Revision Hi
* Define [=Queue a database task=] and replace [=Queue a task=] with it (<#421>)
* Add missing parallel step to {{IDBFactory/databases()|databases}}() (<#421>)
* Clarify cursor iteration predicates (<#450>)
* Return transaction from [=/upgrade a database=] to allow its use in [=/open a database connection=]. (<#433>)

<!-- ============================================================ -->
# Acknowledgements # {#acknowledgements}
Expand Down