diff --git a/index.bs b/index.bs index 3a7888e..633b628 100644 --- a/index.bs +++ b/index.bs @@ -4325,6 +4325,7 @@ interface IDBCursor { void advance([EnforceRange] unsigned long count); void continue(optional any key); void continuePrimaryKey(any key, any primaryKey); + void close(); [NewObject] IDBRequest update(any value); [NewObject] IDBRequest delete(); @@ -4368,7 +4369,8 @@ enum IDBCursorDirection { The source attribute's getter must return **this**'s [=cursor/source=]. This attribute never returns null or throws an exception, even if the -cursor is currently being iterated, has iterated past its end, or its +cursor is currently being iterated, has iterated past its end, +{{IDBCursor/close()}} has been called, or its [=/transaction=] is not [=transaction/active=]. The direction attribute's getter @@ -4438,6 +4440,10 @@ 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. @@ -4458,9 +4464,9 @@ invoked, must run these steps: 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. @@ -4500,9 +4506,9 @@ invoked, must run these steps: [=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: @@ -4565,9 +4571,9 @@ The continuePrimaryKey(|key|, 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 running [=convert a value to a key=] with |key|. Rethrow any exceptions. @@ -4626,6 +4632,39 @@ The continuePrimaryKey(|key|, flag=] has been set to false. +
+ +The close() method, when invoked, must run these steps: + +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. + +
+ + + +
@@ -4672,9 +4711,9 @@ invoked, must run these steps: 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}}. @@ -4738,9 +4777,9 @@ must run these steps: 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}}. @@ -6815,6 +6854,7 @@ For the revision history of the second edition, see [that document's Revision Hi * Added {{IDBCursor/request}} attribute. ([Issue #255](https://github.com/w3c/IndexedDB/issues/255)) * Removed handling for nonstandard `lastModifiedDate` property of {{File}} objects. ([Issue #215](https://github.com/w3c/IndexedDB/issues/215)) * Remove escaping {{IDBKeyRange/includes()}} method. ([Issue #294](https://github.com/w3c/IndexedDB/issues/294)) +* Added {{IDBCursor/close()}} method for {{IDBCursor}}. ([Issue #185](https://github.com/w3c/IndexedDB/issues/185)) # Acknowledgements # {#acknowledgements}