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

Some calls https://html.spec.whatwg.org/#set-the-ongoing-navigation could need some clarification #10800

Open
mbrodesser-Igalia opened this issue Nov 26, 2024 · 6 comments
Labels
clarification Standard could be clearer topic: navigation

Comments

@mbrodesser-Igalia
Copy link
Member

mbrodesser-Igalia commented Nov 26, 2024

What is the issue with the HTML Standard?

https://html.spec.whatwg.org/#set-the-ongoing-navigation should "inform the navigation API about aborting navigation" only if "navigable's ongoing navigation" is not null.

It's set to null e.g. in step 2 of https://html.spec.whatwg.org/#navigate-to-a-javascript:-url.

Edit: see #10800 (comment) and #10800 (comment) for proposals.

@domenic
Copy link
Member

domenic commented Nov 27, 2024

Why do you think this? If we reach step 2 of https://html.spec.whatwg.org/#navigate-to-a-javascript:-url, we are aborting the ongoing navigation, and so we should inform the navigation API about it.

@mbrodesser-Igalia
Copy link
Member Author

Why do you think this? If we reach step 2 of https://html.spec.whatwg.org/#navigate-to-a-javascript:-url, we are aborting the ongoing navigation, and so we should inform the navigation API about it.

Need to take a step back, there might be a preceding bug in the spec:

when step 19 of https://html.spec.whatwg.org/#navigate is invoked, "ongoing navigation" may be null.
Hence https://html.spec.whatwg.org/#set-the-ongoing-navigation would invoke its step 2, which shouldn't happen.
Or is there a mistake in the reasoning?

@domenic
Copy link
Member

domenic commented Nov 27, 2024

What is wrong with invoking step 2 if there's no ongoing navigation? It will do nothing in that case.

@mbrodesser-Igalia
Copy link
Member Author

From an abstract point of view it's surprising that "inform the navigation API about aborting navigation" doesn't inform in that case. It's also not obvious if it does nothing. It seems it might also queue a task (which might do nothing).
So it'd be clearer to not invoke that step.

@mbrodesser-Igalia
Copy link
Member Author

Based on the premise that step 2 does nothing, there is no technical issue.

@mbrodesser-Igalia
Copy link
Member Author

It is additionally confusing that:

location.href = "javascript:console.log(1)";
location.href = "javascript:console.log(2)";

would set the navigationId in step 19 of https://html.spec.whatwg.org/#navigate, hinting there is an ongoing navigation, but only scheduling a task for a potential navigation in https://html.spec.whatwg.org/#navigate-to-a-javascript:-url.
So the second assignment of the javascript: URL, step 19 of https://html.spec.whatwg.org/#navigate would find a navigationId, because the first task didn't run yet and inform about cancelling that (which again presumably does nothing).

It might be clearer to pass something like "javascript-url" in step 20 of https://html.spec.whatwg.org/#navigate to a new call of https://html.spec.whatwg.org/#set-the-ongoing-navigation before queuing the navigate to a javascript: URL task and calling the current step 20 of https://html.spec.whatwg.org/#navigate as step 21.

@mbrodesser-Igalia mbrodesser-Igalia changed the title https://html.spec.whatwg.org/#set-the-ongoing-navigation needs a null-check Some calls https://html.spec.whatwg.org/#set-the-ongoing-navigation could need some clarification Nov 27, 2024
@domenic domenic added the clarification Standard could be clearer label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer topic: navigation
Development

No branches or pull requests

2 participants