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
4413
4415
or after |key| and |primaryKey|. Throws an "{{InvalidAccessError}}" {{DOMException}}
4414
4416
if the [=cursor/source=] is not an [=/index=].
4417
+
4418
+
4419
+
: |cursor| . {{IDBCursor/close()|close}}()
4420
+
::
4421
+
Signals that the cursor is no longer needed, and that any associated resources can be released.
4422
+
4415
4423
</div>
4416
4424
4417
4425
@@ -4431,9 +4439,9 @@ invoked, must run these steps:
4431
4439
1. If [=/this=]'s [=cursor/source=] or [=effective object
4432
4440
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4433
4441
4434
-
1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that
4435
-
the cursor is being iterated or has iterated past its end,
4436
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4442
+
1. If [=/this=]'s [=cursor/got value flag=] is false
4443
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4444
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4437
4445
4438
4446
1. Set [=/this=]'s [=cursor/got value flag=] to false.
4439
4447
@@ -4473,9 +4481,9 @@ invoked, must run these steps:
4473
4481
[=effective object store=] has been deleted, [=throw=] an
4474
4482
"{{InvalidStateError}}" {{DOMException}}.
4475
4483
4476
-
1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that
4477
-
the cursor is being iterated or has iterated past its end,
4478
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4484
+
1. If [=/this=]'s [=cursor/got value flag=] is false
4485
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4486
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4479
4487
4480
4488
1. If |key| is given, then:
4481
4489
@@ -4538,9 +4546,9 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4538
4546
1. If [=/this=]'s [=cursor/direction=] is not {{"next"}} or {{"prev"}},
4539
4547
[=throw=] an "{{InvalidAccessError}}" {{DOMException}}.
4540
4548
4541
-
1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that
4542
-
the cursor is being iterated or has iterated past its end,
4543
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4549
+
1. If [=/this=]'s [=cursor/got value flag=] is false
4550
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4551
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4544
4552
4545
4553
1. Let |r| be the result of running [=convert a value to
4546
4554
a key=] with |key|. Rethrow any exceptions.
@@ -4599,6 +4607,39 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4599
4607
flag=] has been set to false.
4600
4608
</aside>
4601
4609
4610
+
<div class=algorithm>
4611
+
4612
+
The <dfn method for=IDBCursor>close()</dfn> method, when invoked, must run these steps:
4613
+
4614
+
1. Let |transaction| be [=/this=]'s [=cursor/transaction=].
4615
+
4616
+
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=], then [=throw=] a "{{TransactionInactiveError}}" {{DOMException}}.
4617
+
4618
+
1. If [=/this=]'s [=cursor/source=] or [=effective object store=] has been deleted, then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4619
+
4620
+
1. If [=/this=]'s [=cursor/got value flag=] is false
4621
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4622
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4623
+
4624
+
1. Set [=/this=]'s [=cursor/got value flag=] to false.
4625
+
4626
+
1. Set [=/this=]'s [=cursor/key=] to undefined.
4627
+
4628
+
1. If [=/this=]'s [=cursor/source=] is an [=/index=], then set [=/this=]'s [=object store position=] to undefined.
4629
+
4630
+
1. If [=/this=]'s [=cursor/key only flag=] is false, then set [=/this=]'s [=cursor/value=] to undefined.
4631
+
4632
+
</div>
4633
+
4634
+
<aside class=note>
4635
+
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.
4636
+
</aside>
4637
+
4638
+
<aside class=advisement>
4639
+
🚧
4640
+
The {{IDBCursor/close()}} method is new in this edition.
4641
+
🚧
4642
+
</aside>
4602
4643
4603
4644
4604
4645
<div class="domintro note">
@@ -4643,9 +4684,9 @@ invoked, must run these steps:
4643
4684
1. If [=/this=]'s [=cursor/source=] or [=effective object
4644
4685
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4645
4686
4646
-
1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that
4647
-
the cursor is being iterated or has iterated past its end,
4648
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4687
+
1. If [=/this=]'s [=cursor/got value flag=] is false
4688
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4689
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4649
4690
4650
4691
1. If [=/this=]'s [=cursor/key only flag=] is true, [=throw=] an
4651
4692
"{{InvalidStateError}}" {{DOMException}}.
@@ -4709,9 +4750,9 @@ must run these steps:
4709
4750
1. If [=/this=]'s [=cursor/source=] or [=effective object
4710
4751
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4711
4752
4712
-
1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that
4713
-
the cursor is being iterated or has iterated past its end,
4714
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4753
+
1. If [=/this=]'s [=cursor/got value flag=] is false
4754
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4755
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4715
4756
4716
4757
1. If [=/this=]'s [=cursor/key only flag=] is true, [=throw=] an
4717
4758
"{{InvalidStateError}}" {{DOMException}}.
@@ -6816,6 +6857,7 @@ For the revision history of the second edition, see [that document's Revision Hi
6816
6857
* Transactions are now temporarily made inactive during clone operations.
6817
6858
* Added {{IDBTransactionOptions/durability}} option and {{IDBTransaction/durability}} attribute. ([Issue #50](https://github.com/w3c/IndexedDB/issues/50))
6818
6859
* 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))
6860
+
* Added {{IDBCursor/close()}} method for {{IDBCursor}}. ([Issue #185](https://github.com/w3c/IndexedDB/issues/185))
0 commit comments