Title: [240049] trunk/Source/WebCore
Revision
240049
Author
you...@apple.com
Date
2019-01-16 12:51:19 -0800 (Wed, 16 Jan 2019)

Log Message

ServiceWorkerContainer is leaking due to a ref cycle
https://bugs.webkit.org/show_bug.cgi?id=193462
<rdar://problem/47026303>

Reviewed by Brady Eidson.

ServiceWorkerContainer keeps a reference to its ready promise.
The ready promise keeps a ref to its value which is a ServiceWorkerRegistration.
ServiceWorkerRegistration keeps a ref to ServiceWorkerContainer.

To break the reference cycle, set the ready promise to zero when ServiceWorkerContainer is stopped.

Covered by imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html no longer leaking.

* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::stop):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (240048 => 240049)


--- trunk/Source/WebCore/ChangeLog	2019-01-16 20:48:48 UTC (rev 240048)
+++ trunk/Source/WebCore/ChangeLog	2019-01-16 20:51:19 UTC (rev 240049)
@@ -1,3 +1,22 @@
+2019-01-16  Youenn Fablet  <you...@apple.com>
+
+        ServiceWorkerContainer is leaking due to a ref cycle
+        https://bugs.webkit.org/show_bug.cgi?id=193462
+        <rdar://problem/47026303>
+
+        Reviewed by Brady Eidson.
+
+        ServiceWorkerContainer keeps a reference to its ready promise.
+        The ready promise keeps a ref to its value which is a ServiceWorkerRegistration.
+        ServiceWorkerRegistration keeps a ref to ServiceWorkerContainer.
+
+        To break the reference cycle, set the ready promise to zero when ServiceWorkerContainer is stopped.
+
+        Covered by imported/w3c/web-platform-tests/service-workers/service-worker/ready.https.html no longer leaking.
+
+        * workers/service/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::stop):
+
 2019-01-15  Simon Fraser  <simon.fra...@apple.com>
 
         Make didCommitChangesForLayer() explicitly about the platform layer changing because of tile/non-tile swapping

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (240048 => 240049)


--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2019-01-16 20:48:48 UTC (rev 240048)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp	2019-01-16 20:51:19 UTC (rev 240049)
@@ -632,6 +632,7 @@
     m_isStopped = true;
     removeAllEventListeners();
     m_pendingPromises.clear();
+    m_readyPromise = nullptr;
     for (auto& job : m_jobMap.values())
         job->cancelPendingLoad();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to