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