This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14408 - [IndexedDB] Cursors .key/.primaryKey/.value shouldn't throw as soon as .continue is called
Summary: [IndexedDB] Cursors .key/.primaryKey/.value shouldn't throw as soon as .conti...
Status: RESOLVED FIXED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Jonas Sicking (Not reading bugmail)
QA Contact: public-webapps-bugzilla
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-07 23:37 UTC by Jonas Sicking (Not reading bugmail)
Modified: 2012-02-22 18:16 UTC (History)
3 users (show)

See Also:


Attachments

Description Jonas Sicking (Not reading bugmail) 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 (Not reading bugmail) 2011-11-02 15:47:21 UTC
I'll take this bug
Comment 2 Jonas Sicking (Not reading bugmail) 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 (Not reading bugmail) 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 (Not reading bugmail) 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 (Not reading bugmail) 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.