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

Unified Diff: content/browser/dom_storage/session_storage_database.cc

Issue 968103002: Do not try to open DB in SessionStorageDatabase::DeleteNamespace() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comments Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/dom_storage/session_storage_database.cc
diff --git a/content/browser/dom_storage/session_storage_database.cc b/content/browser/dom_storage/session_storage_database.cc
index 6e47a1fdf1c6bfbfbc786f1371bf5fa141345bcc..3afc66923d44b1b27f8411287889a55aa13f7231 100644
--- a/content/browser/dom_storage/session_storage_database.cc
+++ b/content/browser/dom_storage/session_storage_database.cc
@@ -236,9 +236,14 @@ bool SessionStorageDatabase::DeleteArea(const std::string& namespace_id,
}
bool SessionStorageDatabase::DeleteNamespace(const std::string& namespace_id) {
- if (!LazyOpen(false)) {
- // No need to create the database if it doesn't exist.
- return true;
+ {
+ // The caller should have called other methods to open the DB before this
+ // function. Otherwise, DB stores nothing interesting related to the
+ // specified namespace.
+ // Do nothing if the DB is not open (or we know it has failed already),
+ base::AutoLock auto_lock(db_lock_);
+ if (!IsOpen() || db_error_ || is_inconsistent_)
+ return false;
}
DBOperation operation(this);
// Itereate through the areas in the namespace.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698