<?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>11394</bug_id>
          
          <creation_ts>2010-11-23 23:50:05 +0000</creation_ts>
          <short_desc>We should throw if continue() is called with a key &lt;= the current position</short_desc>
          <delta_ts>2011-03-08 00:53:12 +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="Jonas Sicking (Not reading bugmail)">jonas</reporter>
          <assigned_to name="Jeremy Orlow">jorlow</assigned_to>
          <cc>jorlow</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>42740</commentid>
    <comment_count>0</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2010-11-23 23:50:05 +0000</bug_when>
    <thetext>(The below assumes a forward iterating cursor, opposite applies for a reverse iterating cursor of course).

The spec currently states that when calling IDBCursor.continue and passing in a key, the cursor moves to the first record which is greater than the current position, and greater than or equal to the passed in key.

As we implemented this we realized that this makes the situation when someone passes in a key which is less than or equal to the current position very strange. The effect is that the key argument is ignored.

However most likely this was done in error. Worst case, the author might have thought that the cursor would go back to the first entry whose key is greater than or equal to the passed in key, ignoring the current position.

One example of buggy code would be displaying a sales-table with 10 entries from every employee name. If the code ends up passing in a key which is less than or equal to the passed in key, the code likely contains an error.

So a better behavior would be to throw if the passed in key is less than or equal to the cursors current position. This makes it more clear that an error occurred, as well as helps a debugger detect the exception and display the current program state.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46307</commentid>
    <comment_count>1</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2011-03-04 04:02:08 +0000</bug_when>
    <thetext>What error should we throw?  DATA_ERR?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46491</commentid>
    <comment_count>2</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2011-03-08 00:53:12 +0000</bug_when>
    <thetext>Jonas just fixed this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>