Skip to content

Commit

Permalink
HTML: pushState() url resolves against relevant settings object
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Sep 4, 2023
1 parent 2612a05 commit 83a0e8b
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 83a0e8b

Please sign in to comment.