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

Document cases where earlier navigations take priority #218

Open
jakearchibald opened this issue Jun 24, 2020 · 6 comments
Open

Document cases where earlier navigations take priority #218

jakearchibald opened this issue Jun 24, 2020 · 6 comments
Labels
spec todo A nitty-gritty detail that needs spec work

Comments

@jakearchibald
Copy link
Collaborator

Right now it looks like the HTML spec say "last wins" in terms of navigation, but I think there are cases where we give priority to user-initiated navigations over js-initiated navigations.

We should document this and figure out where portal activation sits.

@jyasskin @kjmcnee do either of you have this in your heads already?

@jakearchibald jakearchibald added the spec todo A nitty-gritty detail that needs spec work label Jun 24, 2020
@kjmcnee
Copy link
Collaborator

kjmcnee commented Jun 24, 2020

In chrome, we ignore renderer initiated navigations when there is an ongoing browser initiated request and the new navigation lacks a user gesture.

Portal activation without a user gesture also cannot cancel a browser initiated request.

@jakearchibald
Copy link
Collaborator Author

What does "browser initiated" mean compared to "renderer initiated" with or without a user gesture?

@kjmcnee
Copy link
Collaborator

kjmcnee commented Jun 24, 2020

Browser initiated refers to things like entering something in the address bar, using the browsers back/forward buttons, bookmarks, etc. Essentially, methods of navigation that the user agent offers the user that aren't driven by the web content.

@jakearchibald
Copy link
Collaborator Author

Cheers. In terms of navigations driven by web content, is it always "last wins", regardless of whether there was a user gesture or not?

@bokand
Copy link
Contributor

bokand commented Jul 3, 2020

Something I learned in a past life - there's some nuance in "browser initiated" that probably doesn't line up with intuition. For example, in Chrome, a history navigation is considered "browser initiated" even if it's initiated from script (e.g. history.back()) without a user gesture. We'd probably want to spell this out more explicitly.

I do recall seeing code in Chrome's navigation bits that gave allowed browser-initiated navigations to clobber non-browser-initiated ones but I'm not sure how much of this is standardized - @jakearchibald you mentioned the HTML spec saying this, can you link to it? I'm curious what the specs have to say here.

Is there any reason to treat portal activation differently from a regular navigation in these cases?

@kjmcnee
Copy link
Collaborator

kjmcnee commented Jul 3, 2020

Even though session history navigations initiated by script are considered browser initiated, the requests are still subject to being ignored in chromium: https://source.chromium.org/chromium/chromium/src/+/master:content/browser/web_contents/web_contents_impl.cc;drc=3abb32da2944ffe178dd66f404e7e1bb88a58ed0;l=4951

But that's good to point out, since I would imagine this means that a page couldn't cancel its own call to |history.back()| with another navigation without a user gesture, though I haven't tested this.

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