Skip to content
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

Create a new ReadableStream in FetchEvent.respondWith #934

Merged
merged 1 commit into from
Aug 3, 2016

Conversation

yutakahirano
Copy link
Contributor

The current description pretends that a ReadableStream can be passed from one realm to another, which is wrong. This change changes the description so that it creates a new ReadableStream and passes Uint8Array objects from the old ReadableStream to the new one.

This is discussed at whatwg/fetch#330. This change fixes #850 as well.

@yutakahirano
Copy link
Contributor Author

I'm sorry that I'm not accustomed to edit this spec. What should I do for service_worker_1/index.bs?

@yutakahirano
Copy link
Contributor Author

TODO: Define concept-read-chunk-from-reader and concept-cancel-stream-reader in the fetch spec.

@jungkees
Copy link
Collaborator

Thanks for working on this PR.

What should I do for service_worker_1/index.bs?

Don't worry about V1. Please just work on Nightly. If a backport is needed for V1, I'll cover it.

@@ -1784,14 +1790,22 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
<li>Let <var>potentialResponse</var> be a copy of <var>response</var>'s associated <a href="https://fetch.spec.whatwg.org/#concept-response-response">response</a>, except for its body.</li>
<li>If <var>response</var>'s body is non-null, run these substeps:
Copy link
Contributor

Choose a reason for hiding this comment

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

While here it might be good to make "body" link to https://fetch.spec.whatwg.org/#concept-response-body

<li>Let <var>bytes</var> be an empty byte sequence.
<li>Let <var>end-of-body</var> be false.
<li>Let <var>done</var> be false.
<li>Let <var>targetRealm</var> be the <a>relevant Realm</a> of this <code>FetchEvent</code>.
Copy link
Contributor

@domenic domenic Aug 2, 2016

Choose a reason for hiding this comment

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

This needs to be saved before you go "in parallel". Also the link doesn't seem to be working; not sure why.

Copy link
Contributor

Choose a reason for hiding this comment

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

Use {{FetchEvent}} to get autolinking.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@yutakahirano
Copy link
Contributor Author

(I will fix ForeignFetchEvent.respondWith after FetchEvent.respondWith looks good.)

@domenic
Copy link
Contributor

domenic commented Aug 2, 2016

LGTM

@yutakahirano
Copy link
Contributor Author

Thanks, fixed ForeignFetch.respondWith.

@@ -1762,6 +1770,7 @@ spec: webidl; urlPrefix: https://heycam.github.io/webidl/
<li>Set the <a>stop propagation flag</a> and <a>stop immediate propagation flag</a>.</li>
<li>Set the <a href="#respond-with-entered-flag">respond-with entered flag</a>.</li>
<li>Set the <a href="#wait-to-respond-flag">wait to respond flag</a>.</li>
<li>Let <var>targetRealm</var> be the <a>relevant Realm</a> of this {{FetchEvent}}.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you please use "the context object" instead of "this {{FetchEvent}}" for consistency in this spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@jungkees
Copy link
Collaborator

jungkees commented Aug 3, 2016

LGTM with the above nits and a rebase: we removed ServiceWorkerContainer.onerror in c240d9d. This patch is missing in this PR. Also, should I wait until your other PR to fetch gets landed? Or just merge this PR first?

@yutakahirano yutakahirano force-pushed the transfer-stream branch 4 times, most recently from df3f571 to 94c481a Compare August 3, 2016 05:48
@yutakahirano
Copy link
Contributor Author

Thanks, I addressed comments, rebased and squashed commits.

The current description pretends that a ReadableStream can be passed from one
realm to another, which is wrong. This change changes the description so that
it creates a new ReadableStream and passes Uint8Array objects from the old
ReadableStream to the new one.

This is discussed at whatwg/fetch#330. This change fixes w3c#850 as well.
@jungkees jungkees merged commit c52c6d1 into w3c:master Aug 3, 2016
yutakahirano added a commit to whatwg/fetch that referenced this pull request Aug 10, 2016
This change adds some ReadableStream operations that are used in
w3c/ServiceWorker#934.
@yutakahirano yutakahirano deleted the transfer-stream branch February 8, 2021 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FetchEvent.respondWith does something weird with the body of a response
3 participants