Re: [whatwg/fetch] Formalize reading bodies (#1172)

@domenic commented on this pull request.



> +<p>To <dfn export for=body>fully read</dfn> a <a for=/>body</a> <var>body</var>, given an algorithm
+<dfn export for="body/fully read"><var>processBody</var></dfn>, an optional algorithm
+<dfn export for="body/fully read"><var>processError</var></dfn>, and an optional null or
+<a for=/>global object</a> <dfn export for="body/fully read">taskDestination</dfn> (default null),
+run these steps:
+
+<ol>
+ <li><p>If <var>taskDestination</var> is null, then set <var>taskDestination</var> to the result of
+ <a>starting a new parallel queue</a>.
+
+ <li><p>Let <var>promise</var> be the result of <a>fully reading body as promise</a> given
+ <var>body</var>.
+
+ <li><p>Let <var>fulfilledSteps</var> given a <a>byte sequence</a> <var>bytes</var> be to
+ <a>queue a fetch task</a> to run <var>processBody</var> given <var>bytes</var>, with
+ <var>taskDestination</var>.

Probably queuing a fetch task would be best, especially for HTML where a lot of the cases talk about the networking task source (e.g. "the last task that is queued by the networking task source once the resource has been fetched", "Queue an element task on the networking task source given el to process the linked resource", ...). It also seems more future-proof if we move to realm-independent "C++ streams".

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1172#discussion_r577727350

Received on Wednesday, 17 February 2021 15:53:13 UTC