Bug 792833 - 'Do not unset current transaction until after savepoint has been released'. r=khuey.
authorBen Turner <bent.mozilla@gmail.com>
Thu, 20 Sep 2012 09:26:58 -0700
changeset 107747 30ae02a8ce8cc17e39c1775a3711379766ef0d49
parent 107746 e716df0361dbc7db2faa1a4e328ec3e7f8f1ff4c
child 107748 b8397781f862d690c4731c1394fa92566a4a0bb2
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewerskhuey
bugs792833
milestone18.0a1
Bug 792833 - 'Do not unset current transaction until after savepoint has been released'. r=khuey.
dom/indexedDB/AsyncConnectionHelper.cpp
--- a/dom/indexedDB/AsyncConnectionHelper.cpp
+++ b/dom/indexedDB/AsyncConnectionHelper.cpp
@@ -283,28 +283,30 @@ AsyncConnectionHelper::Run()
           NS_WARNING("Failed to make savepoint!");
         }
       }
     }
 
     mResultCode = DoDatabaseWork(connection);
 
     if (mDatabase) {
-      IndexedDatabaseManager::SetCurrentWindow(nullptr);
-
       // Release or roll back the savepoint depending on the error code.
       if (hasSavepoint) {
         NS_ASSERTION(mTransaction, "Huh?!");
         if (NS_SUCCEEDED(mResultCode)) {
           mTransaction->ReleaseSavepoint();
         }
         else {
           mTransaction->RollbackSavepoint();
         }
       }
+
+      // Don't unset this until we're sure that all SQLite activity has
+      // completed!
+      IndexedDatabaseManager::SetCurrentWindow(nullptr);
     }
   }
   else {
     // NS_ERROR_NOT_AVAILABLE is our special code for "database is invalidated"
     // and we should fail with RECOVERABLE_ERR.
     if (rv == NS_ERROR_NOT_AVAILABLE) {
       mResultCode = NS_ERROR_DOM_INDEXEDDB_RECOVERABLE_ERR;
     }