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 10400 - [IndexedDB] IDBCursor.continue should not return anything
Summary: [IndexedDB] IDBCursor.continue should not return anything
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: Indexed Database API (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Andrei Popescu
QA Contact: public-webapps-bugzilla
Depends on:
Reported: 2010-08-19 14:21 UTC by Jeremy Orlow
Modified: 2010-08-27 10:17 UTC (History)
4 users (show)

See Also:


Description Jeremy Orlow 2010-08-19 14:21:40 UTC
The IDL for IDBCursor.continue has it returning a boolean, but it's pretty clear it's supposed to be returning an IDBRequest.  (The text for continue even talks about firing a success events on the "returned object".)

It also says that result should be null in the case of hitting the end of the range.  It doesn't specify what it should be in the case that it's not at the end, though.  Returning the key or the value doesn't make any sense because the key or value itself could be null (and thus there's no way to distinguish between the end and a null key/value).  Returning null doesn't make sense because you still can't distinguish.  The sync interface returns a bool to say whether it's at the end of the range.  So it seems pretty clear to me that the async variation should too "return" a bool through the success event.
Comment 1 Ben Turner 2010-08-19 17:36:28 UTC
(In reply to comment #0)

Hm, I think the wording in the spec is bad, but I believe this bug is invalid. The way we envisioned this for the async api is that calling continue() always returns true (to match sync api, but it's really pointless) and the original event listener is called again. There is no new request object. So it works like this:

  var request = objectStore.openCursor();
  request.onsuccess = function (event) {
    var cursor = event.result;
    if (cursor) {
      // Do something...
      // And again...
    else {
      // No more values...
This way you don't have to define multiple request objects and event listeners.

For the sync api, I think it should work very similarly:

  var cursor = objectStore.openCursor();
  if (cursor) {
    do {
      // Do something..
    } while (cursor.continue());
Comment 2 Jeremy Orlow 2010-08-19 17:46:08 UTC
Well, regardless of what's intended, the spec does not convey what you guys had in mind.  Let's discuss this on list though...
Comment 3 Jeremy Orlow 2010-08-19 21:11:45 UTC
As discussed on the thread, we should make the function not return a value and clarify the text per Ben's comment.
Comment 4 Andrei Popescu 2010-08-27 10:17:42 UTC
Fixed in