Title: [239865] trunk/Source/WebCore
Revision
239865
Author
[email protected]
Date
2019-01-11 12:21:08 -0800 (Fri, 11 Jan 2019)

Log Message

IndexedDB: leak IDBTransaction, TransactionOperation and IDBRequest in layout tests
https://bugs.webkit.org/show_bug.cgi?id=193167
<rdar://problem/46891688>

Reviewed by Geoffrey Garen.

Do some cleanup to break retain cycle when context is stopped.

* Modules/indexeddb/IDBOpenDBRequest.cpp:
(WebCore::IDBOpenDBRequest::cancelForStop):
* Modules/indexeddb/IDBTransaction.cpp:
(WebCore::IDBTransaction::abortOnServerAndCancelRequests):
(WebCore::IDBTransaction::stop):
(WebCore::IDBTransaction::removeRequest):
* Modules/indexeddb/client/TransactionOperation.h:
(WebCore::IDBClient::TransactionOperation::doComplete):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (239864 => 239865)


--- trunk/Source/WebCore/ChangeLog	2019-01-11 18:28:06 UTC (rev 239864)
+++ trunk/Source/WebCore/ChangeLog	2019-01-11 20:21:08 UTC (rev 239865)
@@ -1,3 +1,22 @@
+2019-01-11  Sihui Liu  <[email protected]>
+
+        IndexedDB: leak IDBTransaction, TransactionOperation and IDBRequest in layout tests
+        https://bugs.webkit.org/show_bug.cgi?id=193167
+        <rdar://problem/46891688>
+
+        Reviewed by Geoffrey Garen.
+
+        Do some cleanup to break retain cycle when context is stopped. 
+
+        * Modules/indexeddb/IDBOpenDBRequest.cpp:
+        (WebCore::IDBOpenDBRequest::cancelForStop):
+        * Modules/indexeddb/IDBTransaction.cpp:
+        (WebCore::IDBTransaction::abortOnServerAndCancelRequests):
+        (WebCore::IDBTransaction::stop):
+        (WebCore::IDBTransaction::removeRequest):
+        * Modules/indexeddb/client/TransactionOperation.h:
+        (WebCore::IDBClient::TransactionOperation::doComplete):
+
 2019-01-11  Wenson Hsieh  <[email protected]>
 
         Introduce IDL files for runtime-enabled UndoManager and UndoItem _javascript_ API

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp (239864 => 239865)


--- trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp	2019-01-11 18:28:06 UTC (rev 239864)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp	2019-01-11 20:21:08 UTC (rev 239865)
@@ -115,6 +115,9 @@
 void IDBOpenDBRequest::cancelForStop()
 {
     connectionProxy().openDBRequestCancelled({ connectionProxy(), *this });
+
+    if (m_transaction && m_transaction->isVersionChange())
+        m_transaction->removeRequest(*this);
 }
 
 void IDBOpenDBRequest::dispatchEvent(Event& event)

Modified: trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (239864 => 239865)


--- trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2019-01-11 18:28:06 UTC (rev 239864)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2019-01-11 20:21:08 UTC (rev 239865)
@@ -297,11 +297,12 @@
     abortInProgressOperations(error);
 
     for (auto& operation : m_abortQueue) {
-        m_currentlyCompletingRequest = nullptr;
         m_transactionOperationsInProgressQueue.append(operation.get());
         operation->doComplete(IDBResultData::error(operation->identifier(), error));
+        m_currentlyCompletingRequest = nullptr;
     }
 
+    m_abortQueue.clear();
     // Since we're aborting, it should be impossible to have queued any further operations.
     ASSERT(m_pendingTransactionOperationQueue.isEmpty());
 }
@@ -338,6 +339,9 @@
 
     m_contextStopped = true;
 
+    if (isVersionChange())
+        m_openDBRequest = nullptr;
+
     if (isFinishedOrFinishing())
         return;
 
@@ -368,7 +372,6 @@
 void IDBTransaction::removeRequest(IDBRequest& request)
 {
     ASSERT(&m_database->originThread() == &Thread::current());
-    ASSERT(m_openRequests.contains(&request));
     m_openRequests.remove(&request);
 }
 

Modified: trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (239864 => 239865)


--- trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	2019-01-11 18:28:06 UTC (rev 239864)
+++ trunk/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	2019-01-11 20:21:08 UTC (rev 239865)
@@ -98,6 +98,8 @@
         // so we need to do this trick to null it out without first destroying it.
         WTF::Function<void (const IDBResultData&)> oldCompleteFunction;
         std::swap(m_completeFunction, oldCompleteFunction);
+
+        m_performFunction = { };
     }
 
     const IDBResourceIdentifier& identifier() const { return m_identifier; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to