-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
location.reload() should preserve the initiator of the navigation #4852
Comments
Tentative WPT tests: https://chromium-review.googlesource.com/c/chromium/src/+/1707255 |
It seems this also affects the |
cc @bzbarsky |
Fwiw, I'm pretty sure that whether reload via browser UI preserves the initiator is very browser-dependent, and So if we think that the "source browsing context" concept really needs to be propagated through history, we need changes to more than just As far as I am also pretty sure that in Gecko session history stores all sorts of state that can get used if there's a load triggered from history, via either |
/CC @mikewest, @arturjanc, @csreis Thank you @bzbarsky for pointing out the current spec and browser situation:
After reading the above I think that maybe I messed up by landing https://chromium-review.googlesource.com/c/chromium/src/+/1662738 without consulting the specs :-(. After this CL Chrome behaves in the following way:
For completeness, let me note that the initiator is not yet preserved by Chrome:
I see now that the behavior I've landed might be incompatible with the specs:
FWIW, I still think that preserving the initiator is desirable for Sec-Fetch-Site and SameSite behavior during history navigations and during reload. |
Right, so to be clear I don't know that browsers follow the spec that much in general around the initiator bit (e.g. Gecko has no such concept at all!) and it's not clear that the initiator and source browsing context bits in the spec are correct. More, it's pretty clear they are not correct in general, because they go through the browsing context to get at a document, which may not be the document "responsible" for the navigation to start with in some cases.... Gecko does serialize and deserialize referrer information in its session history across session restore. I'm not sure what bits affect the SameSite cookie behavior, so I don't know offhand how those behave in Gecko. I think we're in violent agreement that spec changes are needed here. ;) |
Current spec asks
location.reload()
to clobber initiatorhttps://html.spec.whatwg.org/multipage/history.html#dom-location-reload currently says "The source browsing context must be the browsing context being navigated"
https://html.spec.whatwg.org/multipage/browsing-the-web.html#source-browsing-context says "Navigation always involves source browsing context, which is the browsing context which was responsible for starting the navigation".
Problems caused by current spec / behavior
This behavior is responsible for the following security-related problems:
Proposal
I propose that
location.reload()
should preserve the initiator (just like reloading via browser UI and just like history.back()).The text was updated successfully, but these errors were encountered: