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

Is the timing of "wait for body to be done." affected by long tasks? #1092

Open
ricea opened this issue Sep 24, 2020 · 1 comment
Open

Is the timing of "wait for body to be done." affected by long tasks? #1092

ricea opened this issue Sep 24, 2020 · 1 comment

Comments

@ricea
Copy link
Collaborator

ricea commented Sep 24, 2020

https://fetch.spec.whatwg.org/#concept-body-wait

I'm asking because I'm trying to work out if the expectations of this test https://github.com/web-platform-tests/wpt/blob/master/xhr/xhr-timeout-longtask.any.js are correct or not. Although that tests XHR, the question comes down to when a request is "done" (see https://xhr.spec.whatwg.org/#ref-for-timed-out-flag%E2%91%A1).

A body body is said to be done if body is null or body’s stream is closed or errored.

Closing or erroring a stream involves promises being settled, which has to happen in some realm. The obvious answer is that it happens in the realm that initiated the fetch, and so will be affected by long tasks. In which case a fetch won't be "done" until any long tasks are complete. However, the existence of synchronous XHR implies that in at least some cases these stream operations are happening in some other realm that continues to execute even when the main thread is blocked.

@annevk
Copy link
Member

annevk commented Sep 25, 2020

Those test expectations match my conceptual model in that the fetch happens in a separate thread and then messages back the result to the main thread. (The usage of streams in Fetch is a bit confusing however and there are various issues around that, e.g., #661, #730.)

cc @youennf

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

No branches or pull requests

2 participants