You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix: race-network-and-fetch-handler now uses actual |raceResponse| (#1777)
This commit originates from the work proposed by @monica-ch and accepted a code change suggested
by @domenic, but has been extensively reworked based on review feedback.
This commit corrects response handling for race-network-and-fetch-handler.
Primary Fix: The handler now correctly uses the actual fetch response for |raceResponse| instead of a generic
[=network error=].
Minor Improvement: |timingInfo| is now included in the [=network error=], when returned by
[=Create Fetch Event and Dispatch=], which simplifies the calling code.
1. Let |raceResponse| be a [=race response=] whose [=race response/value=] is "<code>pending</code>".
3266
3266
1. Run the following substeps [=in parallel=], but [=abort when=] |fetchController|'s [=fetch controller/state=] is "<code>terminated</code>" or "<code>aborted</code>":
3267
3267
1. Set |raceFetchController| to the result of calling [=fetch=] given |request|, with [=fetch/processResponse=] set to the following steps given a [=/response=] |raceNetworkRequestResponse|:
3268
+
1. Set |raceResponse|'s [=race response/value=] to |raceNetworkRequestResponse|.
3268
3269
1. If |raceNetworkRequestResponse|'s [=response/status=] is [=ok status=], then:
3269
-
1. Set |raceResponse|'s [=race response/value=] to |raceNetworkRequestResponse|.
3270
3270
1. Let |raceNetworkResult| be a [=race result=] whose [=race result/routed response=] is |raceNetworkRequestResponse| and [=race result/used route=] is {{RouterSourceEnum/"network"}}.
3271
3271
1. [=queue/Enqueue=] |raceNetworkResult| to |queue|.
3272
-
1. Otherwise, set |raceResponse|'s [=race response/value=] to a [=network error=].
3273
3272
1. [=If aborted=] and |raceFetchController| is not null, then:
1. Let |result| be the result of [=dequeue=] |queue|.
3284
3283
1. Let |routedResponse| be |result|'s [=race result/routed response=].
3284
+
1. If |routedResponse| is null:
3285
+
1. Return |timingInfo|.
3285
3286
1. If |result|'s [=race result/used route=] is {{RouterSourceEnum/"network"}}, then:
3286
3287
1. Set |routedResponse|'s [=service worker timing info=] be set to |timingInfo|.
3287
3288
1. Set |routedResponse|'s [=service worker timing info=]'s [=service worker timing info/worker final router source=] be set to |result|'s [=race result/used route=].
0 commit comments