-
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
referer / referrer during reloads & history entry repopulations #6813
Comments
Btw, let me know if this stuff is spec'd and I just can't find it. I followed the spec for |
I wonder how referrer policy plays into this... usually its drawn from the fetch client. So imagine something like
When navigating from 1 -> 2 the referrer would be |
I guess we could just set the referrer explicitly and then set the referrer policy to the empty string. Not so bad. |
Yeah, right now I'm allowing the referrer to be a URL or "no-referrer", which are used by fetch. |
Referrer policy is stored in the history entry too. Test:
Firefox and Chrome will omit I'm going continue speccing the Chrome & Firefox behaviour. |
See also w3c/webappsec-fetch-metadata#71. |
It turns out Chromium and WebKit distinguish between user-triggered reloads and other reloads. Test case:
|
@domfarolino is working on some tests for this in web-platform-tests/wpt#36352 . However it's for the repopulation case, not the reload case. |
This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b
This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b
This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b
This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <[email protected]> Auto-Submit: Dominic Farolino <[email protected]> Reviewed-by: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1145759}
This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <[email protected]> Auto-Submit: Dominic Farolino <[email protected]> Reviewed-by: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1145759}
This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <[email protected]> Auto-Submit: Dominic Farolino <[email protected]> Reviewed-by: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1145759}
…t, a=testonly Automatic update from web-platform-tests Add location.reload() document state test This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <[email protected]> Auto-Submit: Dominic Farolino <[email protected]> Reviewed-by: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1145759} -- wpt-commits: d9c2152bab4d2933e38c8df3c95d967c40809f8c wpt-pr: 39878
…t, a=testonly Automatic update from web-platform-tests Add location.reload() document state test This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. [email protected] Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <[email protected]> Auto-Submit: Dominic Farolino <[email protected]> Reviewed-by: Domenic Denicola <[email protected]> Cr-Commit-Position: refs/heads/main@{#1145759} -- wpt-commits: d9c2152bab4d2933e38c8df3c95d967c40809f8c wpt-pr: 39878
…t, a=testonly Automatic update from web-platform-tests Add location.reload() document state test This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. R=domenicchromium.org Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <domenicchromium.org> Auto-Submit: Dominic Farolino <domchromium.org> Reviewed-by: Domenic Denicola <domenicchromium.org> Cr-Commit-Position: refs/heads/main{#1145759} -- wpt-commits: d9c2152bab4d2933e38c8df3c95d967c40809f8c wpt-pr: 39878 UltraBlame original commit: 2342752e35cc28fc870b3576d5d7a22b9f92e7fd
…t, a=testonly Automatic update from web-platform-tests Add location.reload() document state test This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. R=domenicchromium.org Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <domenicchromium.org> Auto-Submit: Dominic Farolino <domchromium.org> Reviewed-by: Domenic Denicola <domenicchromium.org> Cr-Commit-Position: refs/heads/main{#1145759} -- wpt-commits: d9c2152bab4d2933e38c8df3c95d967c40809f8c wpt-pr: 39878 UltraBlame original commit: 2342752e35cc28fc870b3576d5d7a22b9f92e7fd
…t, a=testonly Automatic update from web-platform-tests Add location.reload() document state test This CL is a follow-up to https://crrev.com/c/3936785 and whatwg/html#6813 (comment). It adds a test asserting the document state preservation as described more below, in the `location.reload()` case, alongside a very similar test that asserts the same for the document repopulation case. The HTML Standard specifies the behavior of `location.reload()` to preserve the existing history entry's document state's initiator origin and referrer, as described in: https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-the-history-step:~:text=If%20targetEntry%27s%20document%20is%20null%2C%20or%20targetEntry%27s%20document%20state%27s%20reload%20pending%20is%20true%2C%20then. This means that when a page is navigated to from a cross-origin predecessor, and then `location.reload()`s itself, `Sec-Fetch-Site` should be `cross-site` and the `Referer` header should remain the same as the original navigation. Chromium currently fails this test, per whatwg/html#6813 (comment) and the code pointer described by that comment. R=domenicchromium.org Bug: N/A Change-Id: I868ac9fad7e63df251d6c4b0d0ac8b099b81d25b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4504799 Commit-Queue: Domenic Denicola <domenicchromium.org> Auto-Submit: Dominic Farolino <domchromium.org> Reviewed-by: Domenic Denicola <domenicchromium.org> Cr-Commit-Position: refs/heads/main{#1145759} -- wpt-commits: d9c2152bab4d2933e38c8df3c95d967c40809f8c wpt-pr: 39878 UltraBlame original commit: 2342752e35cc28fc870b3576d5d7a22b9f92e7fd
History entry repopulations: When you traverse to a history entry that doesn't have a document, so it needs refetching.
I've been testing using https://redirect-session-history.glitch.me, and it seems like, when reloading a page or traversing back to a page, browsers will send the same
referer
that was originally used for the first fetch of the page.That includes cases like:
//origin-1/a
//origin-1/b
(so referrer is//origin-1/a
)//origin-1/c
//origin-1/c
will have a referrer of//origin-1/a
.One minor browser difference:
//origin-1/a
//origin-1/b
(so referrer is//origin-1/a
)//totally-different-origin/foo
, which redirects back to//origin-1/c
In this case Chrome and Firefox simplify the referrer to
//origin-1/
(with the full origin of course), whereas Safari uses the full referrer//origin-1/a
.My plan is to spec the Chrome & Firefox behaviour by storing the referrer along with the "document state". The document state is the state needed to recreate a document, and is shared between multiple session history entries (entries that will share a document).
The text was updated successfully, but these errors were encountered: