Source/WebCore: Return more complete error and exception messages when a
authormichaeln@google.com <michaeln@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Nov 2011 19:46:46 +0000 (19:46 +0000)
committermichaeln@google.com <michaeln@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 14 Nov 2011 19:46:46 +0000 (19:46 +0000)
commitb5dec3610b8c6a5e81ceb6c131fe61718282fb4b
tree3732e4527d1533a0fe0b21d97430452f6841b52c
parente1e4591ccad2a2566ec11b600b12ef704c68387c
Source/WebCore: Return more complete error and exception messages when a
WebSQLDatabase function fails. Produce console logging
for openDatabase() errors and vacuum errors. Add a lastErrorMessage
accessor to the DatabaseSync interface.
https://bugs.webkit.org/show_bug.cgi?id=71575

Reviewed by David Levin.

Yes, see LayoutTests/ChangeLog in this patch.

* platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::SQLiteDatabase):
(WebCore::SQLiteDatabase::open):
(WebCore::SQLiteDatabase::close):
(WebCore::SQLiteDatabase::lastError):
(WebCore::SQLiteDatabase::lastErrorMsg):
(WebCore::SQLiteDatabase:: runVacuumCommand):
(WebCore::SQLiteDatabase:: runIncrementalVacuumCommand):
Reflect errors in the open() method in lastError() and lastErrorMsg().
Return an error codes for runVacuumCommand() and runIncrementalVacuumCommand().

* platform/sql/SQLiteDatabase.h:
* storage/AbstractDatabase.cpp:
(WebCore::formatErrorMessage):
(WebCore::AbstractDatabase::performOpenAndVerify):
(WebCore::AbstractDatabase::logErrorMessage):
During openAndVerify, produce formatted error messages that include what was being done, the sqlite error code,
and the sqlite error message. Add a helper to log message to the console.

* storage/AbstractDatabase.h:
* storage/ChangeVersionWrapper.cpp:
(WebCore::ChangeVersionWrapper::performPreflight):
(WebCore::ChangeVersionWrapper::performPostflight):
* storage/Database.cpp:
(WebCore::Database::openDatabase):
(WebCore::Database::openAndVerifyVersion):
(WebCore::Database::performOpenAndVerify):
* storage/Database.h:
* storage/DatabaseSync.cpp:
(WebCore::DatabaseSync::openDatabaseSync):
(WebCore::DatabaseSync::changeVersion):
(WebCore::DatabaseSync::runTransaction):
* storage/DatabaseSync.h:
(WebCore::DatabaseSync::lastErrorMessage):
(WebCore::DatabaseSync::setLastErrorMessage):
* storage/DatabaseSync.idl:
Add a lastErrorMessage attribute so javascript callers can
retrieve more detailed information about what went wrong.

* storage/DatabaseTask.cpp:
(WebCore::Database::DatabaseOpenTask::DatabaseOpenTask):
(WebCore::Database::DatabaseOpenTask::doPerformTask):
* storage/DatabaseTask.h:
(WebCore::Database::DatabaseOpenTask::create):
Return an errorMessage in addition to the exception code.

* storage/SQLError.h:
(WebCore::SQLError::create):
Add helpers to produced formatted error messages.

* storage/SQLStatement.cpp:
(WebCore::SQLStatement::execute):
* storage/SQLStatementSync.cpp:
(WebCore::SQLStatementSync::execute):
* storage/SQLTransaction.cpp:
(WebCore::SQLTransaction::openTransactionAndPreflight):
(WebCore::SQLTransaction::postflightAndCommit):
* storage/SQLTransactionSync.cpp:
(WebCore::SQLTransactionSync::executeSQL):
(WebCore::SQLTransactionSync::begin):
(WebCore::SQLTransactionSync::execute):
(WebCore::SQLTransactionSync::commit):

LayoutTests: Update layout tests for  new websql error messages and console logging.
https://bugs.webkit.org/show_bug.cgi?id=71575

Reviewed by David Levin.

* fast/workers/storage/change-version-handle-reuse-worker-expected.txt:
* fast/workers/storage/executesql-accepts-only-one-statement-sync.html:
* fast/workers/storage/executesql-accepts-only-one-statement-sync-expected.txt:
* fast/workers/storage/open-database-creation-callback-sync-expected.txt:
* fast/workers/storage/open-database-set-empty-version-sync-expected.txt:
* fast/workers/storage/test-authorizer-expected.txt:
* fast/workers/storage/transaction-in-transaction-sync.html:
* fast/workers/storage/transaction-in-transaction-sync-expected.txt:
* storage/change-version-handle-reuse-expected.txt:
* storage/open-database-creation-callback-expected.txt:
* storage/open-database-set-empty-version-expected.txt:
* storage/private-browsing-noread-nowrite-expected.txt:
* storage/test-authorizer-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@100172 268f45cc-cd09-0410-ab3c-d52691b4dbfc
32 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/workers/storage/change-version-handle-reuse-worker-expected.txt
LayoutTests/fast/workers/storage/executesql-accepts-only-one-statement-sync-expected.txt
LayoutTests/fast/workers/storage/open-database-creation-callback-sync-expected.txt
LayoutTests/fast/workers/storage/open-database-set-empty-version-sync-expected.txt
LayoutTests/fast/workers/storage/resources/executesql-accepts-only-one-statement-sync.js
LayoutTests/fast/workers/storage/resources/transaction-in-transaction-sync.js
LayoutTests/fast/workers/storage/test-authorizer-expected.txt
LayoutTests/fast/workers/storage/transaction-in-transaction-sync-expected.txt
LayoutTests/storage/change-version-handle-reuse-expected.txt
LayoutTests/storage/open-database-creation-callback-expected.txt
LayoutTests/storage/open-database-set-empty-version-expected.txt
LayoutTests/storage/private-browsing-noread-nowrite-expected.txt
LayoutTests/storage/test-authorizer-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/sql/SQLiteDatabase.cpp
Source/WebCore/platform/sql/SQLiteDatabase.h
Source/WebCore/storage/AbstractDatabase.cpp
Source/WebCore/storage/AbstractDatabase.h
Source/WebCore/storage/ChangeVersionWrapper.cpp
Source/WebCore/storage/Database.cpp
Source/WebCore/storage/Database.h
Source/WebCore/storage/DatabaseSync.cpp
Source/WebCore/storage/DatabaseSync.h
Source/WebCore/storage/DatabaseSync.idl
Source/WebCore/storage/DatabaseTask.cpp
Source/WebCore/storage/DatabaseTask.h
Source/WebCore/storage/SQLError.h
Source/WebCore/storage/SQLStatement.cpp
Source/WebCore/storage/SQLStatementSync.cpp
Source/WebCore/storage/SQLTransaction.cpp
Source/WebCore/storage/SQLTransactionSync.cpp