<?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>11396</bug_id>
          
          <creation_ts>2010-11-24 06:21:29 +0000</creation_ts>
          <short_desc>Add a callback to IDBDatabaseSync.transaction</short_desc>
          <delta_ts>2011-03-08 03:42:43 +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>All</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="Pablo Castro">pablo.castro</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>42745</commentid>
    <comment_count>0</comment_count>
    <who name="Pablo Castro">pablo.castro</who>
    <bug_when>2010-11-24 06:21:29 +0000</bug_when>
    <thetext>In the TPAC folks proposed to tweak the sync API such that it prevents code patterns that cause deadlocks at the start of a transaction.

We ended up with a proposal where we&apos;d add a callback to IDBDatabaseSync.transaction, and work in that transaction can only happen within the callback.

The change would be:
- add a callback argument to IDBDatabaseSync.transaction(), the callback will receive one argument that&apos;s the transaction object
- once the callback returns, the transaction is committed
- if an exception is thrown and not caught inside the callback then the transaction must be aborted
- make the method void, no transaction object is returned
- a call to transaction() from within a transaction callback or an async API callback that involves a transaction will fail with NOT_ALLOWED_ERR.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42747</commentid>
    <comment_count>1</comment_count>
    <who name="Jeremy Orlow">jorlow</who>
    <bug_when>2010-11-24 10:48:38 +0000</bug_when>
    <thetext>It&apos;s worth making clear that the callback will be called synchronously.  (i.e. no code after the transaction call will execute until after the callback executes (if it&apos;ll ever execute).  The callback is just to make the scope of the transaction more explicit.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>