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
4459
4461
or after |key| and |primaryKey|. Throws an "{{InvalidAccessError}}" {{DOMException}}
4460
4462
if the [=cursor/source=] is not an [=/index=].
4463
+
4464
+
: |cursor| . {{IDBCursor/close()|close}}()
4465
+
::
4466
+
Signals that the cursor is no longer needed, and that any associated resources can be released.
4461
4467
</dl>
4462
4468
</div>
4463
4469
@@ -4478,9 +4484,9 @@ invoked, must run these steps:
4478
4484
1. If **this**'s [=cursor/source=] or [=effective object
4479
4485
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4480
4486
4481
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4482
-
the cursor is being iterated or has iterated past its end,
4483
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4487
+
1. If **this**'s [=cursor/got value flag=] is false
4488
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4489
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4484
4490
4485
4491
1. Set **this**'s [=cursor/got value flag=] to false.
4486
4492
@@ -4520,9 +4526,9 @@ invoked, must run these steps:
4520
4526
[=effective object store=] has been deleted, [=throw=] an
4521
4527
"{{InvalidStateError}}" {{DOMException}}.
4522
4528
4523
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4524
-
the cursor is being iterated or has iterated past its end,
4525
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4529
+
1. If **this**'s [=cursor/got value flag=] is false
4530
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4531
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4526
4532
4527
4533
1. If |key| is given, then:
4528
4534
@@ -4585,9 +4591,9 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4585
4591
1. If **this**'s [=cursor/direction=] is not {{"next"}} or {{"prev"}},
4586
4592
[=throw=] an "{{InvalidAccessError}}" {{DOMException}}.
4587
4593
4588
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4589
-
the cursor is being iterated or has iterated past its end,
4590
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4594
+
1. If **this**'s [=cursor/got value flag=] is false
4595
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4596
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4591
4597
4592
4598
1. Let |r| be the result of running [=convert a value to
4593
4599
a key=] with |key|. Rethrow any exceptions.
@@ -4646,6 +4652,39 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4646
4652
flag=] has been set to false.
4647
4653
</aside>
4648
4654
4655
+
<div class=algorithm>
4656
+
4657
+
The <dfn method for=IDBCursor>close()</dfn> method, when invoked, must run these steps:
4658
+
4659
+
1. Let |transaction| be **this**'s [=cursor/transaction=].
4660
+
4661
+
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=], then [=throw=] a "{{TransactionInactiveError}}" {{DOMException}}.
4662
+
4663
+
1. If **this**'s [=cursor/source=] or [=effective object store=] has been deleted, then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4664
+
4665
+
1. If **this**'s [=cursor/got value flag=] is false
4666
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4667
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4668
+
4669
+
1. Set **this**'s [=cursor/got value flag=] to false.
4670
+
4671
+
1. Set **this**'s [=cursor/key=] to undefined.
4672
+
4673
+
1. If **this**'s [=cursor/source=] is an [=/index=], then set **this**'s [=object store position=] to undefined.
4674
+
4675
+
1. If **this**'s [=cursor/key only flag=] is false, then set **this**'s [=cursor/value=] to undefined.
4676
+
4677
+
</div>
4678
+
4679
+
<aside class=note>
4680
+
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.
4681
+
</aside>
4682
+
4683
+
<aside class=advisement>
4684
+
🚧
4685
+
The {{IDBCursor/close()}} method is new in this edition.
4686
+
🚧
4687
+
</aside>
4649
4688
4650
4689
4651
4690
<div class=note>
@@ -4692,9 +4731,9 @@ invoked, must run these steps:
4692
4731
1. If **this**'s [=cursor/source=] or [=effective object
4693
4732
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4694
4733
4695
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4696
-
the cursor is being iterated or has iterated past its end,
4697
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4734
+
1. If **this**'s [=cursor/got value flag=] is false
4735
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4736
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4698
4737
4699
4738
1. If **this**'s [=cursor/key only flag=] is true, [=throw=] an
4700
4739
"{{InvalidStateError}}" {{DOMException}}.
@@ -4758,9 +4797,9 @@ must run these steps:
4758
4797
1. If **this**'s [=cursor/source=] or [=effective object
4759
4798
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4760
4799
4761
-
1. If **this**'s [=cursor/got value flag=] is false, indicating that
4762
-
the cursor is being iterated or has iterated past its end,
4763
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4800
+
1. If **this**'s [=cursor/got value flag=] is false
4801
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4802
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4764
4803
4765
4804
1. If **this**'s [=cursor/key only flag=] is true, [=throw=] an
4766
4805
"{{InvalidStateError}}" {{DOMException}}.
@@ -6864,6 +6903,7 @@ For the revision history of the second edition, see [that document's Revision Hi
0 commit comments