-
Notifications
You must be signed in to change notification settings - Fork 66
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
Currently, knowing when a portal can be activated is guesswork #191
Comments
We could make
|
Agreed, this is why I think we need something like |
I do like this idea. I wonder if we'd want it to be a promise or an event. If a promise, I think I would expect it to be replaced with a new promise when I set |
Even though it can happen many times, I think a promise is more usable as it can't be 'missed' (see the libraries that try to solve this for DOMContentLoaded).
Agreed. That was also the conclusion in whatwg/html#127.
Also agree, for security reasons. I'm still not sure if it's safe to expose this for cross-origin cases. Don't we hold-back document swaps in regular navigations until first paint? Maybe this stuff is already exposed. Although I have a vague feeling the rules might be different for cross-origin navigations. I guess we should find someone who worked on this stuff. |
https://bugs.chromium.org/p/chromium/issues/detail?id=805798 - this is only applied to same-origin navigations. I suspect it's for security/privacy reasons, but reason isn't given. |
From @mikewest
Ok, so we need something else. We already expose the time between setting |
Rather than debating which point in time the browser can reveal readyness, and arguing about what period of time is potentially available via other means, why not provide the portaled page with the ability to notify its portaler that it's ready to be activated? That seems to me to mitigate the risk of inadvertently revealing information about user activity in frames/portals, and developers can presumably be trusted to make reasonable decisions about when they're ready that (in the best case) would be even more accurate than whatever heuristic we could produce. It's a 1-bit leak from the portaled page to the portaler, which is perhaps something to worry about? I'm not sure what the privacy model is that y'all are working within... |
I'm worry is it isn't easy for developers to understand what information they're exposing by providing that, vs CORS where it's easier to explain (and folks still struggle with that). |
I'm suggesting something like |
Doesn't |
I guess? It doesn't seem to require less explanation (at least to ourselves) than the various points in time suggested above? I'm assuming most folks won't use it, which minimizes the impact. |
@mikewest if you have time, it might be worth thinking about #192 (comment). We're trying to come up with a way of using a portal as part of a regular navigation, so pages don't have to do special things to get a good experience. This idea is to make this as close to a regular navigation as possible, but with the opportunity to add a little animation. This is why I was asking if real navigations were less problematic, since you can't just create 100s of them. We're trying to make the same guarantees here. |
From #185, an activation can fail if:
This doesn't feel right. The load event is far too long to delay a navigation, and the only other choice we're leaving developers with is taking a punt and calling
activate()
early.If exposing an earlier point is a leak, then we're kinda already leaking it though
activate()
rejecting.When the developer calls
activate()
, we could wait until the fetch is far enough along, before deciding whether to fulfill or reject. This is generally how promise-based APIs work – they don't fail if the thing is in-progress.Also, it'd be great to provide a
portal.contentPainted
promise, which is a signal for "you can start the transition now". But yeah, I'm unsure of the security implications here.The text was updated successfully, but these errors were encountered: