Skip to content

Tee request body on ServiceWorker interception #1144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 18, 2021

Conversation

yutakahirano
Copy link
Member

@yutakahirano yutakahirano commented Jan 22, 2021

(See WHATWG Working Mode: Changes for more details.)

Fixes w3c/ServiceWorker#1560, fixes #572.


Preview | Diff

@yutakahirano yutakahirano changed the title Fail request when streaming request body is used in ServiceWorker Fail request when its streaming body is used in ServiceWorker Jan 22, 2021
@yutakahirano
Copy link
Member Author

@annevk @yoichio PTAL

@annevk
Copy link
Member

annevk commented Jan 22, 2021

So what's the idea for non-streaming bodies that end up consumed by the service worker? It seems you decided to not clone the request for those scenarios?

@yutakahirano
Copy link
Member Author

Sorry you're right. The latest PR includes an explicit copy step.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good I think, but unlike https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch we do not copy request here. Is request's body the only thing the service worker can affect? Is the headers list immutable? (I'm not saying this needs to change, but I'd like to ensure we have the right setup here.)

I'd also appreciate review from @wanderview and @jakearchibald.

@yutakahirano
Copy link
Member Author

This looks good I think, but unlike https://fetch.spec.whatwg.org/#concept-http-network-or-cache-fetch we do not copy request here. Is request's body the only thing the service worker can affect? Is the headers list immutable? (I'm not saying this needs to change, but I'd like to ensure we have the right setup here.)

The latest PR creates a copy of a request.

@annevk
Copy link
Member

annevk commented Jan 28, 2021

Could you explain why you make a copy?

@yutakahirano
Copy link
Member Author

To make it clear that request mutation in service worker doesn't affect the network network.

@annevk
Copy link
Member

annevk commented Jan 28, 2021

Yeah I was wondering if that was possible, but looking at https://w3c.github.io/ServiceWorker/#on-fetch-request-algorithm Headers should be immutable so I don't think we need it.

@yutakahirano
Copy link
Member Author

Reverted the change partially.

Copy link
Collaborator

@jakearchibald jakearchibald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but it isn't clear to me why the body is copied

fetch.bs Outdated
<a for=/>body</a>.

<li>
<p>Let <var>savedBody</var> be a copy of <var>request</var>'s <a for=request>body</a>.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of copying the body at this point?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When calling clone() in the service worker it modifies reuqests.body. So we want to keep the original body.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Might be worth putting that in a note?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand. If you clone a request it uses https://fetch.spec.whatwg.org/#concept-body-clone to clone its body, right? This updates body's stream to a non-null value but its source remains the same. Couldn't we always extract from source again?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point I'm trying to make is that it overwrites the request's body's stream and that means request will not be disturbed nor locked. I'd like to fail the request in such a case too (if other conditions are met). This corresponds to "clone-and-ignore" tests in web-platform-tests/wpt#27325.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we tee the request body before passing it to the service worker (it is hard to implement TBH - I think we will not be able to implement it in the first release), I would like to allow reading the body in the network fallback case. I'm uncomfortable with having magic in the clone operation, and that is more important to me than enforcing the "read once" rule. @annevk, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we check if request's body's source is null and request's body's stream is disturbed or locked before we want to return null?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do yo prefer global "read once" rule to a stream body?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To give web developers an API that's as consistent as possible and also give implementations freedom to experiment with various memory optimization techniques.

Copy link
Member Author

@yutakahirano yutakahirano Feb 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, now it clones the original request. I'm going to fix w3c/ServiceWorker#1563.

@yutakahirano yutakahirano force-pushed the yhirano/streaming-upload-sw branch from 847abbc to 1705760 Compare February 16, 2021 11:17
@annevk
Copy link
Member

annevk commented Feb 16, 2021

@yutakahirano I don't see the closing of these streams as @jakearchibald suggested. Don't we need to do that? I guess it's not strictly speaking observable, but it seems somewhat bad to have a leak.

I like how this ended up being a lot simpler than some of the earlier approaches.

@yutakahirano
Copy link
Member Author

I added a cancel step at in w3c/ServiceWorker#1563.

@annevk
Copy link
Member

annevk commented Feb 16, 2021

Shouldn't we close request here as well if we got a response back? We might also want to explain in a note what the setup is here.

@yutakahirano
Copy link
Member Author

Shouldn't we close request here as well if we got a response back?

That is #572, I think (and yes, I think we should cancel it instead of transmitting).

