Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e4afe2dda27977d441e69736fd7b6d356ef41fb4
https://github.com/WebKit/WebKit/commit/e4afe2dda27977d441e69736fd7b6d356ef41fb4
Author: Youenn Fablet <[email protected]>
Date: 2026-07-27 (Mon, 27 Jul 2026)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.h2-expected.txt
M
LayoutTests/platform/glib/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.h2-expected.txt
M Source/WebCore/Modules/fetch/FetchResponse.h
M Source/WebCore/Modules/fetch/FormDataConsumer.cpp
M Source/WebCore/Modules/fetch/FormDataConsumer.h
M Source/WebCore/platform/network/PendingStreamState.cpp
M Source/WebCore/platform/network/PendingStreamState.h
M Source/WebCore/workers/service/context/SWContextManager.h
M Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp
M Source/WebKit/NetworkProcess/NetworkResourceLoader.h
M Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp
M Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h
M
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp
M
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h
M
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in
M Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in
M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h
M Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in
Log Message:
-----------
Service workers should be able to get stream upload data
rdar://183108477
https://bugs.webkit.org/show_bug.cgi?id=320171
Reviewed by Alex Christensen.
When a fetch handler reads event.request.body, the request may carry a pending
upload stream that only exists on the initiating WebProcess.
We wire the service worker WebProcess to pull the body from the network process
on demand.
On the SW WebProcess side, WebSWContextManagerConnection::startFetch attaches a
fresh PendingStreamState to the request body when it carries a pending stream
identifier, tagged with the FetchIdentifier.
When the SW reads the request body, FormDataConsumer routes the
PendingStreamData element to consumePendingStream.
This installs a data-available handler and asks the network process (via
SWContextManager::Connection::startPendingStreamUploadForwarding) to start
forwarding.
On the network process side, WebSWServerToContextConnection looks up the
corresponding NetworkResourceLoader's PendingStreamState.
It keeps it alive in its own FetchIdentifier-keyed map, and installs a handler
that drains chunks over IPC.
FormDataConsumer::cancel notifies the network process via
cancelPendingStreamUploadForwarding so the NP-side handler tears down and the
map entry is removed if the SW gives up before EOF.
Covered by existing tests.
*
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.h2-expected.txt:
* Source/WebCore/Modules/fetch/FetchResponse.h:
* Source/WebCore/Modules/fetch/FormDataConsumer.cpp:
(WebCore::FormDataConsumer::FormDataConsumer):
(WebCore::FormDataConsumer::~FormDataConsumer):
(WebCore::FormDataConsumer::read):
(WebCore::FormDataConsumer::consumePendingStream):
(WebCore::FormDataConsumer::drainPendingStream):
(WebCore::FormDataConsumer::cancel):
* Source/WebCore/Modules/fetch/FormDataConsumer.h:
(WebCore::FormDataConsumer::hasPendingActivity const):
* Source/WebCore/platform/network/PendingStreamState.cpp:
(WebCore::PendingStreamState::setDataAvailableHandler):
* Source/WebCore/platform/network/PendingStreamState.h:
(WebCore::PendingStreamState::setServiceWorkerFetchIdentifier):
(WebCore::PendingStreamState::serviceWorkerFetchIdentifier const):
* Source/WebCore/workers/service/context/SWContextManager.h:
* Source/WebCore/workers/service/context/ServiceWorkerFetch.cpp:
(WebCore::ServiceWorkerFetch::dispatchFetchEvent):
* Source/WebKit/NetworkProcess/NetworkResourceLoader.h:
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::loader const):
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
* Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.cpp:
(WebKit::WebSWServerToContextConnection::startPendingStreamUploadForwarding):
(WebKit::WebSWServerToContextConnection::pendingStreamDataAvailable):
(WebKit::WebSWServerToContextConnection::cancelPendingStreamUploadForwarding):
* Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.h:
*
Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerToContextConnection.messages.in:
* Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in:
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp:
(WebKit::WebSWContextManagerConnection::startFetch):
(WebKit::WebSWContextManagerConnection::startPendingStreamUploadForwarding):
(WebKit::WebSWContextManagerConnection::cancelPendingStreamUploadForwarding):
(WebKit::WebSWContextManagerConnection::forwardPendingStreamUploadData):
(WebKit::WebSWContextManagerConnection::forwardPendingStreamUploadEnd):
(WebKit::WebSWContextManagerConnection::forwardPendingStreamUploadError):
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.h:
* Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.messages.in:
*
LayoutTests/platform/glib/imported/w3c/web-platform-tests/service-workers/service-worker/fetch-event.https.h2-expected.txt:
Canonical link: https://commits.webkit.org/317964@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications