Skip to content
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

"Return a network error" doesn't seem to go through "process response" #1164

Closed
domenic opened this issue Feb 8, 2021 · 5 comments · Fixed by #1165
Closed

"Return a network error" doesn't seem to go through "process response" #1164

domenic opened this issue Feb 8, 2021 · 5 comments · Fixed by #1165

Comments

@domenic
Copy link
Member

domenic commented Feb 8, 2021

Consider what happens when we reach step 10 of fetch(), which calls the "fetch" algorithm.

The only way the promise ever gets resolved or rejected is once "process response" gets invoked.

However, it's possible to (synchronously) reach a step which reads "Return a network error", e.g. fetch step 2.3, or main fetch step 3.2, 3.3. In which case "process response" never gets invoked, so in theory the promise doesn't settle.

@annevk
Copy link
Member

annevk commented Feb 9, 2021

Thanks! This is a regression from the "abort when" language that was added. We probably should not use that language before going in parallel. That does assume that fetch and terminate are invoked from the same thread, but that's hopefully reasonable?

cc @jakearchibald

@jakearchibald
Copy link
Collaborator

We probably should not use that language before going in parallel

This is sort-of related to #536, since there are specs which call fetch in parallel. I guess we could pretend that they don't for now, then figure out a way that fetch should be called in parallel.

If we're assuming that fetch must be called from the main thread, I can just remove the abort language from those parts. Sound good?

@annevk
Copy link
Member

annevk commented Feb 9, 2021

I will take care of this as part of that issue. My idea is that for "in parallel" invocation of fetch you still have to give callbacks that will be called in a parallel queue that fetch creates. And there is no more returning of a response to the caller.

@jakearchibald jakearchibald self-assigned this Feb 9, 2021
@jakearchibald
Copy link
Collaborator

Sounds good. I'll remove the abort stuff.

@jakearchibald jakearchibald removed their assignment Feb 9, 2021
@jakearchibald
Copy link
Collaborator

No I won't (following IRC chat)

annevk added a commit that referenced this issue Feb 11, 2021
This makes some rather big changes:

* Requests no longer have a synchronous flag. Blocking a thread is now up to the caller.
* Fetch therefore no longer returns a response directly. In parallel callers will need to pass in "callbacks" that are either invoked on a parallel queue or on an event loop.
* To hold onto these callbacks as well as some other information a fetch params struct is now passed around the various fetch algorithms. This will allow for cleanup around termination and aborting in the future. Potentially some bookkeeping state from request can move there going forward.
* There's a dedicated navigate-redirect fetch algorithm for HTML as the HTTP-redirect fetch algorithm now wants a fetch params instance.
* Some allowance for aborting early on in fetch was removed as all that is run synchronously with the code that invoked fetch to begin with. Closes #1164.
* Algorithms that needed to be adjusted were changed to use the new Infra patterns for parameters. I also tried to improve naming, e.g., makeCORSPreflight rather than CORS-preflight flag.
* "process response done" was removed as it seemed redundant with "response response end-of-body"; possible leftover from trailers.
* Removed duplicate task queueing at the end of main fetch for request's body.

Fixes #536.
annevk added a commit that referenced this issue Feb 12, 2021
This makes some rather big changes:

* Requests no longer have a synchronous flag. Blocking a thread is now up to the caller.
* Fetch therefore no longer returns a response directly. In parallel callers will need to pass in "callbacks" that are either invoked on a parallel queue or on an event loop.
* To hold onto these callbacks as well as some other information a fetch params struct is now passed around the various fetch algorithms. This will allow for cleanup around termination and aborting in the future. Potentially some bookkeeping state from request can move there going forward.
* There's a dedicated navigate-redirect fetch algorithm for HTML as the HTTP-redirect fetch algorithm now wants a fetch params instance. This also returns a response which fixes a problem where HTTP-redirect fetch would return a network error that was then ignored.
* Some allowance for aborting early on in fetch was removed as all that is run synchronously with the code that invoked fetch to begin with. Closes #1164.
* Algorithms that needed to be adjusted were changed to use the new Infra patterns for parameters. I also tried to improve naming, e.g., makeCORSPreflight rather than CORS-preflight flag.
* "process response done" was removed as it seemed redundant with "response response end-of-body"; possible leftover from trailers.
* Removed duplicate task queuing at the end of main fetch for request's body.

Fixes #536.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants