diff --git a/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js b/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js
index e34846a3d389f2..c126da48b85ee1 100644
--- a/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js
+++ b/html/infrastructure/urls/resolving-urls/query-encoding/resources/resolve-url.js
@@ -407,6 +407,7 @@ 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);
@@ -414,10 +415,13 @@ onload = 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);
}