@annevk
Copy link
Member

annevk commented Feb 16, 2021

Yeah, I'm thinking that we should fix #572 as you suggested after all. In that only the network layer attempts to transmit chunks.

@annevk annevk deleted the yhirano/streaming-upload-sw branch February 18, 2021 13:40
jakearchibald pushed a commit to w3c/ServiceWorker that referenced this pull request Feb 18, 2021
@yutakahirano
Copy link
Member Author

Thank you!

yutakahirano added a commit to web-platform-tests/wpt that referenced this pull request Feb 18, 2021
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 24, 2021
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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 24, 2021
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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 24, 2021
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
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Feb 24, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <[email protected]>
Co-authored-by: Anne van Kesteren <[email protected]>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Feb 25, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: fc2a98935821f5df9bf73b8642ff68ab95e1ea17
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Feb 25, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: fc2a98935821f5df9bf73b8642ff68ab95e1ea17
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Feb 25, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: fc2a98935821f5df9bf73b8642ff68ab95e1ea17
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 25, 2021
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
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 25, 2021
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}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 25, 2021
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}
blueboxd pushed a commit to blueboxd/chromium-legacy that referenced this pull request Feb 25, 2021
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}
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 5, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <[email protected]>
Co-authored-by: Anne van Kesteren <[email protected]>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 8, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <[email protected]>
Co-authored-by: Anne van Kesteren <[email protected]>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Mar 8, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <[email protected]>
Co-authored-by: Anne van Kesteren <[email protected]>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 10, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: 2472b38eb2f886421d5a062314a87dc33029a393
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 10, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: 02b382fb279e8edb2435787d95fd519f036320b3
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 10, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: 2472b38eb2f886421d5a062314a87dc33029a393
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 10, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: 02b382fb279e8edb2435787d95fd519f036320b3
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 10, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: 2472b38eb2f886421d5a062314a87dc33029a393
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 10, 2021
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <yhiranochrmomium.org>
Co-authored-by: Anne van Kesteren <annevkannevk.nl>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325

UltraBlame original commit: 02b382fb279e8edb2435787d95fd519f036320b3
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Mar 15, 2021
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Mar 15, 2021
…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 <falkenchromium.org>
Reviewed-by: Yoichi Osato <yoichiochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Auto-Submit: Yutaka Hirano <yhiranochromium.org>
Commit-Queue: Yutaka Hirano <yhiranochromium.org>
Cr-Commit-Position: refs/heads/master{#857605}

--

wpt-commits: ecb2781e1fde45e5ed70019f5ac9e14dfec065d1
wpt-pr: 27756

UltraBlame original commit: 4bd27f41c457d02f5cd92bc5fae91f98f8149b3d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Mar 15, 2021
…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 <falkenchromium.org>
Reviewed-by: Yoichi Osato <yoichiochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Auto-Submit: Yutaka Hirano <yhiranochromium.org>
Commit-Queue: Yutaka Hirano <yhiranochromium.org>
Cr-Commit-Position: refs/heads/master{#857605}

--

wpt-commits: ecb2781e1fde45e5ed70019f5ac9e14dfec065d1
wpt-pr: 27756

UltraBlame original commit: 4bd27f41c457d02f5cd92bc5fae91f98f8149b3d
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Mar 15, 2021
…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 <falkenchromium.org>
Reviewed-by: Yoichi Osato <yoichiochromium.org>
Reviewed-by: Kinuko Yasuda <kinukochromium.org>
Auto-Submit: Yutaka Hirano <yhiranochromium.org>
Commit-Queue: Yutaka Hirano <yhiranochromium.org>
Cr-Commit-Position: refs/heads/master{#857605}

--

wpt-commits: ecb2781e1fde45e5ed70019f5ac9e14dfec065d1
wpt-pr: 27756

UltraBlame original commit: 4bd27f41c457d02f5cd92bc5fae91f98f8149b3d
bhearsum pushed a commit to mozilla-releng/staging-firefox that referenced this pull request May 1, 2025
…before network fallback, a=testonly

Automatic update from web-platform-tests
Test cases where request body gets used before network fallback (#27325)

Tests for whatwg/fetch#1144 and w3c/ServiceWorker#1563.

Co-authored-by: Yutaka Hirano <[email protected]>
Co-authored-by: Anne van Kesteren <[email protected]>
--

wpt-commits: c30545df6a50c61f3673ed952c78c0a607100d45
wpt-pr: 27325
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
6 participants