[Chromium] WebSQLDatabase version handling is broken in multi-process browsers.
authormichaeln@google.com <michaeln@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Aug 2011 00:21:56 +0000 (00:21 +0000)
committermichaeln@google.com <michaeln@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 2 Aug 2011 00:21:56 +0000 (00:21 +0000)
commita6205c70d9357b95d08b4ecc380bfe7ef06ed0ac
tree1f29652f69976f7b0e72001d179d6986537037d6
parent5f5733bee9b1d4a89117bc2427a2dda3cf50b276
[Chromium] WebSQLDatabase version handling is broken in multi-process browsers.
https://bugs.webkit.org/show_bug.cgi?id=65486

The WebCore::AbstractDatabase class maintains a global in-memory map of
the version numbers associated with open database files, but that map is
not reliable in a multi-process system like Chrome. So instead of relying
on the cached values in that map, we read the value from the database (and
update the cached value) where possible. There are two edge cases where that's
not possible because the scriptable interface requires synchronous access
to the version: the .version attribute getter and the .openDatabase() method.
In those cases, we have no choice but to use the potentially stale cached value.

Reviewed by Darin Fisher.

No new tests. Existing layout tests cover the version handling functionality.

* storage/AbstractDatabase.cpp:
(WebCore::AbstractDatabase::version):
(WebCore::AbstractDatabase::performOpenAndVerify):
(WebCore::AbstractDatabase::getVersionFromDatabase):
(WebCore::AbstractDatabase::setVersionInDatabase):
(WebCore::AbstractDatabase::setExpectedVersion):
(WebCore::AbstractDatabase::getCachedVersion):
(WebCore::AbstractDatabase::setCachedVersion):
(WebCore::AbstractDatabase::getActualVersionForTransaction):
* storage/AbstractDatabase.h:
(WebCore::AbstractDatabase::expectedVersion):
* storage/ChangeVersionWrapper.cpp:
(WebCore::ChangeVersionWrapper::handleCommitFailedAfterPostflight):
* storage/ChangeVersionWrapper.h:
* storage/Database.cpp:
(WebCore::Database::openDatabase):
* storage/DatabaseSync.cpp:
(WebCore::DatabaseSync::openDatabaseSync):
(WebCore::DatabaseSync::changeVersion):
* storage/SQLTransaction.cpp:
(WebCore::SQLTransaction::SQLTransaction):
(WebCore::SQLTransaction::executeSQL):
(WebCore::SQLTransaction::openTransactionAndPreflight):
(WebCore::SQLTransaction::runCurrentStatement):
(WebCore::SQLTransaction::postflightAndCommit):
* storage/SQLTransaction.h:
* storage/SQLTransactionSync.cpp:
(WebCore::SQLTransactionSync::SQLTransactionSync):
(WebCore::SQLTransactionSync::executeSQL):
(WebCore::SQLTransactionSync::begin):
* storage/SQLTransactionSync.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@92155 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/storage/AbstractDatabase.cpp
Source/WebCore/storage/AbstractDatabase.h
Source/WebCore/storage/ChangeVersionWrapper.cpp
Source/WebCore/storage/ChangeVersionWrapper.h
Source/WebCore/storage/Database.cpp
Source/WebCore/storage/DatabaseSync.cpp
Source/WebCore/storage/SQLTransaction.cpp
Source/WebCore/storage/SQLTransaction.h
Source/WebCore/storage/SQLTransactionSync.cpp
Source/WebCore/storage/SQLTransactionSync.h