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
Less fragile |fetchController| termination check (w3c#1780)
https://infra.spec.whatwg.org/#abort-when adds the check each time the step is executed. However, there is only a step
between and the abort-when and if-aborted, it should be less effective abort than we expect. Let me add a step inside
the callback in case.
This is the fix for that.
1. Let |queue| be an empty [=queue=] of [=race result=].
3264
3264
1. Let |raceFetchController| be null.
3265
3265
1. Let |raceResponse| be a [=race response=] whose [=race response/value=] is "<code>pending</code>".
3266
-
1. Run the following substeps [=in parallel=], but [=abort when=] |fetchController|'s [=fetch controller/state=] is "<code>terminated</code>" or "<code>aborted</code>":
3266
+
1. Run the following substeps [=in parallel=]:
3267
+
1. If |fetchController|'s [=fetch controller/state=] is "<code>terminated</code>" or "<code>aborted</code>", then set |raceResponse| to a [=race response=] whose [=race response/value=] is null, and abort these steps.
3267
3268
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|.
3269
-
1. If |raceNetworkRequestResponse|'s [=response/status=] is [=ok status=], then:
3270
-
1. Let |raceNetworkResult| be a [=race result=] whose [=race result/routed response=] is |raceNetworkRequestResponse| and [=race result/used route=] is {{RouterSourceEnum/"network"}}.
3271
-
1. [=queue/Enqueue=] |raceNetworkResult| to |queue|.
3272
-
1. [=If aborted=] and |raceFetchController| is not null, then:
1. Set |raceResponse| to a [=race response=] whose [=race response/value=] is null.
3269
+
1. Run these steps, but [=abort when=] |fetchController|'s [=fetch controller/state=] is "<code>terminated</code>" or "<code>aborted</code>".
3270
+
1. Set |raceResponse|'s [=race response/value=] to |raceNetworkRequestResponse|.
3271
+
1. If |raceNetworkRequestResponse|'s [=response/status=] is [=ok status=], then:
3272
+
1. Let |raceNetworkResult| be a [=race result=] whose [=race result/routed response=] is |raceNetworkRequestResponse| and [=race result/used route=] is {{RouterSourceEnum/"network"}}.
3273
+
1. [=queue/Enqueue=] |raceNetworkResult| to |queue|.
3274
+
1. [=If aborted=] and |raceFetchController| is not null, then:
1. Set |raceResponse| to a [=race response=] whose [=race response/value=] is null.
3275
3277
1. Resolve |preloadResponse| with undefined.
3276
3278
1. Run the following substeps [=in parallel=]:
3277
3279
1. Let |fetchHandlerResponse| be the result of [=Create Fetch Event and Dispatch=] with |request|, |registration|, |useHighResPerformanceTimers|, |timingInfo|, |workerRealm|, |reservedClient|, |preloadResponse|, and |raceResponse|.
0 commit comments