From 88890b18a47a080ab5ee5a6fcee19d62e6df9fc7 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Thu, 25 Mar 2021 18:25:27 +0200 Subject: [PATCH] processResponseDone should receive a response Only call processResponseDone for responses that have their timing info set, which are responses that have passed CORS and redirects. Closes https://github.com/whatwg/fetch/issues/1201 --- fetch.bs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/fetch.bs b/fetch.bs index 865f0cf1c..293b73e57 100644 --- a/fetch.bs +++ b/fetch.bs @@ -3513,7 +3513,7 @@ representing the number of bytes transmitted. If given, processRequestEndOf an algorithm accepting no arguments. If given, processResponse must be an algorithm accepting a response. If given, processResponseEndOfBody must be an algorithm accepting a response and null, failure, or a byte sequence. If -given, processResponseDone must be an algorithm accepting no arguments. +given, processResponseDone must be an algorithm accepting a response.

An ongoing fetch can be terminated with flag aborted, @@ -3983,13 +3983,21 @@ steps: response response, run these steps:

    +
  1. Let timingInfo be response's timing info. +

  2. Set fetchParams's request's done flag. +

  3. If timingInfo is null, then return. + +

  4. Set timingInfo's response end time to + the coarsened shared current time given fetchParams's + cross-origin isolated capability. +

  5. If fetchParams's process response done is not null, - then queue a fetch task given fetchParams's - process response done and fetchParams's - task destination. + then queue a fetch task to run fetchParams's + process response done given response, + with fetchParams's task destination.

To finalize and report timing given a response @@ -7219,8 +7227,9 @@ method steps are:

  • Terminate the ongoing fetch with the aborted flag set. -

  • Let handleFetchDone be to finalize and report timing with - response, globalObject, and "fetch". +

  • Let handleFetchDone given response response be to + finalize and report timing with response, globalObject, and + "fetch".

  • Fetch request with processResponseDone set to