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
Copy file name to clipboardExpand all lines: index.bs
+57-16Lines changed: 57 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -4395,6 +4395,7 @@ interface IDBCursor {
4395
4395
void advance([EnforceRange] unsigned long count);
4396
4396
void continue(optional any key);
4397
4397
void continuePrimaryKey(any key, any primaryKey);
4398
+
void close();
4398
4399
4399
4400
[NewObject] IDBRequest update(any value);
4400
4401
[NewObject] IDBRequest delete();
@@ -4438,7 +4439,8 @@ enum IDBCursorDirection {
4438
4439
The <dfn attribute for=IDBCursor>source</dfn> attribute's getter must
4439
4440
return the [=cursor/source=] of the [=cursor=]. This
4440
4441
attribute never returns null or throws an exception, even if the
4441
-
cursor is currently being iterated, has iterated past its end, or its
4442
+
cursor is currently being iterated, has iterated past its end,
4443
+
{{IDBCursor/close()}} has been called, or its
4442
4444
[=/transaction=] is not [=transaction/active=].
4443
4445
4444
4446
The <dfn attribute for=IDBCursor>direction</dfn> attribute's getter
@@ -4508,6 +4510,10 @@ return the [=cursor/request=] of the [=cursor=].
4508
4510
Advances the cursor to the next [=object-store/record=] in range matching
4509
4511
or after |key| and |primaryKey|. Throws an "{{InvalidAccessError}}" {{DOMException}}
4510
4512
if the [=cursor/source=] is not an [=/index=].
4513
+
4514
+
: |cursor| . {{IDBCursor/close()|close}}()
4515
+
::
4516
+
Signals that the cursor is no longer needed, and that any associated resources can be released.
4511
4517
</dl>
4512
4518
</div>
4513
4519
@@ -4529,9 +4535,9 @@ invoked, must run these steps:
4529
4535
1. If the cursor's [=cursor/source=] or [=effective object
4530
4536
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4531
4537
4532
-
1. If this cursor's [=cursor/got value flag=] is false, indicating that
4533
-
the cursor is being iterated or has iterated past its end,
4534
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4538
+
1. If this cursor's [=cursor/got value flag=] is false
4539
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4540
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4535
4541
4536
4542
1. Set this [=cursor=]'s [=cursor/got value flag=] to false.
4537
4543
@@ -4572,9 +4578,9 @@ invoked, must run these steps:
4572
4578
[=effective object store=] has been deleted, [=throw=] an
4573
4579
"{{InvalidStateError}}" {{DOMException}}.
4574
4580
4575
-
1. If this cursor's [=cursor/got value flag=] is false, indicating that
4576
-
the cursor is being iterated or has iterated past its end,
4577
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4581
+
1. If this cursor's [=cursor/got value flag=] is false
4582
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4583
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4578
4584
4579
4585
1. If |key| is given, then:
4580
4586
@@ -4638,9 +4644,9 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4638
4644
1. If this cursor's [=cursor/direction=] is not {{"next"}} or {{"prev"}},
4639
4645
[=throw=] an "{{InvalidAccessError}}" {{DOMException}}.
4640
4646
4641
-
1. If this cursor's [=cursor/got value flag=] is false, indicating that
4642
-
the cursor is being iterated or has iterated past its end,
4643
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4647
+
1. If this cursor's [=cursor/got value flag=] is false
4648
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4649
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4644
4650
4645
4651
1. Let |r| be the result of running [=convert a value to
4646
4652
a key=] with |key|. Rethrow any exceptions.
@@ -4699,6 +4705,40 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|,
4699
4705
flag=] has been set to false.
4700
4706
</aside>
4701
4707
4708
+
<div class=algorithm>
4709
+
4710
+
The <dfn method for=IDBCursor>close()</dfn> method, when invoked, must run these steps:
4711
+
4712
+
1. Let |transaction| be this [=cursor=]'s
4713
+
[=cursor/transaction=].
4714
+
4715
+
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=], then [=throw=] a "{{TransactionInactiveError}}" {{DOMException}}.
4716
+
4717
+
1. If this [=cursor=]'s [=cursor/source=] or [=effective object store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4718
+
4719
+
1. If this [=cursor=]'s [=cursor/got value flag=] is false
4720
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4721
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4722
+
4723
+
1. Set this [=cursor=]'s [=cursor/got value flag=] to false.
4724
+
4725
+
1. Set this [=cursor=]'s [=cursor/key=] to undefined.
4726
+
4727
+
1. If this [=cursor=]'s [=cursor/source=] is an [=/index=], then set this [=cursor=]'s [=object store position=] to undefined.
4728
+
4729
+
1. If this [=cursor=]'s [=cursor/key only flag=] is false, then set this [=cursor=]'s [=cursor/value=] to undefined.
4730
+
4731
+
</div>
4732
+
4733
+
<aside class=note>
4734
+
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.
4735
+
</aside>
4736
+
4737
+
<aside class=advisement>
4738
+
🚧
4739
+
The {{IDBCursor/close()}} method is new in this edition.
4740
+
🚧
4741
+
</aside>
4702
4742
4703
4743
4704
4744
<div class=note>
@@ -4746,9 +4786,9 @@ invoked, must run these steps:
4746
4786
1. If the cursor's [=cursor/source=] or [=effective object
4747
4787
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4748
4788
4749
-
1. If this cursor's [=cursor/got value flag=] is false, indicating that
4750
-
the cursor is being iterated or has iterated past its end,
4751
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4789
+
1. If this cursor's [=cursor/got value flag=] is false
4790
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4791
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4752
4792
4753
4793
1. If this cursor's [=cursor/key only flag=] is true, [=throw=] an
4754
4794
"{{InvalidStateError}}" {{DOMException}}.
@@ -4813,9 +4853,9 @@ must run these steps:
4813
4853
1. If the cursor's [=cursor/source=] or [=effective object
4814
4854
store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4815
4855
4816
-
1. If this cursor's [=cursor/got value flag=] is false, indicating that
4817
-
the cursor is being iterated or has iterated past its end,
4818
-
[=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4856
+
1. If this cursor's [=cursor/got value flag=] is false
4857
+
(indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called),
4858
+
then [=throw=] an "{{InvalidStateError}}" {{DOMException}}.
4819
4859
4820
4860
1. If this cursor's [=cursor/key only flag=] is true, [=throw=] an
4821
4861
"{{InvalidStateError}}" {{DOMException}}.
@@ -6893,6 +6933,7 @@ For the revision history of the second edition, see [that document's Revision Hi
0 commit comments