<?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>16441</bug_id>
          
          <creation_ts>2012-03-19 20:12:35 +0000</creation_ts>
          <short_desc>Spec should note that onsuccess shouldn’t be used for writes.</short_desc>
          <delta_ts>2012-07-16 21:49:56 +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>Linux</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="Yonathan Randolph">yonathan</reporter>
          <assigned_to name="This bug has no owner yet - up for the taking">dave.null</assigned_to>
          <cc>eliotgra</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>odinho</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>65775</commentid>
    <comment_count>0</comment_count>
    <who name="Yonathan Randolph">yonathan</who>
    <bug_when>2012-03-19 20:12:35 +0000</bug_when>
    <thetext>You generally should listen to the transaction’s “complete” event instead of the put/add request’s “success” event, because the transaction may fail after “success.” There’s at least one example of someone being confused by the wording[1]. Perhaps the spec should point out that you usually want to listen to “complete” for write requests.

Use of a write request’s “success”/“error” events is probably reserved for advanced use cases (e.g. to commit part of a transaction even when the later requests fail, or to retry a write that failed, or to measure progress when a transaction has multiple parts).

 [1]: https://developer.mozilla.org/en/IndexedDB/Using_IndexedDB</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70022</commentid>
    <comment_count>1</comment_count>
    <who name="Jonas Sicking (Not reading bugmail)">jonas</who>
    <bug_when>2012-07-16 00:40:02 +0000</bug_when>
    <thetext>Note that there are cases where listening for onsuccess is needed. For example if you are worried that a written entry might collide with an already existing one. In this case you might want to hold off further operations until the doubtful request has succeeded.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70029</commentid>
    <comment_count>2</comment_count>
    <who name="Eliot Graff">eliotgra</who>
    <bug_when>2012-07-16 21:49:56 +0000</bug_when>
    <thetext>Added this note to Transaction.oncomplete and also for IDBObjectstore.add().

To determine if a transaction has completed successfully, listen to the transaction’s complete event rather than the IDBObjectStore.add request’s success event, because the transaction may still fail after the success event fires.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>