-
Notifications
You must be signed in to change notification settings - Fork 319
Fix: race-network-and-fetch-handler now uses actual |raceResponse| #1777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
f2d5c72
c39d796
f206baf
7102987
c9a9907
9a14512
8eec31a
c02659f
e2a3f08
5006fff
51832d8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3263,13 +3263,16 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/ | |
1. Let |queue| be an empty [=queue=] of [=race result=]. | ||
1. Let |raceFetchController| be null. | ||
1. Let |raceResponse| be a [=race response=] whose [=race response/value=] is "<code>pending</code>". | ||
1. Let |networkFetchCompleted| be false. | ||
1. Let |fetchHandlerCompleted| be false. | ||
1. Run the following substeps [=in parallel=], but [=abort when=] |fetchController|'s [=fetch controller/state=] is "<code>terminated</code>" or "<code>aborted</code>": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The existing setup seems a bit fragile to me. The definition of abort when only operates between steps, and there are only two steps nested under "If aborted"... In fact there is only one step before this PR. Probably there should be a check on fetchController's state inside the processResponse callback? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not confident but I tried to address that with #1779. |
||
1. Set |raceFetchController| to the result of calling [=fetch=] given |request|, with [=fetch/processResponse=] set to the following steps given a [=/response=] |raceNetworkRequestResponse|: | ||
1. If |raceNetworkRequestResponse|'s [=response/status=] is [=ok status=], then: | ||
1. Set |raceResponse|'s [=race response/value=] to |raceNetworkRequestResponse|. | ||
1. Let |raceNetworkResult| be a [=race result=] whose [=race result/routed response=] is |raceNetworkRequestResponse| and [=race result/used route=] is {{RouterSourceEnum/"network"}}. | ||
1. [=queue/Enqueue=] |raceNetworkResult| to |queue|. | ||
1. Otherwise, set |raceResponse|'s [=race response/value=] to a [=network error=]. | ||
1. Set |networkFetchCompleted| to true. | ||
1. [=If aborted=] and |raceFetchController| is not null, then: | ||
1. [=fetch controller/Abort=] |raceFetchController|. | ||
1. Set |raceResponse| to a [=race response=] whose [=race response/value=] is null. | ||
|
@@ -3279,7 +3282,14 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/ | |
1. If |fetchHandlerResponse| is not null and not a [=network error=], and |raceFetchController| is not null, [=fetch controller/abort=] |raceFetchController|. | ||
1. Let |raceFetchHandlerResult| be a [=race result=] whose [=race result/routed response=] is |fetchHandlerResponse| and [=race result/used route=] is {{RouterSourceEnum/"fetch-event"}}. | ||
1. [=queue/Enqueue=] |raceFetchHandlerResult| to |queue|. | ||
yoshisatoyanagisawa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
1. Wait until |queue| is not empty. | ||
1. Set |fetchHandlerCompleted| to true. | ||
1. Wait until any of the following are true: | ||
1. |queue| is not empty. | ||
1. Both |networkFetchCompleted| and |cacheLookupCompleted| are true. | ||
yoshisatoyanagisawa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
1. If |queue| is empty, then: | ||
1. If |raceResponse|'s [=race response/value=] is a [=/response=], return |raceResponse|'s [=race response/value=]. | ||
1. If |raceResponse|'s [=race response/value=] is a [=network error=], return a [=network error=]. | ||
1. Return null. | ||
yoshisatoyanagisawa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
1. Let |result| be the result of [=dequeue=] |queue|. | ||
1. Let |routedResponse| be |result|'s [=race result/routed response=]. | ||
1. If |result|'s [=race result/used route=] is {{RouterSourceEnum/"network"}}, then: | ||
|
Uh oh!
There was an error while loading. Please reload this page.