Re: [slightlyoff/ServiceWorker] Create a new ReadableStream in FetchEvent.respondWith (#934)

> -                            <li>Let <var>dummyStream</var> be an <a>empty</a> <a>ReadableStream</a> object.</li>
> -                            <li>Set <var>response</var>'s <a href="https://fetch.spec.whatwg.org/#concept-body-body">body</a> to a new <a>body</a> whose <a>stream</a> is <var>dummyStream</var>.</li>
> -                            <li>Let <var>reader</var> be the result of <a lt="get a reader">getting a reader</a> from <var>dummyStream</var>.</li>
> -                            <li><a>Read all bytes</a> from <var>dummyStream</var> with <var>reader</var>.</li>
> +                            <li>Let <var>reader</var> be the result of <a lt="get a reader">getting a reader</a> from <var>response</var>'s <a>body</a>'s <a>stream</a>.</li>
> +                            <li>Let <var>strategy</var> be an object. The user agent may choose any object.</li>
> +                            <li>Let <var>pull</var> be an action that runs these subsubsteps:
> +                              <ol>
> +                                <li>Let <var>promise</var> be the result of <a lt="read a chunk from a reader">reading</a> a chunk from <var>reader</var>.</li>
> +                                <li>When <var>promise</var> is fulfilled with an object whose <code>done</code> property is false and whose <code>value</code> property is a <code>Uint8Array</code> object, <a lt="enqueue a chunk to ReadableStream">enqueue</a> the result of transferring the <code>value</code> property to <var>newStream</var>.
> +                                <li>When <var>promise</var> is fulfilled with an object whose <code>done</code> property is true, <a lt="close ReadableStream">close</a> <var>newStream</var>.
> +                                <li>When <var>promise</var> is fulfilled with a value that matches with neither of the above patterns, or <var>promise</var> is rejected, <a lt="error ReadableStream">error</a> <var>newStream</var> with a <code>TypeError</code>.</li>
> +                              </ol>
> +                            </li>
> +                            <li>Let <var>cancel</var> be an action that <a lt="cancel a reader">cancels</a> <var>reader</var>.</li>
> +                            <li>Let <var>newStream</var> be the result of <a lt="construct a ReadableStream">constructing</a> a ReadableStream object with <var>strategy</var>, <var>pull</var> and <var>cancel</var>.</li>

Done.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/pull/934/files/06dd419a6b375f0a6a010323ee6c87c683290523#r73122959

Received on Tuesday, 2 August 2016 09:31:26 UTC