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.
931
931
932
+
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.
933
+
932
934
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:
933
935
934
936
: "{{IDBTransactionDurability/strict}}"
@@ -1036,10 +1038,11 @@ The <dfn>lifetime</dfn> of a
1036
1038
</aside>
1037
1039
1038
1040
1. When each [=/request=] associated with a transaction is [=request/processed=],
1039
-
a {{IDBRequest/success!!event}} or {{IDBRequest/error!!event}}[=event=] will be
1040
-
fired. While the event is being [=dispatched=], the transaction
1041
+
a {{IDBRequest/success!!event}} or {{IDBRequest/error!!event}}[=event=] will be fired.
1042
+
If the transaction's [=transaction/manual commit flag=] is false (the default), then
1043
+
while the event is being [=dispatched=], the transaction
1041
1044
[=transaction/state=] is set to [=transaction/active=], allowing
1042
-
additional requests to be made against the transaction. Once the
1045
+
additional requests to be made against the transaction; once the
1043
1046
event dispatch is complete, the transaction's
1044
1047
[=transaction/state=] is set to [=transaction/inactive=] again.
1045
1048
@@ -1058,11 +1061,12 @@ The <dfn>lifetime</dfn> of a
1058
1061
[=/object stores=] as well as additions and removals of [=/object
1059
1062
stores=] and [=/indexes=].
1060
1063
1061
-
1. The implementation must attempt to <dfn lt="commit|committed">commit</dfn>
1062
-
a transaction when all [=/requests=] placed against the
1064
+
1. If a transaction's [=transaction/manual commit flag=] is false, then
1065
+
the implementation must attempt to <dfn lt="commit|committed">commit</dfn>
1066
+
it when all [=/requests=] placed against the
1063
1067
transaction have completed and their returned results handled, no
1064
1068
new requests have been placed against the transaction, and the
1065
-
transaction has not been [=transaction/aborted=]
1069
+
transaction has not been [=transaction/aborted=].
1066
1070
1067
1071
An explicit call to {{IDBTransaction/commit()}} will initiate a
1068
1072
[=transaction/commit=] without waiting for request results to be
@@ -1099,7 +1103,7 @@ They will return true if any transactions were cleaned up, or false otherwise.
1099
1103
1. For each [=/transaction=] |transaction| with [=transaction/cleanup event loop=]
1100
1104
matching the current [=/event loop=]:
1101
1105
1102
-
1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
1106
+
1. If |transaction|'s [=transaction/manual commit flag=] is false, then set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
@@ -2622,9 +2699,13 @@ instance on which it was called.
2622
2699
Returns a new [=/transaction=] with the given
2623
2700
|scope| (which can be a single [=/object store=][=object-store/name=] or an array of [=object-store/names=]),
2624
2701
|mode| ("{{IDBTransactionMode/readonly}}" or "{{IDBTransactionMode/readwrite}}"),
2625
-
and additional |options| including {{IDBTransactionOptions/durability}} ("{{IDBTransactionDurability/default}}", "{{IDBTransactionDurability/strict}}" or "{{IDBTransactionDurability/relaxed}}").
2702
+
and additional |options| including
2703
+
{{IDBTransactionOptions/manualCommit}} (true or false), and
2704
+
{{IDBTransactionOptions/durability}} ("{{IDBTransactionDurability/default}}", "{{IDBTransactionDurability/strict}}" or "{{IDBTransactionDurability/relaxed}}").
2626
2705
2627
-
The default |mode| is "{{IDBTransactionMode/readonly}}" and the default {{IDBTransactionOptions/durability}} is "{{IDBTransactionDurability/default}}".
2706
+
The default |mode| is "{{IDBTransactionMode/readonly}}".
2707
+
The default {{IDBTransactionOptions/manualCommit}} is false.
2708
+
The default {{IDBTransactionOptions/durability}} is "{{IDBTransactionDurability/default}}".
2628
2709
2629
2710
: |connection| . {{IDBDatabase/close()|close}}()
2630
2711
::
@@ -2655,7 +2736,11 @@ The <dfn method for=IDBDatabase>transaction(|storeNames|, |mode|, |options|)</df
2655
2736
1. If |mode| is not "{{IDBTransactionMode/readonly}}" or "{{IDBTransactionMode/readwrite}}",
2656
2737
[=exception/throw=] a {{TypeError}}.
2657
2738
2658
-
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|.
2739
+
1. Let |transaction| be a newly [=transaction/created=][=/transaction=] with this [=/connection=], |mode|, and the set of [=/object stores=] named in |scope|.
2740
+
2741
+
1. Set |transaction|'s [=transaction/manual commit flag=] to |options|'{{IDBTransactionOptions/manualCommit}} member.
2742
+
2743
+
1. Set |transaction|'s [=transaction/durability hint=] to |options|'{{IDBTransactionOptions/durability}} member.
2659
2744
2660
2745
1. Set |transaction|'s [=transaction/cleanup event loop=] to the
2661
2746
current [=/event loop=].
@@ -2664,6 +2749,12 @@ The <dfn method for=IDBDatabase>transaction(|storeNames|, |mode|, |options|)</df
2664
2749
2665
2750
</div>
2666
2751
2752
+
<aside class=advisement>
2753
+
🚧
2754
+
The {{IDBTransactionOptions/manualCommit}} option is new in this edition.
2755
+
🚧
2756
+
</aside>
2757
+
2667
2758
<aside class=advisement>
2668
2759
🚧
2669
2760
The {{IDBTransactionOptions/durability}} option is new in this edition.
@@ -4719,6 +4810,7 @@ the contents of the database.
The <dfn method for=IDBTransaction>commit()</dfn> method steps are:
4893
4999
4894
-
1. If [=/this=]'s [=transaction/state=] is not [=transaction/active=],
5000
+
1. If [=/this=]'s [=transaction/manual commit flag=] is false,
5001
+
and [=/this=]'s [=transaction/state=] is not [=transaction/active=],
4895
5002
then [=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.
4896
5003
4897
5004
1. Run [=commit a transaction=] with [=/this=].
@@ -5480,14 +5587,14 @@ To <dfn>fire a success event</dfn> at a |request|, run these steps:
5480
5587
1. If |transaction|'s [=transaction/state=] is [=transaction/active=],
5481
5588
then:
5482
5589
5483
-
1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5590
+
1. If |transaction|'s [=transaction/manual commit flag=] is false, then set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5484
5591
5485
5592
1. If |legacyOutputDidListenersThrowFlag| is true,
5486
5593
then run [=abort a transaction=] with
5487
5594
|transaction| and a newly [=exception/created=]
5488
5595
"{{AbortError}}" {{DOMException}}.
5489
5596
5490
-
1. If |transaction|'s [=transaction/request list=] is empty,
5597
+
1. If |transaction|'s [=transaction/manual commit flag=] is false and if |transaction|'s [=transaction/request list=] is empty,
5491
5598
then run [=commit a transaction=] with |transaction|.
5492
5599
5493
5600
</div>
@@ -5519,7 +5626,7 @@ To <dfn>fire an error event</dfn> at a |request|, run these steps:
5519
5626
1. If |transaction|'s [=transaction/state=] is [=transaction/active=],
5520
5627
then:
5521
5628
5522
-
1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5629
+
1. If |transaction|'s [=transaction/manual commit flag=] is false, then set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5523
5630
5524
5631
1. If |legacyOutputDidListenersThrowFlag| is true,
5525
5632
then run [=abort a transaction=] with
@@ -5540,7 +5647,7 @@ To <dfn>fire an error event</dfn> at a |request|, run these steps:
5540
5647
|transaction| and [=/request=]'s [=request/error=], and
5541
5648
terminate these steps.
5542
5649
5543
-
1. If |transaction|'s [=transaction/request list=] is empty,
5650
+
1. If |transaction|'s [=transaction/manual commit flag=] is false and |transaction|'s [=transaction/request list=] is empty,
5544
5651
then run [=commit a transaction=] with |transaction|.
5545
5652
5546
5653
</div>
@@ -6781,6 +6888,7 @@ For the revision history of the second edition, see [that document's Revision Hi
6781
6888
* 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