diff --git a/index.bs b/index.bs index 05c1eab..16c9e06 100644 --- a/index.bs +++ b/index.bs @@ -4280,6 +4280,7 @@ interface IDBCursor { undefined advance([EnforceRange] unsigned long count); undefined continue(optional any key); undefined continuePrimaryKey(any key, any primaryKey); + undefined close(); [NewObject] IDBRequest update(any value); [NewObject] IDBRequest delete(); @@ -4325,7 +4326,8 @@ return [=/this=]'s [=cursor/source=]. @@ -4402,6 +4404,12 @@ return [=/this=]'s [=cursor/request=]. Advances the cursor to the next [=object-store/record=] in range matching or after |key| and |primaryKey|. Throws an "{{InvalidAccessError}}" {{DOMException}} if the [=cursor/source=] is not an [=/index=]. + + + : |cursor| . {{IDBCursor/close()|close}}() + :: + Signals that the cursor is no longer needed, and that any associated resources can be released. + @@ -4420,9 +4428,9 @@ The advance(|count|) method steps are: 1. If [=/this=]'s [=cursor/source=] or [=effective object store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. -1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that - the cursor is being iterated or has iterated past its end, - [=throw=] an "{{InvalidStateError}}" {{DOMException}}. +1. If [=/this=]'s [=cursor/got value flag=] is false + (indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called), + then [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Set [=/this=]'s [=cursor/got value flag=] to false. @@ -4460,9 +4468,9 @@ The continue(|key|) method steps are: [=effective object store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. -1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that - the cursor is being iterated or has iterated past its end, - [=throw=] an "{{InvalidStateError}}" {{DOMException}}. +1. If [=/this=]'s [=cursor/got value flag=] is false + (indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called), + then [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If |key| is given, then: @@ -4522,9 +4530,9 @@ The continuePrimaryKey(|key|, |primaryKey|) meth 1. If [=/this=]'s [=cursor/direction=] is not {{"next"}} or {{"prev"}}, [=throw=] an "{{InvalidAccessError}}" {{DOMException}}. -1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that - the cursor is being iterated or has iterated past its end, - [=throw=] an "{{InvalidStateError}}" {{DOMException}}. +1. If [=/this=]'s [=cursor/got value flag=] is false + (indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called), + then [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. Let |r| be the result of [=/converting a value to a key=] with |key|. Rethrow any exceptions. @@ -4581,6 +4589,39 @@ The continuePrimaryKey(|key|, |primaryKey|) meth flag=] has been set to false. +
+ +The close() method steps are: + +1. Let |transaction| be [=/this=]'s [=cursor/transaction=]. + +1. If |transaction|'s [=transaction/state=] is not [=transaction/active=], then [=throw=] a "{{TransactionInactiveError}}" {{DOMException}}. + +1. If [=/this=]'s [=cursor/source=] or [=effective object store=] has been deleted, then [=throw=] an "{{InvalidStateError}}" {{DOMException}}. + +1. If [=/this=]'s [=cursor/got value flag=] is false + (indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called), + then [=throw=] an "{{InvalidStateError}}" {{DOMException}}. + +1. Set [=/this=]'s [=cursor/got value flag=] to false. + +1. Set [=/this=]'s [=cursor/key=] to undefined. + +1. If [=/this=]'s [=cursor/source=] is an [=/index=], then set [=/this=]'s [=object store position=] to undefined. + +1. If [=/this=]'s [=cursor/key only flag=] is false, then set [=/this=]'s [=cursor/value=] to undefined. + +
+ + + +
@@ -4624,9 +4665,9 @@ The update(|value|) method steps are: 1. If [=/this=]'s [=cursor/source=] or [=effective object store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. -1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that - the cursor is being iterated or has iterated past its end, - [=throw=] an "{{InvalidStateError}}" {{DOMException}}. +1. If [=/this=]'s [=cursor/got value flag=] is false + (indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called), + then [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=/this=]'s [=cursor/key only flag=] is true, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. @@ -4685,9 +4726,9 @@ The delete() method steps are: 1. If [=/this=]'s [=cursor/source=] or [=effective object store=] has been deleted, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. -1. If [=/this=]'s [=cursor/got value flag=] is false, indicating that - the cursor is being iterated or has iterated past its end, - [=throw=] an "{{InvalidStateError}}" {{DOMException}}. +1. If [=/this=]'s [=cursor/got value flag=] is false + (indicating that the cursor is being iterated, has iterated past its end, or that {{IDBCursor/close()}} was called), + then [=throw=] an "{{InvalidStateError}}" {{DOMException}}. 1. If [=/this=]'s [=cursor/key only flag=] is true, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. @@ -6801,6 +6842,7 @@ For the revision history of the second edition, see [that document's Revision Hi * 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)) * Added Accessibility considerations section. ([Issue #327](https://github.com/w3c/IndexedDB/issues/327)) * Used [[infra]]'s list sorting definition. ([Issue #346](https://github.com/w3c/IndexedDB/issues/346)) +* Added {{IDBCursor/close()}} method for {{IDBCursor}}. ([Issue #185](https://github.com/w3c/IndexedDB/issues/185)) # Acknowledgements # {#acknowledgements}