Skip to content

Commit 8a77724

Browse files
yutakahiranomoz-wptsync-bot
authored andcommitted
Bug 1694580 [wpt PR 27756] - Make streaming upload work with network fallback on service worker, a=testonly
Automatic update from web-platform-tests Make streaming upload work with network fallback on service worker This partially implements whatwg/fetch#1144 and w3c/ServiceWorker#1560. ServiceWorkerSubresourceLoader reuses the request body in the original request in the network fallback case (ServiceWorkerSubresourceLoader::OnFallback). This is problematic for a request with streaming upload body, because the body is not copyable. Ideally we should tee the body as specified in whatwg/fetch#1144 and w3c/ServiceWorker#1560, but this CL stops passing the body to the service worker instead to unblock the origin trial, assuming that few users care about the streaming body in the service worker. Bug: 1165690 Change-Id: Ie1d2d2fd74990b1bf7f9b10e55710a644871cc60 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2712842 Reviewed-by: Matt Falkenhagen <[email protected]> Reviewed-by: Yoichi Osato <[email protected]> Reviewed-by: Kinuko Yasuda <[email protected]> Auto-Submit: Yutaka Hirano <[email protected]> Commit-Queue: Yutaka Hirano <[email protected]> Cr-Commit-Position: refs/heads/master@{#857605} -- wpt-commits: ecb2781e1fde45e5ed70019f5ac9e14dfec065d1 wpt-pr: 27756
1 parent 2d12193 commit 8a77724

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@
501501
const echo_url = '/fetch/api/resources/echo-content.py?ignore';
502502
const response = await frame.contentWindow.fetch(echo_url, {
503503
method: 'POST',
504-
body: rs
504+
body: rs.pipeThrough(new TextEncoderStream())
505505
});
506506
const text = await response.text();
507507
assert_equals(text,
@@ -550,9 +550,10 @@
550550
const frame = await with_iframe(page_url);
551551
t.add_cleanup(() => { frame.remove(); });
552552
const echo_url = '/fetch/api/resources/echo-content.py?use-and-ignore';
553-
await promise_rejects_js(t, TypeError, frame.contentWindow.fetch(echo_url, {
553+
const w = frame.contentWindow;
554+
await promise_rejects_js(t, w.TypeError, w.fetch(echo_url, {
554555
method: 'POST',
555-
body: rs
556+
body: rs.pipeThrough(new TextEncoderStream())
556557
}));
557558
}, 'FetchEvent#body is a ReadableStream, used and passed to network fallback');
558559

0 commit comments

Comments
 (0)