This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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.
(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... alert(cursor.value); // And again... cursor.continue(); } 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.. alert(cursor.value); } while (cursor.continue()); }
Well, regardless of what's intended, the spec does not convey what you guys had in mind. Let's discuss this on list though...
As discussed on the thread, we should make the function not return a value and clarify the text per Ben's comment.
Fixed in http://dvcs.w3.org/hg/IndexedDB/rev/22fea0337d0b