Skip to content

Commit

Permalink
Bug 1851436 [wpt PR 41797] - HTML: pushState() url resolves against r…
Browse files Browse the repository at this point in the history
…elevant settings object, a=testonly

Automatic update from web-platform-tests
HTML: pushState() url resolves against relevant settings object

See web-platform-tests/wpt#4934 (comment)

--

wpt-commits: 83a0e8b67f6bb1daf4336060337eee609768a931
wpt-pr: 41797
  • Loading branch information
zcorpan authored and moz-wptsync-bot committed Sep 13, 2023
1 parent 81ca5ee commit 4209463
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,21 @@ onload = function() {
// history.replaceState
function test_history(prop) {
subsetTestByKey('history', async_test, function() {
var url = input_url_html.replace('resources/', '');
var iframe = document.createElement('iframe');
iframe.src = blank;
document.body.appendChild(iframe);
this.add_cleanup(function() {
document.body.removeChild(iframe);
});
iframe.onload = this.step_func_done(function() {
iframe.contentWindow.history[prop](null, null, input_url_html); // this should resolve against the test's URL, not the iframe's URL
// this should resolve against the iframe's URL
// "Parse url, relative to the relevant settings object of history."
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push%2Freplace-state-steps
iframe.contentWindow.history[prop](null, null, url);
var got = iframe.contentWindow.location.href;
assert_true(got.indexOf(expected_current) > -1, msg(expected_current, got));
assert_equals(got.indexOf('/resources/resources/'), -1, 'url was resolved against the iframe\'s URL instead of the settings object\'s API base URL');
assert_not_equals(got.indexOf('/resources/'), -1, 'url was resolved against the test\'s URL');
});
}, 'history.'+prop);
}
Expand Down

0 comments on commit 4209463

Please sign in to comment.