ServiceWorkerContainer is leaking due to a ref cycle
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2019 20:51:19 +0000 (20:51 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Jan 2019 20:51:19 +0000 (20:51 +0000)
commit4d096763335bb89dee44b5cbab9e8b6aa09601af
tree3c11d120c4f6fe9880457e14f61651342918c4c8
parent669410d4e2e03fd2f399aaabfa7e12c9ea47e5d2
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240049 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/workers/service/ServiceWorkerContainer.cpp