Skip to content
Permalink
Browse files
ServiceWorkerNavigationPreloader::didComplete should make sure to cal…
…l its bodyCallback

https://bugs.webkit.org/show_bug.cgi?id=234884

Reviewed by Alex Christensen.

Covered by existing tests.

* NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.cpp:
Call to responseCallback may destroy the ServiceWorkerNavigationPreloader.
To make sure to call its bodyCallback, we move it in the stack before calling responseCallback.



Canonical link: https://commits.webkit.org/245773@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
youennf committed Jan 6, 2022
1 parent 8495e27 commit 034627ead2b55f6c9fa8f1fdc8d585d78b3a6ae2
Showing 2 changed files with 21 additions and 4 deletions.
@@ -1,3 +1,16 @@
2022-01-06 Youenn Fablet <youenn@apple.com>

ServiceWorkerNavigationPreloader::didComplete should make sure to call its bodyCallback
https://bugs.webkit.org/show_bug.cgi?id=234884

Reviewed by Alex Christensen.

Covered by existing tests.

* NetworkProcess/ServiceWorker/ServiceWorkerNavigationPreloader.cpp:
Call to responseCallback may destroy the ServiceWorkerNavigationPreloader.
To make sure to call its bodyCallback, we move it in the stack before calling responseCallback.

2021-10-30 Myles C. Maxfield <mmaxfield@apple.com>

[GPU Process] Small ImageBuffers cause the web process to crash
@@ -201,11 +201,15 @@ void ServiceWorkerNavigationPreloader::didComplete()
{
m_networkLoad = nullptr;

if (auto callback = std::exchange(m_responseCallback, { }))
callback();
auto responseCallback = std::exchange(m_responseCallback, { });
auto bodyCallback = std::exchange(m_bodyCallback, { });

if (m_bodyCallback)
m_bodyCallback({ }, 0);
// After calling responseCallback or bodyCallback, |this| might be destroyed.
if (responseCallback)
responseCallback();

if (bodyCallback)
bodyCallback({ }, 0);
}

void ServiceWorkerNavigationPreloader::waitForResponse(ResponseCallback&& callback)

0 comments on commit 034627e

Please sign in to comment.