<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>10400</bug_id>
          
          <creation_ts>2010-08-19 14:21:40 +0000</creation_ts>
          <short_desc>[IndexedDB] IDBCursor.continue should not return anything</short_desc>
          <delta_ts>2010-08-27 10:17:42 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Indexed Database API</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jeremy Orlow">jorlow</reporter>
          <assigned_to name="Andrei Popescu">andreip</assigned_to>
          <cc>bent.mozilla</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
    
    <cc>sdwilsh</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>37640</commentid>
    <comment_count>0</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2010-08-19 14:21:40 +0000</bug_when>
    <thetext>The IDL for IDBCursor.continue has it returning a boolean, but it&apos;s pretty clear it&apos;s supposed to be returning an IDBRequest.  (The text for continue even talks about firing a success events on the &quot;returned object&quot;.)

It also says that result should be null in the case of hitting the end of the range.  It doesn&apos;t specify what it should be in the case that it&apos;s not at the end, though.  Returning the key or the value doesn&apos;t make any sense because the key or value itself could be null (and thus there&apos;s no way to distinguish between the end and a null key/value).  Returning null doesn&apos;t make sense because you still can&apos;t distinguish.  The sync interface returns a bool to say whether it&apos;s at the end of the range.  So it seems pretty clear to me that the async variation should too &quot;return&quot; a bool through the success event.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37646</commentid>
    <comment_count>1</comment_count>
    <who name="Ben Turner">bent.mozilla</who>
    <bug_when>2010-08-19 17:36:28 +0000</bug_when>
    <thetext>(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&apos;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&apos;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());
  }</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37648</commentid>
    <comment_count>2</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2010-08-19 17:46:08 +0000</bug_when>
    <thetext>Well, regardless of what&apos;s intended, the spec does not convey what you guys had in mind.  Let&apos;s discuss this on list though...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37660</commentid>
    <comment_count>3</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2010-08-19 21:11:45 +0000</bug_when>
    <thetext>As discussed on the thread, we should make the function not return a value and clarify the text per Ben&apos;s comment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>37992</commentid>
    <comment_count>4</comment_count>
    <who name="Andrei Popescu">andreip</who>
    <bug_when>2010-08-27 10:17:42 +0000</bug_when>
    <thetext>Fixed in http://dvcs.w3.org/hg/IndexedDB/rev/22fea0337d0b</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>