Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3830822c935e6fa0e851781b1cf7def6d3f66f66
      
https://github.com/WebKit/WebKit/commit/3830822c935e6fa0e851781b1cf7def6d3f66f66
  Author: Youenn Fablet <you...@apple.com>
  Date:   2024-06-21 (Fri, 21 Jun 2024)

  Changed paths:
    A 
LayoutTests/http/wpt/service-workers/navigation-fetch-worker-terminate-worker.js
    A 
LayoutTests/http/wpt/service-workers/navigation-fetch-worker-terminate.https-expected.txt
    A 
LayoutTests/http/wpt/service-workers/navigation-fetch-worker-terminate.https.html
    M Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp
    M Source/WebCore/workers/service/context/SWContextManager.cpp
    M Source/WebCore/workers/service/context/SWContextManager.h
    M Source/WebCore/workers/service/context/ServiceWorkerFetch.h
    M Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp
    M Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h
    M 
Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in
    M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
    M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
    M Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp
    M Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h

  Log Message:
  -----------
  Navigation loads that go through a service worker should finish in case of 
service worker termination
rdar://130079675
https://bugs.webkit.org/show_bug.cgi?id=275613

Reviewed by Chris Dumez.

We now store navigation fetch tasks in WebSWContextManagerConnection.
This allows to directly ask them to continueDidReceiveFetchResponse or 
convertFetchToDownload without hopping to the worker thread.
This is useful as the worker thread may be dead by the time we hop to it, which 
will prevent the load to finish or fail.

Since we are now calling continueDidReceiveFetchResponse or 
convertFetchToDownload from WebSWContextManagerConnection queue, we add a 
connection lock to WebServiceWorkerFetchTaskClient.

When a service worker gets stopped, we are now explicitly cancelling the 
ongoing fetch tasks by calling 
WebServiceWorkerFetchTaskClient::contextIsStopping.
It will cancel the load except if the load is already terminated but waiting to 
proceed (which happens for navigation loads waiting for a response check).

* 
LayoutTests/http/wpt/service-workers/navigation-fetch-worker-terminate-worker.js:
 Added.
(doTest):
* 
LayoutTests/http/wpt/service-workers/navigation-fetch-worker-terminate.https-expected.txt:
 Added.
* 
LayoutTests/http/wpt/service-workers/navigation-fetch-worker-terminate.https.html:
 Added.
* Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::prepareForDestruction):
* Source/WebCore/workers/service/context/SWContextManager.cpp:
(WebCore::SWContextManager::removeFetch):
* Source/WebCore/workers/service/context/SWContextManager.h:
* Source/WebCore/workers/service/context/ServiceWorkerFetch.h:
* Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::cancelFetch):
(WebCore::ServiceWorkerThreadProxy::convertFetchToDownload): Deleted.
(WebCore::ServiceWorkerThreadProxy::continueDidReceiveFetchResponse): Deleted.
* Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h:
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in:
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::cancelFetch):
(WebKit::WebSWContextManagerConnection::continueDidReceiveFetchResponse):
(WebKit::WebSWContextManagerConnection::startFetch):
(WebKit::WebSWContextManagerConnection::convertFetchToDownload):
(WebKit::WebSWContextManagerConnection::removeNavigationFetch):
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h:
* Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveRedirection):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveResponse):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveDataInternal):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinish):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveFormDataAndFinishInternal):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
(WebKit::WebServiceWorkerFetchTaskClient::didFail):
(WebKit::WebServiceWorkerFetchTaskClient::didFailInternal):
(WebKit::WebServiceWorkerFetchTaskClient::didFinish):
(WebKit::WebServiceWorkerFetchTaskClient::didFinishInternal):
(WebKit::WebServiceWorkerFetchTaskClient::didNotHandle):
(WebKit::WebServiceWorkerFetchTaskClient::didNotHandleInternal):
(WebKit::WebServiceWorkerFetchTaskClient::cancel):
(WebKit::WebServiceWorkerFetchTaskClient::usePreload):
(WebKit::WebServiceWorkerFetchTaskClient::continueDidReceiveResponse):
(WebKit::WebServiceWorkerFetchTaskClient::cleanup):
(WebKit::WebServiceWorkerFetchTaskClient::contextIsStopping):
* Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.h:

Canonical link: https://commits.webkit.org/280246@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to