Bug 728921 - 'IndexedDB: FileManager file enumeration should run within a transaction'. r=sicking.
authorBen Turner <bent.mozilla@gmail.com>
Mon, 20 Feb 2012 10:35:45 -0800
changeset 87216 efd7b7d7f91c83d55cc36b30e8ad5326c1bcb100
parent 87215 121ada16c79304e61fb723861f8d72dd41f30c29
child 87217 81311083cc0a565ac8173fe8876cbe406fd1539a
push id6257
push userbturner@mozilla.com
push dateMon, 20 Feb 2012 18:36:36 +0000
treeherdermozilla-inbound@efd7b7d7f91c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs728921
milestone13.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 728921 - 'IndexedDB: FileManager file enumeration should run within a transaction'. r=sicking.
dom/indexedDB/FileManager.cpp
--- a/dom/indexedDB/FileManager.cpp
+++ b/dom/indexedDB/FileManager.cpp
@@ -37,17 +37,19 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "FileManager.h"
 
 #include "mozIStorageConnection.h"
 #include "mozIStorageServiceQuotaManagement.h"
 #include "mozIStorageStatement.h"
 #include "nsISimpleEnumerator.h"
+
 #include "mozStorageCID.h"
+#include "mozStorageHelper.h"
 #include "nsContentUtils.h"
 
 #include "FileInfo.h"
 #include "IndexedDatabaseManager.h"
 
 USING_INDEXEDDB_NAMESPACE
 
 namespace {
@@ -88,16 +90,18 @@ FileManager::Init(nsIFile* aDirectory,
     NS_ENSURE_SUCCESS(rv, rv);
     NS_ENSURE_TRUE(isDirectory, NS_ERROR_FAILURE);
   }
   else {
     rv = aDirectory->Create(nsIFile::DIRECTORY_TYPE, 0755);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
+  mozStorageTransaction transaction(aConnection, false);
+
   rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
     "CREATE VIRTUAL TABLE fs USING filesystem;"
   ));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<mozIStorageStatement> stmt;
   rv = aConnection->CreateStatement(NS_LITERAL_CSTRING(
     "SELECT name, (name IN (SELECT id FROM file)) FROM fs "
@@ -146,16 +150,17 @@ FileManager::Init(nsIFile* aDirectory,
   rv = aConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
     "DROP TABLE fs;"
   ));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = aDirectory->GetPath(mDirectoryPath);
   NS_ENSURE_SUCCESS(rv, rv);
 
+  transaction.Commit();
   return NS_OK;
 }
 
 nsresult
 FileManager::Load(mozIStorageConnection* aConnection)
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");