diff options
Diffstat (limited to 'testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html')
-rw-r--r-- | testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html new file mode 100644 index 0000000000..285f6d7428 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/history-traversal/unset_context_name.html @@ -0,0 +1,32 @@ +<!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> |