-
Notifications
You must be signed in to change notification settings - Fork 337
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
what should fetch() do if request's window has been destroyed or stopped? #153
Comments
This is basically https://www.w3.org/Bugs/Public/show_bug.cgi?id=23878. Once a window goes away the fetch group needs to be terminated, which terminates all the fetches. Not sure what the stop UI should do. Does it typically prevent any further fetches? As a user I'm never quite sure what that button does. |
But should it terminate fetch's made with a fetch event handler in a service worker with fetch(evt.request)? |
To clarify, if an "outer fetch()" is intercepted by a SW which then makes an "inner fetch()":
|
|
@jakearchibald any thoughts on this now we have abort handling? |
I hope they aligned AbortController#abort with XMLHttpRequest#abort. |
Similar to the user pressing the stop button, aborted media requests seem to have inconsistent behavior in browsers today. Suppose you have an
Now, kill the audio src:
On Chrome, the audio stream request is cancelled, which is what I would expect. On Safari, the request keeps on going. |
w3c/ServiceWorker#1544 (comment) It seems that ServiceWorker does not abort the request.signal when a tab is closed today. |
The fetch spec currently associates the current client or window with a request object. This is important for allowing fetch(event.request) in service workers to work when the request requires mixed content or client certificate dialogs. These requests need UX interaction to work properly.
There is a race, however. Between the time the request is created and when the fetch() uses the window property, the original window can:
It seems the spec should handle (1) by checking if the window is closed before permitting mixed content and client certificates.
For (2), I have more questions...
In gecko we treat pressing the stop button as cancelling all document related network requests. By associating the window with the request, we could also cancel fetch(event.request) when the original window is stopped (or closed). Should we?
On the one hand, it seems to reflect the wishes of the user. On the other hand, the service worker may want to do event.waitUntil(cache.add(event.request)) with the intention of caching it in the background.
Thoughts?
The text was updated successfully, but these errors were encountered: