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

early design review: Permissions-Policy: unload #738

Closed
fergald opened this issue May 12, 2022 · 23 comments
Closed

early design review: Permissions-Policy: unload #738

fergald opened this issue May 12, 2022 · 23 comments
Assignees
Labels
Missing: Multi-stakeholder support Lack of multi-stakeholder support Progress: review complete Resolution: overtaken for example another proposal has emerged which covers the same use cases and enjoys broader support Review type: CG early review An early review of general direction from a Community Group Topic: performance Venue: WHATWG

Comments

@fergald
Copy link

fergald commented May 12, 2022

Braw mornin' TAG!

I'm requesting a TAG review of Permissions-Policy: unload.

This is a proposal for a new Permissions-Policy entry that will disable unload handlers. Permissions-Policy is a mechanism for controlling individual page's access to features. This proposal would add a way for a page to opt out of firing unload handlers while allowing exceptions.

Further details:

You should also know that...

[please tell us anything you think is relevant to this review]

We'd prefer the TAG provide feedback as (please delete all but the desired option):

💬 leave review feedback as a comment in this issue and @-notify fergald rakina domenic

@rakina @domenic

@fergald fergald added Progress: untriaged Review type: CG early review An early review of general direction from a Community Group labels May 12, 2022
@cynthia cynthia self-assigned this May 25, 2022
@torgo torgo added this to the 2022-06-13-week milestone May 25, 2022
@torgo torgo self-assigned this May 25, 2022
@fergald
Copy link
Author

fergald commented Jun 28, 2022

Do you have an ETA for this?

@torgo
Copy link
Member

torgo commented Jul 19, 2022

Hi @fergald you've answered !!! to point 9 of the security & privacy questionnaire - it seems evident that this is a "no" considering the context we're in but just double-checking this is the case.

@fergald
Copy link
Author

fergald commented Jul 19, 2022

Sorry. I must have meant to come back to that but I've updated it to "No.".

@torgo
Copy link
Member

torgo commented Jul 19, 2022

So we're just discussing in our breakout this morning. And @cynthia has given some further detail and how it fits into bfcache. I was a bit confused by this "Some browsers, like Desktop Chrome and Desktop Firefox, have chosen to keep the unload event reliable, so the existence of unload handlers makes a page ineligible for BFCache, hurting performance. In others like Android Chrome & Android Firefox, and WebKit-based browsers (Desktop Safari & all iOS browsers), if the page is eligible for BFCache, the unload handlers will not run, further increasing the unreliability of unload handlers." because it sounds like part of the motivation here is to patch a problem with current implementations? Can you clairfy?

We're having our f2f meeting next week and we will further discuss there and hopefully be able to close this. Thanks for bearing with us!

@fergald
Copy link
Author

fergald commented Jul 19, 2022

Unload is inherently unreliable on mobile because if a tab goes into the background, all kinds of things can occur that can result in the document being discarded without unload handlers running. E.g. it's common for the OS to kill a browser background process to reclaim memory, many people are in the habit of swiping apps closed when they are done with them to reduce background memory usage, this does not give the browser app time to correctly unload documents. This is quite different to desktop where the browser process is often alive for days or weeks and has an opportunity to run unload handlers if they exist when shutting down.

Unload is incompatible with BFCache. If a page enters BFCache, we can't run unload as the page enters BFCache because it might come back. If the user never comes back we will eventually evict the entry but we can't run it in the background then because that raises privacy problems. The page that they navigated away from minutes ago is suddenly running JS, maybe grabbing location information or making network requests etc.

The resolution on mobile was that anyone relying on unload was already broken, so it's fine to BFCache a page with unload, we just don't run it. Things get a bit more broken.

The resolution on desktop (for Chrome at least) was that things are still relying on unload and we should not unilaterally break it. Right now, for 16% of history navigations the only reason blocking from entering BFCache is that they have an unload handler in some frame. There are lots more pages blocked by unload+some other reasons, so other browsers could be seeing far higher than 16% that are only blocked by unload. If we were to just ignore it and BFCache anyway, we would be dropping the reliability of unload from something close to 100% down to 84% and even further as we make more and more features compatible with BFCache.

@torgo
Copy link
Member

torgo commented Jul 21, 2022

Thanks for the detailed explanation @fergald! I would suggest putting this material into the explainer itself to make it a bit more clear what's going on.

@torgo torgo added the Progress: propose closing we think it should be closed but are waiting on some feedback or consensus label Aug 9, 2022
@fergald
Copy link
Author

fergald commented Aug 30, 2022

A good chunk of what I wrote above was in the doc already (or in the links) but I made some revisions and additions to the motivation section.

Was there any further outcome from the F2F?

@cynthia
Copy link
Member

cynthia commented Jul 4, 2023

Re: gradually flipping; I'm a bit unsure how that would work in terms of spec text. Wouldn't that be requiring a level of Chrome-isms in other implementations? I believe other implementations either support something or don't, with not much a gradient in between.

@fergald
Copy link
Author

fergald commented Jul 5, 2023

Yes, there's no way to coordinate among browsers. The end state is what we want to standardise on. However the details of how to get there are important.

@torgo torgo modified the milestones: 2023-08-14-week, 2023-08-21-week, 2023-09-04-week Aug 20, 2023
@torgo torgo modified the milestones: 2023-09-04-week, 2023-10-09-week Oct 8, 2023
@torgo
Copy link
Member

torgo commented Feb 14, 2024

@fergald has there been any update you can share on this? Where do we currently stand? How can the TAG best help you?

@fergald
Copy link
Author

fergald commented Feb 21, 2024

The update is that Chrome has started experimenting with turning off the ability to add unload event handlers.

I think the only way TAG can help is to point out a fatal problem with the end-state where unload no longer exists. If there's some reason the web absolutely requires unload handlers, we would like to know so we can try to figure out what functionality we need to add.

@plinss plinss removed this from the 2024-02-12-week milestone Mar 11, 2024
@torgo torgo added this to the 2024-04-22-week milestone Apr 21, 2024
@plinss plinss removed this from the 2024-04-22-week milestone Apr 29, 2024
@plinss plinss removed the Progress: pending external feedback The TAG is waiting on response to comments/questions asked by the TAG during the review label Apr 29, 2024
@plinss plinss added this to the 2024-04-29-week:e milestone Apr 29, 2024
@torgo
Copy link
Member

torgo commented May 1, 2024

Noting that this proposal seems to have been withdrawn, we're closing this review. @fergald please open up a new review request for the new proposal you mentioned in that comment when appropriate.

@torgo torgo closed this as completed May 1, 2024
@torgo torgo removed this from the 2024-04-29-week:e milestone May 1, 2024
@torgo torgo added Resolution: overtaken for example another proposal has emerged which covers the same use cases and enjoys broader support Progress: review complete labels May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Missing: Multi-stakeholder support Lack of multi-stakeholder support Progress: review complete Resolution: overtaken for example another proposal has emerged which covers the same use cases and enjoys broader support Review type: CG early review An early review of general direction from a Community Group Topic: performance Venue: WHATWG
Projects
None yet
Development

No branches or pull requests

4 participants