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

Unified Diff: Source/modules/indexeddb/IDBTransaction.cpp

Issue 138473004: IndexedDB: Prevent terminated worker from hanging connections (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reword comment Created 6 years, 11 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 | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | Source/modules/indexeddb/IDBTransactionTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/indexeddb/IDBTransaction.cpp
diff --git a/Source/modules/indexeddb/IDBTransaction.cpp b/Source/modules/indexeddb/IDBTransaction.cpp
index ef349c9005688750266ee7feb83d197089c21a50..d2acb3cd55055059423ee661cfec811a92f10ff1 100644
--- a/Source/modules/indexeddb/IDBTransaction.cpp
+++ b/Source/modules/indexeddb/IDBTransaction.cpp
@@ -196,12 +196,13 @@ void IDBTransaction::abort(ExceptionState& exceptionState)
m_state = Finishing;
- if (!m_contextStopped) {
- while (!m_requestList.isEmpty()) {
- RefPtr<IDBRequest> request = *m_requestList.begin();
- m_requestList.remove(request);
- request->abort();
- }
+ if (m_contextStopped)
+ return;
+
+ while (!m_requestList.isEmpty()) {
+ RefPtr<IDBRequest> request = *m_requestList.begin();
+ m_requestList.remove(request);
+ request->abort();
}
RefPtr<IDBTransaction> selfRef = this;
@@ -225,6 +226,12 @@ void IDBTransaction::unregisterRequest(IDBRequest* request)
void IDBTransaction::onAbort(PassRefPtr<DOMError> prpError)
{
IDB_TRACE("IDBTransaction::onAbort");
+ if (m_contextStopped) {
+ RefPtr<IDBTransaction> protect(this);
+ m_database->transactionFinished(this);
+ return;
+ }
+
RefPtr<DOMError> error = prpError;
ASSERT(m_state != Finished);
@@ -261,6 +268,12 @@ void IDBTransaction::onAbort(PassRefPtr<DOMError> prpError)
void IDBTransaction::onComplete()
{
IDB_TRACE("IDBTransaction::onComplete");
+ if (m_contextStopped) {
+ RefPtr<IDBTransaction> protect(this);
+ m_database->transactionFinished(this);
+ return;
+ }
+
ASSERT(m_state != Finished);
m_state = Finishing;
m_objectStoreCleanupMap.clear();
« no previous file with comments | « Source/modules/indexeddb/IDBDatabase.cpp ('k') | Source/modules/indexeddb/IDBTransactionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698