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

window.open() checks for invalid URL after creating a new traversable #10681

Closed
shannonbooth opened this issue Oct 7, 2024 · 0 comments · Fixed by #10683
Closed

window.open() checks for invalid URL after creating a new traversable #10681

shannonbooth opened this issue Oct 7, 2024 · 0 comments · Fixed by #10683
Assignees

Comments

@shannonbooth
Copy link

shannonbooth commented Oct 7, 2024

What is the issue with the HTML Standard?

The window open steps check the validity of the URL after running the rules to choose a navigable.

This will result in a new traversable being created (but then not navigated to) on an invalid URL, which if I understand right, is not correct.

I believe the step(s) of:

If urlRecord is failure, then throw a "SyntaxError" [DOMException]

Should run earlier in the window open steps before invoking the rules for choosing a navigable - or at least, before creating a new traversable.

@domenic domenic self-assigned this Oct 7, 2024
domenic added a commit that referenced this issue Oct 7, 2024
Previously, we would only check at the last minute. This would be buggy in the case where we create a new navigable, and then throw an exception. Instead we should be sure to throw before creating a new navigable.

In addition to fixing this somewhat-obviously-wrong bug, this also causes validation to happen in cases where a named window is targeted, but no window with that name exists. Previously, the window open steps would do nothing in such cases; now, they throw an exception when given an invalid URL.

Closes #10681.
domenic added a commit that referenced this issue Nov 15, 2024
Previously, we would only check at the last minute. This would be buggy in the case where we create a new navigable, and then throw an exception. Instead we should be sure to throw before creating a new navigable.

In addition to fixing this somewhat-obviously-wrong bug, this also causes validation to happen before popup blocking or other window-choosing steps. Previously, if trying to open a window to an unparseable URL with the popup blocker active, the window open steps would return null; now, they throw an exception.

Closes #10681.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants