Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: Source/WebCore/storage/SQLTransaction.cpp

Issue 7563014: Merge 92155 - [Chromium] WebSQLDatabase version handling is broken in multi-process browsers. (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/WebCore/storage/SQLTransaction.h ('k') | Source/WebCore/storage/SQLTransactionSync.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/storage/SQLTransaction.cpp
===================================================================
--- Source/WebCore/storage/SQLTransaction.cpp (revision 92303)
+++ Source/WebCore/storage/SQLTransaction.cpp (working copy)
@@ -78,6 +78,7 @@
, m_modifiedDatabase(false)
, m_lockAcquired(false)
, m_readOnly(readOnly)
+ , m_hasVersionMismatch(false)
{
ASSERT(m_database);
}
@@ -105,9 +106,6 @@
if (m_database->deleted())
statement->setDatabaseDeletedError();
- if (!m_database->versionMatchesExpected())
- statement->setVersionMismatchedError();
-
enqueueStatement(statement);
}
@@ -272,9 +270,26 @@
return;
}
+ // Note: We intentionally retrieve the actual version even with an empty expected version.
+ // In multi-process browsers, we take this opportinutiy to update the cached value for
+ // the actual version. In single-process browsers, this is just a map lookup.
+ String actualVersion;
+ if (!m_database->getActualVersionForTransaction(actualVersion)) {
+ m_database->disableAuthorizer();
+ m_sqliteTransaction.clear();
+ m_database->enableAuthorizer();
+ m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "unable to read version");
+ handleTransactionError(false);
+ return;
+ }
+ m_hasVersionMismatch = !m_database->expectedVersion().isEmpty()
+ && (m_database->expectedVersion() != actualVersion);
+
// Transaction Steps 3 - Peform preflight steps, jumping to the error callback if they fail
if (m_wrapper && !m_wrapper->performPreflight(this)) {
+ m_database->disableAuthorizer();
m_sqliteTransaction.clear();
+ m_database->enableAuthorizer();
m_transactionError = m_wrapper->sqlError();
if (!m_transactionError)
m_transactionError = SQLError::create(SQLError::UNKNOWN_ERR, "unknown error occured setting up transaction");
@@ -369,6 +384,9 @@
m_database->resetAuthorizer();
+ if (m_hasVersionMismatch)
+ m_currentStatement->setVersionMismatchedError();
+
if (m_currentStatement->execute(m_database.get())) {
if (m_database->lastActionChangedDatabase()) {
// Flag this transaction as having changed the database for later delegate notification
@@ -465,6 +483,8 @@
// If the commit failed, the transaction will still be marked as "in progress"
if (m_sqliteTransaction->inProgress()) {
+ if (m_wrapper)
+ m_wrapper->handleCommitFailedAfterPostflight(this);
m_successCallbackWrapper.clear();
m_transactionError = SQLError::create(SQLError::DATABASE_ERR, "failed to commit the transaction");
handleTransactionError(false);
« no previous file with comments | « Source/WebCore/storage/SQLTransaction.h ('k') | Source/WebCore/storage/SQLTransactionSync.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698