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

Disallow portal creation and activation in the unload handlers #133

Open
lucasgadani opened this issue May 24, 2019 · 5 comments
Open

Disallow portal creation and activation in the unload handlers #133

lucasgadani opened this issue May 24, 2019 · 5 comments
Assignees
Labels
spec todo A nitty-gritty detail that needs spec work

Comments

@lucasgadani
Copy link
Collaborator

For similar reasons we disallow navigations while unloading, we shouldn't allow portals creation/activation while unloading the document.

@jeremyroman
Copy link
Collaborator

Do you happen to have the spec reference for how this is handled for frames handy?

@lucasgadani
Copy link
Collaborator Author

I believe frames don't handle this directly. When a user follows a hyperlink, it uses this algorithm:
https://html.spec.whatwg.org/#following-hyperlinks-2

Since we queue a task on the target's browsing context event loop, which is being discarded, the task never gets executed, which means the navigation never occurs. Maybe @domenic can clarify if this is correct?

@domenic
Copy link
Collaborator

domenic commented May 24, 2019

Hmm, I'm not sure that's right. First, note that it's not that the event loop gets discarded; it's that the task is associated with a document, and once that document becomes not-fully-active, any tasks involving it are skipped. (Until the document becomes fully active again, which can happen!)

But during-unloading navigation is prevented by https://html.spec.whatwg.org/#navigate steps 4 and 5. Which is not a model of clear and precise spec text, to be clear; ideally there would be an explicit flag set and unset which could get checked.

@lucasgadani
Copy link
Collaborator Author

Ah, that makes sense. Thanks for the pointer!

I think we can probably use a condition similar to steps 4/5 in the navigation algorithm to prevent portals from being created and activated.

@domenic domenic added the spec todo A nitty-gritty detail that needs spec work label May 8, 2020
@domenic
Copy link
Collaborator

domenic commented Jun 23, 2020

I've attempted to clean up HTML here in whatwg/html#5666 so that we can do the same more easily in portals.

@domenic domenic self-assigned this Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec todo A nitty-gritty detail that needs spec work
Projects
None yet
Development

No branches or pull requests

3 participants