Skip to content

Commit 3d83bed

Browse files
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 parent a402c93 commit 3d83bed

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

docs/index.bs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,15 +3263,17 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
32633263
1. Let |queue| be an empty [=queue=] of [=race result=].
32643264
1. Let |raceFetchController| be null.
32653265
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.
32673268
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:
3273-
1. [=fetch controller/Abort=] |raceFetchController|.
3274-
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:
3275+
1. [=fetch controller/Abort=] |raceFetchController|.
3276+
1. Set |raceResponse| to a [=race response=] whose [=race response/value=] is null.
32753277
1. Resolve |preloadResponse| with undefined.
32763278
1. Run the following substeps [=in parallel=]:
32773279
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

Comments
 (0)