[meta] Support Fetch keepalive flag and enforce limit on inflight keepalive bytes
Categories
(Core :: DOM: Networking, task, P2)
Tracking
()
People
(Reporter: igrigorik, Unassigned, NeedInfo)
References
(Depends on 2 open bugs, Blocks 2 open bugs)
Details
(Keywords: meta, Whiteboard: [necko-triaged])
Updated•8 years ago
|
Updated•8 years ago
|
Updated•8 years ago
|
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Comment 3•6 years ago
|
||
Comment 5•6 years ago
|
||
Comment 6•6 years ago
|
||
Updated•6 years ago
|
Updated•5 years ago
|
Comment 7•4 years ago
|
||
Another use case for fetch keepalive is the ability to handle server errors and allow outliving the environment, without the use of a service worker. Although you can't handle server errors for a request that outlives the environment (without a service worker), it would be nice to have a single API that could handle either scenario (server error OR outlive environment), albeit not at the same time.
Updated•3 years ago
|
Hi there, any update on this issue?
The problem is that some adblockers have started blocking Beacon requests so keepalive flag is even more important now.
Comment 10•2 years ago
|
||
I'm also very interested in support for this feature. If you discount IE, Firefox is the only browser without support for the keepalive flag since 2019: https://caniuse.com/mdn-api_request_keepalive
My use case:
We're sending metadata to a server, and we want to be certain it's sent even if the page is being unloaded. We don't really care about it's body, but we need to know when the request is complete. Navigator.sendBeacon()
supports the former, but not the latter (since we don't get a promise back). Using fetch
with keepalive: true
ensures both conditions; not being canceled as well as receiving a promise back for when the request is complete.
We can't replace our current Navigator.sendBeacon()
usage completely, since Firefox does not support fetch
with the keepalive
flag. It would be great for Web compatability if this feature was implemented.
Updated•2 years ago
|
Comment 11•1 years ago
|
||
Hey guys! Is there any hope that we will ever be able to use this feature in Firefox?
Comment 12•1 years ago
|
||
This would require some reverse engineering to have something compatible with the other browsers (see https://github.com/whatwg/fetch/issues/679), but what is in the spec, https://fetch.spec.whatwg.org, is rather simple.
Valentin, do we already support keepalive type of requests from Necko point of view - requests which stay alive a bit longer than the relevant browsing context or window context?
Though, we would still want to have some keepalive manager in the parent process to limit the number of such requests per origin or so.
Or perhaps something simple like what sendBeacon does would work reasonable well too, one could add a shutdown blocker or some such for the relevant content process.
Comment 13•1 years ago
•
|
||
I think there are two relevant mechanisms here.
- The load group. I think fetch requests go in the loadgroup of the page it's created from, so when that gets unloaded, fetch requests would get cancelled. I think it is definitely possible to have a different loadgroup for keepalive requests, so we don't cancel them on unload.
- The channel actors. PHttpChannel is managed by PNecko which is managed by PContent. If the user closes the tab and that destroys PContent, the channels should also get destroyed.
Though I'm not 100% sure that is what we do right now.Right now, the signal to close the channel when the tab dies is sent from HttpChannelChild::ActorDestroy so it should be easy to exclude keepalive requests.
A keepalive channel manager would indeed be necessary to enforce the limits and make sure we properly clean up after the channels.
Comment 14•1 years ago
|
||
Hi, everyone! It will be perfect to have this feature in Firefoxe)
Updated•1 years ago
|
Comment 15•1 year ago
|
||
any updates to this? keepalive is living standard, and firefox already implements a very similar approach with sendBeacon. so i think this should be a rather low-hanging fruit?
Comment hidden (me-too) |
Updated•11 months ago
|
Updated•10 months ago
|
Comment 17•9 months ago
|
||
Hi! Any updates on when the keepalive flag will be supported in Firefox? I can't use sendBeacon for my application because I need to set custom headers, and fetch with keepalive is the only alternative.
Comment 18•8 months ago
|
||
(In reply to lena.a.cohen from comment #17)
Hi! Any updates on when the keepalive flag will be supported in Firefox? I can't use sendBeacon for my application because I need to set custom headers, and fetch with keepalive is the only alternative.
Hello Lena,
We have started the implementation for keepalive. You should expect this to be operational within next two releases.
Comment 19•8 months ago
|
||
(In reply to Sunil Mayya from comment #18)
(In reply to lena.a.cohen from comment #17)
Hi! Any updates on when the keepalive flag will be supported in Firefox? I can't use sendBeacon for my application because I need to set custom headers, and fetch with keepalive is the only alternative.
Hello Lena,
We have started the implementation for keepalive. You should expect this to be operational within next two releases.
Thank you so much Sunil!
Comment 20•6 months ago
|
||
Hi Sunil/Firefox team,
Do we have any insights about Firefox versions where we could potentially have keepalive
fully supported? Is it around Firefox v128?
Best regards.
Comment 21•6 months ago
|
||
(In reply to Sunil Mayya from comment #18)
(In reply to lena.a.cohen from comment #17)
Hi! Any updates on when the keepalive flag will be supported in Firefox? I can't use sendBeacon for my application because I need to set custom headers, and fetch with keepalive is the only alternative.
Hello Lena,
We have started the implementation for keepalive. You should expect this to be operational within next two releases.
In the meantime 3 additional versions had been releases, is there any kind of roadmap until when this can be expected to land in stable firefox?
Comment 22•5 months ago
|
||
Hello Lena, Ivan, Alex
Thank you for checking on this and sorry for the delay
Last week, I merged the initial implementation for the keepalive feature based on the fetch specification, which should now work for non-worker fetch requests. This feature is available for initial testing in this week's nightly build and in the official 129 release next month.
As the feature is disabled by default due to some pending work on workers, you can enable it by setting "dom.fetchKeepalive.enabled" in about:config
.
I would greatly appreciate your feedback on this feature. Your insights and testing results will help me refine it sooner.
Thank you for your support.
As far as the official version, you can expect it to be fully functional around 130-131.
Comment 23•2 months ago
|
||
Clear a needinfo that is pending on an inactive user.
Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE
.
For more information, please visit BugBot documentation.
Description
•