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

Test history.push/replaceState() with no URL + document.open() #28826

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

@domenic
Copy link
Member

@domenic domenic commented May 4, 2021

See whatwg/html#6556.

@wpt-pr-bot wpt-pr-bot added the html label May 4, 2021
@wpt-pr-bot wpt-pr-bot requested review from annevk, foolip, jdm, jgraham and zqzhang May 4, 2021
domenic added a commit to whatwg/html that referenced this issue May 4, 2021
Closes #6556. In particular, reverts document.open() to only update the document's URL, and not the session history entry's URL, like it did before ae7cf0c. Now that they can mismatch, we need to audit the cases where this might be important, which leads to the following changes:

* Changes location.reload() to reload the current session history entry's URL, instead of the document's URL. This ensures that post-document.open() reload behavior is aligned with WebKit and Gecko, as tested by https://wpt.fyi/results/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/reload.window.html.

* Changes history.pushState()/history.replaceState() with no URL argument to default to the document's URL, instead of the current session history's URL. This ensures that post-document.open() pushState()/replaceState() behavior is aligned with all engines, as tested by web-platform-tests/wpt#28826.

This also modernizes and makes a bit more precise the location.reload() method steps. The user-initiated reload steps remain vague; #6600 will tackle those.
annevk
annevk approved these changes May 5, 2021
frame.contentDocument.open();
assert_equals(frame.contentDocument.URL, document.URL, "Precondition: the URL gets changed");

frame.contentWindow.history.pushState(null, "");
Copy link
Member

@annevk annevk May 5, 2021

It took me a long time to realize that this passes null as URL. (I should maybe have read the commit message first.)

So the idea is that the fallback for pushState() is the document's URL.

Copy link
Member Author

@domenic domenic May 5, 2021

To be clear, the third parameter is the URL, and it's not passed at all.

Copy link
Member

@annevk annevk May 5, 2021

Right, but that defaults to null through IDL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants