Skip to content

Create a new ReadableStream in FetchEvent.respondWith#934

Merged
jungkees merged 1 commit intow3c:masterfrom
yutakahirano:transfer-stream
Aug 3, 2016
Merged

Create a new ReadableStream in FetchEvent.respondWith#934
jungkees merged 1 commit intow3c:masterfrom
yutakahirano:transfer-stream

Conversation

@yutakahirano
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@jungkees
Copy link
Copy Markdown
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
Copy Markdown
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

Comment thread spec/service_worker/index.bs Outdated
<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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@domenic
Copy link
Copy Markdown
Contributor

domenic commented Aug 2, 2016

LGTM

@yutakahirano
Copy link
Copy Markdown
Contributor Author

Thanks, fixed ForeignFetch.respondWith.

Comment thread spec/service_worker/index.bs Outdated
<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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

Thanks, I addressed comments, rebased and squashed commits.

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