Bugzilla – Bug 14408
[IndexedDB] Cursors .key/.primaryKey/.value shouldn't throw as soon as .continue is called
Last modified: 2012-02-22 18:16:28 UTC
Currently the 'got value' flag is set to false as soon as .continue() is called. This makes it awkward to call .continue() at the top of your success handler and then have several different branches that do different things depending on the data since each branch has to take care to call .continue() at the end.
Instead we should let cursors keep their current value until the success/error event is fired, at which point their values are updated.
I'll take this bug
Fixed. Cursors now keep their value until a new value is loaded, or the cursor iterates off the end.
Do we need to remove the following text from the IDBCursor.continue and IDBCursor.advance methods to finalize the changes to this bug:
-->Before this method returns, unless an exception was thrown, it sets the got value flag on the cursor to false.
I think it's still needed such that calling .continue() a second time still throws.
Note that the 'got value' flag doesn't affect the definition of the key/primaryKey/value attributes any more.
Does that mean that setting the 'got value' flag to false won't prevent me from reading the cursor information that was returned to the onsuccess handler after the continue method is invoked?
Jonas, Thanks for the feedback. This makese sense. I'll go ahead and close the bug.