Add location.reload() document state test #39878
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 testthat asserts the same for the document repopulation case.
The HTML Standard specifies the behavior of
location.reload()
topreserve 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 theReferer
header should remain the sameas the original navigation.
Chromium currently fails this test, per
whatwg/html#6813 (comment) and
the code pointer described by that comment.
R=[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}