Title: [240067] branches/safari-607-branch/Source/WebCore
Revision
240067
Author
[email protected]
Date
2019-01-16 15:27:31 -0800 (Wed, 16 Jan 2019)

Log Message

Cherry-pick r239865. rdar://problem/47260332

    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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239865 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (240066 => 240067)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-16 23:27:28 UTC (rev 240066)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-01-16 23:27:31 UTC (rev 240067)
@@ -1,5 +1,48 @@
 2019-01-15  Alan Coon  <[email protected]>
 
+        Cherry-pick r239865. rdar://problem/47260332
+
+    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):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239865 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-15  Alan Coon  <[email protected]>
+
         Cherry-pick r239857. rdar://problem/47260358
 
     <video> elements do not enter 'paused' state when playing to end over AirPlay

Modified: branches/safari-607-branch/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp (240066 => 240067)


--- branches/safari-607-branch/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp	2019-01-16 23:27:28 UTC (rev 240066)
+++ branches/safari-607-branch/Source/WebCore/Modules/indexeddb/IDBOpenDBRequest.cpp	2019-01-16 23:27:31 UTC (rev 240067)
@@ -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: branches/safari-607-branch/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp (240066 => 240067)


--- branches/safari-607-branch/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2019-01-16 23:27:28 UTC (rev 240066)
+++ branches/safari-607-branch/Source/WebCore/Modules/indexeddb/IDBTransaction.cpp	2019-01-16 23:27:31 UTC (rev 240067)
@@ -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: branches/safari-607-branch/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h (240066 => 240067)


--- branches/safari-607-branch/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	2019-01-16 23:27:28 UTC (rev 240066)
+++ branches/safari-607-branch/Source/WebCore/Modules/indexeddb/client/TransactionOperation.h	2019-01-16 23:27:31 UTC (rev 240067)
@@ -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