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
461db42e966892b49eb9f689c20d1e4fcde0f618
Initial sketch of manual commit
fix/add 'new in this edition' hints
version history
invert flag check
don't let tx go inactive
post-rebase cleanup
6fbe9e5f5221c00700c1b2e2a0707249177f4414
bangbang
{{IDBOpenDBRequest/upgradeneeded!!event}} event is fired.
950
950
951
+
A [=/transaction=] has an <dfn>manual commit flag</dfn>, which is initially false. By default, transactions commit automatically when all outstanding requests have been processed. This can be behavior can be modified by options set when creating the transaction.
952
+
951
953
A [=/transaction=] has a <dfn>durability hint</dfn>. This is a hint to the user agent of whether to prioritize performance or durability when committing the transaction. The [=transaction/durability hint=] is one of the following:
952
954
953
955
: "{{IDBTransactionDurability/strict}}"
@@ -1055,10 +1057,11 @@ The <dfn>lifetime</dfn> of a
1055
1057
</aside>
1056
1058
1057
1059
1. When each [=/request=] associated with a transaction is [=request/processed=],
1058
-
a {{IDBRequest/success!!event}} or {{IDBRequest/error!!event}}[=event=] will be
1059
-
fired. While the event is being [=dispatched=], the transaction
1060
+
a {{IDBRequest/success!!event}} or {{IDBRequest/error!!event}}[=event=] will be fired.
1061
+
If the transaction's [=transaction/manual commit flag=] is false (the default), then
1062
+
while the event is being [=dispatched=], the transaction
1060
1063
[=transaction/state=] is set to [=transaction/active=], allowing
1061
-
additional requests to be made against the transaction. Once the
1064
+
additional requests to be made against the transaction; once the
1062
1065
event dispatch is complete, the transaction's
1063
1066
[=transaction/state=] is set to [=transaction/inactive=] again.
1064
1067
@@ -1077,11 +1080,12 @@ The <dfn>lifetime</dfn> of a
1077
1080
[=/object stores=] as well as additions and removals of [=/object
1078
1081
stores=] and [=/indexes=].
1079
1082
1080
-
1. The implementation must attempt to <dfn lt="commit|committed">commit</dfn>
1081
-
a transaction when all [=/requests=] placed against the
1083
+
1. If a transaction's [=transaction/manual commit flag=] is false, then
1084
+
the implementation must attempt to <dfn lt="commit|committed">commit</dfn>
1085
+
it when all [=/requests=] placed against the
1082
1086
transaction have completed and their returned results handled, no
1083
1087
new requests have been placed against the transaction, and the
1084
-
transaction has not been [=transaction/aborted=]
1088
+
transaction has not been [=transaction/aborted=].
1085
1089
1086
1090
An explicit call to {{IDBTransaction/commit()}} will initiate a
1087
1091
[=transaction/commit=] without waiting for request results to be
@@ -1118,7 +1122,7 @@ They will return true if any transactions were cleaned up, or false otherwise.
1118
1122
1. For each [=/transaction=] |transaction| with [=transaction/cleanup event loop=]
1119
1123
matching the current [=/event loop=]:
1120
1124
1121
-
1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
1125
+
1. If |transaction|'s [=transaction/manual commit flag=] is false, then set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
@@ -2641,9 +2718,13 @@ instance on which it was called.
2641
2718
Returns a new [=/transaction=] with the given
2642
2719
|scope| (which can be a single [=/object store=][=object-store/name=] or an array of [=object-store/names=]),
2643
2720
|mode| ("{{IDBTransactionMode/readonly}}" or "{{IDBTransactionMode/readwrite}}"),
2644
-
and additional |options| including {{IDBTransactionOptions/durability}} ("{{IDBTransactionDurability/default}}", "{{IDBTransactionDurability/strict}}" or "{{IDBTransactionDurability/relaxed}}").
2721
+
and additional |options| including
2722
+
{{IDBTransactionOptions/manualCommit}} (true or false), and
2723
+
{{IDBTransactionOptions/durability}} ("{{IDBTransactionDurability/default}}", "{{IDBTransactionDurability/strict}}" or "{{IDBTransactionDurability/relaxed}}").
2645
2724
2646
-
The default |mode| is "{{IDBTransactionMode/readonly}}" and the default {{IDBTransactionOptions/durability}} is "{{IDBTransactionDurability/default}}".
2725
+
The default |mode| is "{{IDBTransactionMode/readonly}}".
2726
+
The default {{IDBTransactionOptions/manualCommit}} is false.
2727
+
The default {{IDBTransactionOptions/durability}} is "{{IDBTransactionDurability/default}}".
2647
2728
2648
2729
: |connection| . {{IDBDatabase/close()|close}}()
2649
2730
::
@@ -2674,7 +2755,11 @@ The <dfn method for=IDBDatabase>transaction(|storeNames|, |mode|, |options|)</df
2674
2755
1. If |mode| is not "{{IDBTransactionMode/readonly}}" or "{{IDBTransactionMode/readwrite}}",
2675
2756
[=exception/throw=] a {{TypeError}}.
2676
2757
2677
-
1. Let |transaction| be a newly [=transaction/created=][=/transaction=] with this [=/connection=], |mode|, |options|' {{IDBTransactionOptions/durability}} member, and the set of [=/object stores=] named in |scope|.
2758
+
1. Let |transaction| be a newly [=transaction/created=][=/transaction=] with this [=/connection=], |mode|, and the set of [=/object stores=] named in |scope|.
2759
+
2760
+
1. Set |transaction|'s [=transaction/manual commit flag=] to |options|'{{IDBTransactionOptions/manualCommit}} member.
2761
+
2762
+
1. Set |transaction|'s [=transaction/durability hint=] to |options|'{{IDBTransactionOptions/durability}} member.
2678
2763
2679
2764
1. Set |transaction|'s [=transaction/cleanup event loop=] to the
2680
2765
current [=/event loop=].
@@ -2683,6 +2768,12 @@ The <dfn method for=IDBDatabase>transaction(|storeNames|, |mode|, |options|)</df
2683
2768
2684
2769
</div>
2685
2770
2771
+
<aside class=advisement>
2772
+
🚧
2773
+
The {{IDBTransactionOptions/manualCommit}} option is new in this edition.
2774
+
🚧
2775
+
</aside>
2776
+
2686
2777
<aside class=advisement>
2687
2778
🚧
2688
2779
The {{IDBTransactionOptions/durability}} option is new in this edition.
@@ -4738,6 +4829,7 @@ the contents of the database.
The <dfn method for=IDBTransaction>commit()</dfn> method steps are:
4912
5018
4913
-
1. If [=/this=]'s [=transaction/state=] is not [=transaction/active=],
5019
+
1. If [=/this=]'s [=transaction/manual commit flag=] is false,
5020
+
and [=/this=]'s [=transaction/state=] is not [=transaction/active=],
4914
5021
then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.
4915
5022
4916
5023
1. Run [=commit a transaction=] with [=/this=].
@@ -5170,7 +5277,7 @@ To <dfn>commit a transaction</dfn> with the |transaction| to commit, run these s
5170
5277
<aside class=note>
5171
5278
Even if an exception is thrown from one of the event handlers of
5172
5279
this event, the transaction is still committed since writing the
5173
-
database changes happens before the event takes places. Only
5280
+
database changes happens before the event takes place. Only
5174
5281
after the transaction has been successfully written is the
5175
5282
{{IDBTransaction/complete!!event}} event fired.
5176
5283
</aside>
@@ -5499,14 +5606,14 @@ To <dfn>fire a success event</dfn> at a |request|, run these steps:
5499
5606
1. If |transaction|'s [=transaction/state=] is [=transaction/active=],
5500
5607
then:
5501
5608
5502
-
1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5609
+
1. If |transaction|'s [=transaction/manual commit flag=] is false, then set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5503
5610
5504
5611
1. If |legacyOutputDidListenersThrowFlag| is true,
5505
5612
then run [=abort a transaction=] with
5506
5613
|transaction| and a newly [=exception/created=]
5507
5614
"{{AbortError}}" {{DOMException}}.
5508
5615
5509
-
1. If |transaction|'s [=transaction/request list=] is empty,
5616
+
1. If |transaction|'s [=transaction/manual commit flag=] is false and if |transaction|'s [=transaction/request list=] is empty,
5510
5617
then run [=commit a transaction=] with |transaction|.
5511
5618
5512
5619
</div>
@@ -5538,7 +5645,7 @@ To <dfn>fire an error event</dfn> at a |request|, run these steps:
5538
5645
1. If |transaction|'s [=transaction/state=] is [=transaction/active=],
5539
5646
then:
5540
5647
5541
-
1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5648
+
1. If |transaction|'s [=transaction/manual commit flag=] is false, then set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5542
5649
5543
5650
1. If |legacyOutputDidListenersThrowFlag| is true,
5544
5651
then run [=abort a transaction=] with
@@ -5559,7 +5666,7 @@ To <dfn>fire an error event</dfn> at a |request|, run these steps:
5559
5666
|transaction| and [=/request=]'s [=request/error=], and
5560
5667
terminate these steps.
5561
5668
5562
-
1. If |transaction|'s [=transaction/request list=] is empty,
5669
+
1. If |transaction|'s [=transaction/manual commit flag=] is false and |transaction|'s [=transaction/request list=] is empty,
5563
5670
then run [=commit a transaction=] with |transaction|.
5564
5671
5565
5672
</div>
@@ -6800,6 +6907,7 @@ For the revision history of the second edition, see [that document's Revision Hi
6800
6907
* Specified [[#transaction-scheduling]] more precisely and disallow starting read/write transactions while read-only transactions with overlapping scope are running. ([Issue #253](https://github.com/w3c/IndexedDB/issues/253))
0 commit comments