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
Advances the cursor to the next [=object-store/record=] in range matching
4439
4441
or after |key| and |primaryKey|. Throws an "{{InvalidAccessError}}" {{DOMException}}
4440
4442
if the [=cursor/source=] is not an [=/index=].
4443
+
4444
+
: |cursor| . {{IDBCursor/close()|close}}()
4445
+
::
4446
+
Signals that the cursor is no longer needed, and that any associated resources can be released.
4441
4447
</dl>
4442
4448
</div>
4443
4449
@@ -4458,9 +4464,9 @@ invoked, must run these steps:
4458
4464
1. If **this**'s [=cursor/source=] or [=effective object
4459
4465
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4460
4466
4461
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4462
-
the cursor is being iterated or has iterated past its end,
4463
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4467
+
1. If **this**'s [=cursor/got value flag=] is false
4468
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4469
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4464
4470
4465
4471
1. Set **this**'s [=cursor/got value flag=] to false.
4466
4472
@@ -4500,9 +4506,9 @@ invoked, must run these steps:
4500
4506
[=effective object store=] has been deleted, [=throw=] an
4501
4507
"{{InvalidStateError}}" {{DOMException}}.
4502
4508
4503
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4504
-
the cursor is being iterated or has iterated past its end,
4505
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4509
+
1. If **this**'s [=cursor/got value flag=] is false
4510
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4511
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4506
4512
4507
4513
1. If |key| is given, then:
4508
4514
@@ -4565,9 +4571,9 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4565
4571
1. If **this**'s [=cursor/direction=] is not {{"next"}} or {{"prev"}},
4566
4572
[=throw=] an "{{InvalidAccessError}}" {{DOMException}}.
4567
4573
4568
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4569
-
the cursor is being iterated or has iterated past its end,
4570
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4574
+
1. If **this**'s [=cursor/got value flag=] is false
4575
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4576
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4571
4577
4572
4578
1. Let |r| be the result of running [=convert a value to
4573
4579
a key=] with |key|. Rethrow any exceptions.
@@ -4626,6 +4632,39 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4626
4632
flag=] has been set to false.
4627
4633
</aside>
4628
4634
4635
+
<div class=algorithm>
4636
+
4637
+
The <dfn method for=IDBCursor>close()</dfn> method, when invoked, must run these steps:
4638
+
4639
+
1. Let |transaction| be **this**'s [=cursor/transaction=].
4640
+
4641
+
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=], then [=throw=] a "{{TransactionInactiveError}}" {{DOMException}}.
4642
+
4643
+
1. If **this**'s [=cursor/source=] or [=effective object store=] has been deleted, then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4644
+
4645
+
1. If **this**'s [=cursor/got value flag=] is false
4646
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4647
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4648
+
4649
+
1. Set **this**'s [=cursor/got value flag=] to false.
4650
+
4651
+
1. Set **this**'s [=cursor/key=] to undefined.
4652
+
4653
+
1. If **this**'s [=cursor/source=] is an [=/index=], then set **this**'s [=object store position=] to undefined.
4654
+
4655
+
1. If **this**'s [=cursor/key only flag=] is false, then set **this**'s [=cursor/value=] to undefined.
4656
+
4657
+
</div>
4658
+
4659
+
<aside class=note>
4660
+
The {{IDBCursor/close()}} method allows web applications to hint to the user agent that the cursor will no longer be iterated, and that any state associated with the cursor can be discarded.
4661
+
</aside>
4662
+
4663
+
<aside class=advisement>
4664
+
🚧
4665
+
The {{IDBCursor/close()}} method is new in this edition.
4666
+
🚧
4667
+
</aside>
4629
4668
4630
4669
4631
4670
<div class=note>
@@ -4672,9 +4711,9 @@ invoked, must run these steps:
4672
4711
1. If **this**'s [=cursor/source=] or [=effective object
4673
4712
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4674
4713
4675
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4676
-
the cursor is being iterated or has iterated past its end,
4677
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4714
+
1. If **this**'s [=cursor/got value flag=] is false
4715
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4716
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4678
4717
4679
4718
1. If **this**'s [=cursor/key only flag=] is true, [=throw=] an
4680
4719
"{{InvalidStateError}}" {{DOMException}}.
@@ -4738,9 +4777,9 @@ must run these steps:
4738
4777
1. If **this**'s [=cursor/source=] or [=effective object
4739
4778
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4740
4779
4741
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4742
-
the cursor is being iterated or has iterated past its end,
4743
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4780
+
1. If **this**'s [=cursor/got value flag=] is false
4781
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4782
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4744
4783
4745
4784
1. If **this**'s [=cursor/key only flag=] is true, [=throw=] an
4746
4785
"{{InvalidStateError}}" {{DOMException}}.
@@ -6815,6 +6854,7 @@ For the revision history of the second edition, see [that document's Revision Hi
0 commit comments