Bug 14408 - [IndexedDB] Cursors .key/.primaryKey/.value shouldn't throw as soon as .continue is called
[IndexedDB] Cursors .key/.primaryKey/.value shouldn't throw as soon as .conti...
Status: RESOLVED FIXED
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API
unspecified
PC All
: P2 normal
: ---
Assigned To: Jonas Sicking
public-webapps-bugzilla
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-07 23:37 UTC by Jonas Sicking
Modified: 2012-02-22 18:16 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Sicking 2011-10-07 23:37:52 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.
Comment 1 Jonas Sicking 2011-11-02 15:47:21 UTC
I'll take this bug
Comment 2 Jonas Sicking 2011-11-30 20:11:24 UTC
Fixed. Cursors now keep their value until a new value is loaded, or the cursor iterates off the end.
Comment 3 Israel Hilerio [MSFT] 2012-02-15 23:00:30 UTC
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.
Comment 4 Jonas Sicking 2012-02-16 14:28:32 UTC
I think it's still needed such that calling .continue() a second time still throws.
Comment 5 Jonas Sicking 2012-02-16 14:29:12 UTC
Note that the 'got value' flag doesn't affect the definition of the key/primaryKey/value attributes any more.
Comment 6 Israel Hilerio [MSFT] 2012-02-16 17:32:37 UTC
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?
Comment 7 Jonas Sicking 2012-02-22 12:01:30 UTC
Exactly.
Comment 8 Israel Hilerio [MSFT] 2012-02-22 18:16:28 UTC
Jonas, Thanks for the feedback.  This makese sense. I'll go ahead and close the bug.