diff options
Diffstat (limited to 'testing/web-platform/tests/html/browsers/history/the-history-interface/iframe_history_go_0.html')
-rw-r--r-- | testing/web-platform/tests/html/browsers/history/the-history-interface/iframe_history_go_0.html | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/history/the-history-interface/iframe_history_go_0.html b/testing/web-platform/tests/html/browsers/history/the-history-interface/iframe_history_go_0.html new file mode 100644 index 0000000000..f93f4c864e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/history/the-history-interface/iframe_history_go_0.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<head> + <title>iframe_history_go_0</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> +<body> +<iframe></iframe> +<script> +promise_test(async (t) => { + let iframe = null; + const OLD_URL = 'blank-old.html'; + const NEW_URL = 'blank-new.html'; + + await new Promise(resolve => { + iframe = document.createElement('iframe'); + iframe.onload = () => resolve(); + iframe.src = OLD_URL; + document.body.appendChild(iframe); + t.add_cleanup(() => iframe.remove()); + }); + + assert_equals(iframe.contentDocument.body.textContent, 'This is an old page.\n'); + + await new Promise(resolve => { + iframe.onload = () => resolve(); + iframe.src = NEW_URL; + }); + + assert_equals(iframe.contentDocument.body.textContent, 'This is a new page.\n'); + + await new Promise(resolve => { + iframe.onload = () => resolve(); + iframe.contentWindow.history.go(0); + }); + + assert_equals(iframe.contentDocument.body.textContent, 'This is a new page.\n'); +}, 'iframe\'s history.go(0) performs a location.reload()'); +</script> +</body> |