summaryrefslogtreecommitdiffstats
path: root/content/browser/indexed_db/indexed_db_connection.cc
diff options
context:
space:
mode:
authorjsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 22:24:46 +0000
committerjsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 22:24:46 +0000
commit1c0f122770b70c32c4f717134cc94b3dafed2012 (patch)
tree4a33abd3b59ca3ce58e92beb7c44ebb89dd4cb7a /content/browser/indexed_db/indexed_db_connection.cc
parent64766d7f183fe39fabfb2c8190d127e4ea6bcf58 (diff)
downloadchromium_src-1c0f122770b70c32c4f717134cc94b3dafed2012.zip
chromium_src-1c0f122770b70c32c4f717134cc94b3dafed2012.tar.gz
chromium_src-1c0f122770b70c32c4f717134cc94b3dafed2012.tar.bz2
IndexedDB: Ensure that closed connections are not used
Once a database connection object is closed it doesn't need to hold a database reference. This can be used to detect the case where a request arrives from a renderer after a connection is forcibly closed by the back end, and drop the request. In most cases the request would be associated with a transaction that would have been aborted/removed from the database's list and hence the request would just be dropped. The CreateTransaction() and Close() requests aren't, so they need this check. In the other cases this will just exit earlier and let the database object be released. BUG=308699 Review URL: https://codereview.chromium.org/26454005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229627 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/indexed_db/indexed_db_connection.cc')
-rw-r--r--content/browser/indexed_db/indexed_db_connection.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/content/browser/indexed_db/indexed_db_connection.cc b/content/browser/indexed_db/indexed_db_connection.cc
index ba84e05..51a6f1f 100644
--- a/content/browser/indexed_db/indexed_db_connection.cc
+++ b/content/browser/indexed_db/indexed_db_connection.cc
@@ -17,6 +17,7 @@ void IndexedDBConnection::Close() {
if (!callbacks_)
return;
database_->Close(this, false /* forced */);
+ database_ = NULL;
callbacks_ = NULL;
}
@@ -24,8 +25,13 @@ void IndexedDBConnection::ForceClose() {
if (!callbacks_)
return;
database_->Close(this, true /* forced */);
+ database_ = NULL;
callbacks_->OnForcedClose();
callbacks_ = NULL;
}
+bool IndexedDBConnection::IsConnected() {
+ return database_.get() != NULL;
+}
+
} // namespace WebKit