mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 666580 - Use a transaction for indexedDB schema creation.
r=bent
This commit is contained in:
parent
3b3f1cf4c7
commit
2e6a5d289e
@ -412,11 +412,17 @@ CreateDatabaseConnection(const nsAString& aName,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
mozStorageTransaction transaction(connection, PR_FALSE,
|
||||
mozIStorageConnection::TRANSACTION_IMMEDIATE);
|
||||
|
||||
rv = CreateTables(connection);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = CreateMetaData(connection, aName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = transaction.Commit();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Check to make sure that the database schema is correct again.
|
||||
|
@ -280,7 +280,7 @@ IDBTransaction::GetOrCreateConnection(mozIStorageConnection** aResult)
|
||||
NS_ENSURE_TRUE(connection, NS_ERROR_FAILURE);
|
||||
|
||||
nsCString beginTransaction;
|
||||
if (mMode == nsIIDBTransaction::READ_WRITE) {
|
||||
if (mMode != nsIIDBTransaction::READ_ONLY) {
|
||||
beginTransaction.AssignLiteral("BEGIN IMMEDIATE TRANSACTION;");
|
||||
}
|
||||
else {
|
||||
@ -978,7 +978,7 @@ CommitHelper::Run()
|
||||
IndexedDatabaseManager::SetCurrentDatabase(database);
|
||||
|
||||
if (!mAborted) {
|
||||
NS_NAMED_LITERAL_CSTRING(release, "END TRANSACTION");
|
||||
NS_NAMED_LITERAL_CSTRING(release, "COMMIT TRANSACTION");
|
||||
if (NS_FAILED(mConnection->ExecuteSimpleSQL(release))) {
|
||||
mAborted = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user