-
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
What happens if a portal is navigated during activation? #220
Comments
I think my instinct is that this should continue activating whatever browsing context was associated at that time, and setting |
#253 has a solution for
but I don't think the consequences are exactly as described in the following parts of the OP. In particular, portal.src = "https://example.com/";
portal.onload = () => {
portal.activate();
portal.src = "https://example.org/"; // (*)
}; The guest browsing context activation happens in parallel to the I think the desired behavior here is that To implement this, I think we need to move some of the in-parallel parts of @jeremyroman, does this match your reading? Another case, for comparison: no waiting for load. Given portal.src = "https://example.com/"; // (1)
portal.activate(); // (2)
portal.src = "https://example.org/"; // (3) what will happen is pretty clear after #253:
So |
I think my preferred mental model is consistent with yours -- the Yeah, I could see lifting the first few steps out of the "in parallel" block. |
Agreed with the observed behaviour of setting src following a call to activate:
The same behaviour of preceding with activation if it would immediately succeed seems appropriate for similar cases like activating, then removing the portal element. I'm not sure what the best way to express this in spec land is, but I'm a bit nervous about describing these as synchronous. I could imagine keeping track of a "pending activation browsing context" which would cause us to not close the context when performing other operations. This would only need to last until we receive word that we're immediately succeeding, immediately failing, or deferring activation. |
This can happen via:
Or
location.href = differentURL
within the portal.It isn't clear if these should even have the same solution. I think we decided in the past that setting the
src
on a portal is effectively like creating a new portal, as in it resets all portal state. Whereas a navigation within a portal is not in control of the outer page.Options:
Setting
src
is ignored on a portal during activation. Creates a nasty race condition that developers can't really reason about.Portals cannot have their
src
changed onceactivate()
is called. I guess you'd need a property to indicate that the portal is in this state.A new browsing context is created every time the src is changed on a portal. The previous context is closed, unless it's activating.
When
activate()
is called, it's the current browsing context that's activated. If the src is changed during activation, it works, but it's the previous context that continues to activate.There might be some trickiness here, since the activating context seems detached from the document. Does that create the same problems as keeping iframes alive when they're outside the document?
As above, but when src is change, a new browsing context is only created if the current browsing context is activating.
Setting
src
aborts any ongoing activation associated with that portal.cc @kjmcnee as you may have already solved this in the implementation.
The text was updated successfully, but these errors were encountered: