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 which document history.go(0) reloads #36366

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// META: title=history.go(0) on an iframe must reload the iframe's document, not the parent document
// META: script=/common/dispatcher/dispatcher.js
// META: script=/common/utils.js
// META: script=/html/browsers/browsing-the-web/remote-context-helper/resources/remote-context-helper.js

promise_test(async () => {
const rcHelper = new RemoteContextHelper();
const main = await rcHelper.addWindow();
await main.addIframe();

await main.executeScript(() => {
window.didNotGetReloaded = true;

const iframe = document.querySelector("iframe");

// This goes beyond the original test case in https://github.com/whatwg/html/issues/2436, and
// tests where current realm != relevant realm. The spec says to use relevant realm so the
// result is still, iframe must reload, not parent.
History.prototype.go.call(iframe.contentWindow.history, 0);

return new Promise(resolve => {
iframe.addEventListener("load", resolve);
});
});

assert_true(await main.executeScript(() => window.didNotGetReloaded));
});