Re: [whatwg/fetch] Attach timing info and URL to network errors, and report for fetch API (#1311)

@annevk commented on this pull request.



> +  <ol>
+   <li>
+    <p>Set <var>response</var>'s <a for=response>URL list</a> to « <var>fetchParams</var>'s
+    <a for="fetch params">request</a>'s <a for=request>URL list</a>[0] ».
+
+    <p class=note>This is needed as after <a for=list>cloning</a> <var>fetchParams</var>'s
+    <a for="fetch params">request</a>'s <a for=request>URL list</a> earlier, <var>response</var>
+    might have been set to a <a>network error</a>.
+
+   <li><p>Set <var>response</var>'s <a for=response>timing info</a> to the result of
+   <a>creating an opaque timing info</a> for <var>fetchParams</var>'s
+   <a for="fetch params">timing info</a>.
+  </ol>
+
+  <p>Otherwise, set <var>response</var>'s <a for="response">finalize</a> to
+  <var>finalizeResponse</var>.</p>

This setup doesn't end up invoking it if the network layer is already done before this is set. That's why we need the convoluted flag setup I proposed I think.

> @@ -5507,18 +5539,20 @@ optional boolean <var>forceNewConnection</var> (default false), run these steps:
          agent to <a for=fetch>suspend</a> the ongoing fetch.
         </ol>
 
-       <li><p>Otherwise, if the bytes transmission for <var>response</var>'s message body is done
-       normally and <var>stream</var> is <a for=ReadableStream>readable</a>, then
-       <a for=ReadableStream>close</a> <var>stream</var>, <a for=/>finalize response</a> for
-       <var>fetchParams</var> and <var>response</var>, and abort these in-parallel steps.
+       <li><p>Otherwise, if <var>response</var>'s <a for=response>finalize</a> is not null, the
+       bytes transmission for <var>response</var>'s message body is done normally and
+       <var>stream</var> is <a for=ReadableStream>readable</a>, then <a for=ReadableStream>close</a>
+       <var>stream</var>, call <var>response</var>'s <a for=response>finalize</a>, and abort these
+       in-parallel steps.

We need to close the stream even if response's finalize is null.

>        </ol>
     </ol>
 
    <li>
     <p><a>If aborted</a>, then:
 
     <ol>
-     <li><a for=/>Finalize response</a> for <var>fetchParams</var> and <var>response</var>.
+     <li>If <var>response</var>'s <a for=response>finalize</a> is not null, <var>response</var>'s\
+     <a for=response>finalize</a>.

This sentence needs some work.

-- 
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/1311#pullrequestreview-777226977

Received on Tuesday, 12 October 2021 11:02:19 UTC