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

Unified Diff: webkit/database/database_tracker.cc

Issue 9371008: Nuke from orbit corrupt websql databases. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 | « webkit/database/database_tracker.h ('k') | webkit/database/database_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/database/database_tracker.cc
===================================================================
--- webkit/database/database_tracker.cc (revision 122554)
+++ webkit/database/database_tracker.cc (working copy)
@@ -19,6 +19,7 @@
#include "sql/diagnostic_error_delegate.h"
#include "sql/meta_table.h"
#include "sql/transaction.h"
+#include "third_party/sqlite/sqlite3.h"
#include "webkit/database/database_quota_client.h"
#include "webkit/database/database_util.h"
#include "webkit/database/databases_table.h"
@@ -179,6 +180,24 @@
DeleteDatabaseIfNeeded(origin_identifier, database_name);
}
+void DatabaseTracker::HandleSqliteError(
+ const string16& origin_identifier,
+ const string16& database_name,
+ int error) {
+ // We only handle errors that indicate corruption and we
+ // do so with a heavy hand, we delete it. Any renderers/workers
+ // with this database open will receive a message to close it
+ // immediately, once all have closed, the files will be deleted.
+ // In the interim, all attempts to open a new connection to that
+ // database will fail.
+ // Note: the client-side filters out all but these two errors as
+ // a small optimization, see WebDatabaseObserverImpl::HandleSqliteError.
+ if (error == SQLITE_CORRUPT || error == SQLITE_NOTADB) {
+ DeleteDatabase(origin_identifier, database_name,
+ net::CompletionCallback());
+ }
+}
+
void DatabaseTracker::CloseDatabases(const DatabaseConnections& connections) {
if (database_connections_.IsEmpty()) {
DCHECK(!is_initialized_ || connections.IsEmpty());
« no previous file with comments | « webkit/database/database_tracker.h ('k') | webkit/database/database_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698