blob: 285f6d7428144e87c22bd4342cfce4ab1c6aa448 [file] [log] [blame]
<!doctype html>
<title>window.name is reset after navigating to a different origin</title>
<meta name="timeout" content="long">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script>
async function pollResultAndCheck(t, id, expected) {
const stashURL = new URL("resources/unset_context_name_stash.py", location);
stashURL.searchParams.set('id', id);
let res = "NONE";
while (res == "NONE") {
await new Promise(resolve => { t.step_timeout(resolve, 100); });
const response = await fetch(stashURL);
res = await response.text();
}
if (res !== expected) {
assert_unreached('Stash result does not equal expected result.')
}
}
promise_test(async t => {
const id = token();
window.open(`resources/unset_context_name-1.sub.html?set=${id}|navigate|report=${id}|close`, "_blank", "noopener");
await pollResultAndCheck(t, id, "");
}, "Window.name is reset after navigating to a different origin");
</script>