diff options
Diffstat (limited to 'testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_history_go_forward.html')
-rw-r--r-- | testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_history_go_forward.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_history_go_forward.html b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_history_go_forward.html new file mode 100644 index 0000000000..e9d1def099 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/embedded-content/the-iframe-element/iframe_sandbox_navigate_history_go_forward.html @@ -0,0 +1,28 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Check that sandboxed iframe can not navigate their ancestors</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> + var t = async_test(); + var pop_state_count = 0; + onpopstate = t.step_func((e) => { + pop_state_count++; + if (pop_state_count == 1) { + // Should not generate a pop state + frames[0].postMessage('forward', '*'); + t.step_timeout(() => { + t.done(); + }, 1000); + } else if (pop_state_count > 1) { + assert_unreached('no pop state'); + } + }); + + function doNavigation() { + history.pushState( {state: "one past"}, 'page 2', ''); + // Should generate a pop state + history.back(); + } +</script> +<iframe id="child_frame" sandbox="allow-scripts" src="support/iframe-tried-to-be-navigated-by-history.html" onload="doNavigation();"></iframe> |