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 https://github.com/whatwg/fetch/pull/1144 and
https://github.com/w3c/ServiceWorker/issues/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
https://github.com/whatwg/fetch/pull/1144 and
https://github.com/w3c/ServiceWorker/issues/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 <falken@chromium.org>
Reviewed-by: Yoichi Osato <yoichio@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Auto-Submit: Yutaka Hirano <yhirano@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#857605}

--

wpt-commits: ecb2781e1fde45e5ed70019f5ac9e14dfec065d1
wpt-pr: 27756
This commit is contained in:
Yutaka Hirano 2021-03-10 21:01:00 +00:00 коммит произвёл moz-wptsync-bot
Родитель 2d12193746
Коммит 8a77724260
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -501,7 +501,7 @@ promise_test(async t => {
const echo_url = '/fetch/api/resources/echo-content.py?ignore';
const response = await frame.contentWindow.fetch(echo_url, {
method: 'POST',
body: rs
body: rs.pipeThrough(new TextEncoderStream())
});
const text = await response.text();
assert_equals(text,
@ -550,9 +550,10 @@ promise_test(async t => {
const frame = await with_iframe(page_url);
t.add_cleanup(() => { frame.remove(); });
const echo_url = '/fetch/api/resources/echo-content.py?use-and-ignore';
await promise_rejects_js(t, TypeError, frame.contentWindow.fetch(echo_url, {
const w = frame.contentWindow;
await promise_rejects_js(t, w.TypeError, w.fetch(echo_url, {
method: 'POST',
body: rs
body: rs.pipeThrough(new TextEncoderStream())
}));
}, 'FetchEvent#body is a ReadableStream, used and passed to network fallback');