-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Allow certain tasks to run even when document is not fully active? #6699
Comments
When I looked into something similar for https://wicg.github.io/page-lifecycle/, we found that none of the tasks that Chrome runs while a document is frozen exist in the spec; they all just happen to use similar "task runner" infrastructure. I suspect something similar is the case here. I.e., there is no observable difference between the spec's behavior (of running no tasks) and Chrome's behavior (of running some tasks, but only if they don't do anything observable). In that case there wouldn't be anything to change in the spec. Are there cases you have in mind where there are specific tasks that exist in the spec, but which Chrome runs in non-fully active documents? Like, could you point to the "queue a task" line in the spec? |
Thanks! The tasks that I'm concerned about are all the various fetch tasks (example), but maybe as you say since it's not really observable we don't need to update the spec. I guess it's not really 100% not observable in that the server that sends the resource would notice that the page still continues the fetch, but that's probably out of scope of the spec? |
Hmm, that's still sorta in scope. I'd be curious about @annevk's take, as he was changing that area of the spec recently. Interestingly, other fetch tasks are completely not observable, e.g. the ones to process end of body. It's just the chunk-reading one that you linked to, I think, which the server would observe. |
So for downloading (step 19 of https://fetch.spec.whatwg.org/#concept-http-network-fetch) I think we are okay. That currently does not but should queue a task to enqueue the ArrayBuffer, but it queues it after obtaining the bytes. I.e., network retrieval would continue, but task side effects would happen once the document becomes active again. (Unless network tasks are discarded? It would be good to have tests around this.) For uploading we could make it work for non-actual stream cases (which is currently all of them; what is the plan for upload streams? cc @yutakahirano @yoichio) in a similar manner I suspect, but it would require having a more abstract stream concept. I'm having a hard time recalling if we have notes around some of the JavaScript streams stuff being hand-wavy (especially when in parallel), but that might suffice here (except it would not for upload streams I think). Hope that helps. |
Thank you! |
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3222281 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#962858}
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3222281 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#962858}
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3222281 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#962858} Co-authored-by: Hiroshige Hayashizaki <hiroshige@chromium.org>
…ch, a=testonly Automatic update from web-platform-tests [WPT] BFCache eligibility: in-flight fetch (#31227) When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3222281 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#962858} Co-authored-by: Hiroshige Hayashizaki <hiroshige@chromium.org> -- wpt-commits: 847d71c7a865d9c3a6e16dad5e95a6cc37c7e13a wpt-pr: 31227
…ch, a=testonly Automatic update from web-platform-tests [WPT] BFCache eligibility: in-flight fetch (#31227) When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3222281 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#962858} Co-authored-by: Hiroshige Hayashizaki <hiroshige@chromium.org> -- wpt-commits: 847d71c7a865d9c3a6e16dad5e95a6cc37c7e13a wpt-pr: 31227
When there is an in-flight network request at the time of navigation, Chrome: The page is BFCached and the fetch request completes successfully after restored. Firefox: The page is not BFCached Safari: The page is BFCached but the fetch request is canceled. Bug: whatwg/html#6699 Change-Id: I1d84d92c6396abad62eab9306f8656cbf303f8c6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3222281 Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Cr-Commit-Position: refs/heads/main@{#962858} NOKEYCHECK=True GitOrigin-RevId: 419fccc6c3301a0d8702a860195ec2fc780505d5
Currently Chrome's implementation of BFCache allows certain tasks to run even when its document is not fully active, as long as it doesn't expose any web-observable behaviors (e.g. events). In particular, we allow in-flight network requests to continue loading, but not new network requests.
However, I think currently fetch tasks are posted with an associated document, which aren't runnable if the document is not fully active (CMIIW!)
I wonder if it's possible to change the spec to allow Chrome's behavior here? Or maybe even just a note that it's possible that some user agents don't 100% follow the "runnable" rule?
cc @domenic @fergal
The text was updated successfully, but these errors were encountered: