<?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>11257</bug_id>
          
          <creation_ts>2010-11-08 11:12:24 +0000</creation_ts>
          <short_desc>Should IDBCursor.update be able to create a new entry?</short_desc>
          <delta_ts>2011-03-08 20:03:02 +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="This bug has no owner yet - up for the taking">dave.null</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>42247</commentid>
    <comment_count>0</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2010-11-08 11:12:24 +0000</bug_when>
    <thetext>What should happen in the following case:

db.transaction([&quot;foo&quot;]).objectStore(&quot;foo&quot;).openCursor().onsuccess = function(e) {
  var cursor = e.result;
  if (!cursor)
    return;

  cursor.delete();
  cursor.update({ id: 1234, value: &quot;Benny&quot; });
}


This situation can of course arrive in more subtle ways:

os = db.transaction([&quot;foo&quot;]).objectStore(&quot;foo&quot;);
os.openCursor().onsuccess = function(e) {
  var cursor = e.result;
  if (!cursor)
    return;

  cursor.update({ id: 1234, value: &quot;Benny&quot; });
}
os.delete(1234);


As specified, IDBCursor.update behaves just like IDBObjectStore.put and just creates a new entry, but this might be somewhat unexpected behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46519</commentid>
    <comment_count>1</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2011-03-08 04:20:58 +0000</bug_when>
    <thetext>Based on the resulting thread, it seems the answer is no.  So we should probably take out the issues in the spec related to this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46556</commentid>
    <comment_count>2</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2011-03-08 20:02:47 +0000</bug_when>
    <thetext>The answer is &quot;yes&quot;. Checked in a clarification to that effect.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>