diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents')
70 files changed, 924 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001.html new file mode 100644 index 000000000..1ef88d3cc --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/001.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.open in unload</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var win; + +t.step(function() { + win = window.open("support/001-1.html"); +}); + +add_completion_callback(function() {win.close()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002.html new file mode 100644 index 000000000..a4e0b243e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/002.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.open in unload</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var win; + +t.step(function() { + win = window.open("support/002-1.html"); +}); + +add_completion_callback(function() {win.close()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003.html new file mode 100644 index 000000000..d0a19e0dd --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/003.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.open in beforeunload with link</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var win; + +t.step(function() { + win = window.open("support/003-1.html"); +}); + +add_completion_callback(function() {win.close()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004.html new file mode 100644 index 000000000..fca926f65 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/004.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.open in beforeunload with button</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var win; + +t.step(function() { + win = window.open("support/004-1.html"); +}); + +add_completion_callback(function() {win.close()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005.html new file mode 100644 index 000000000..c215fb88e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/005.html @@ -0,0 +1,15 @@ +<!doctype html> +<title>document.open in pagehide in iframe</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var win; + +t.step(function() { + win = window.open("support/005-1.html"); +}); + +add_completion_callback(function() {win.close()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/MANIFEST new file mode 100644 index 000000000..f77806795 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/MANIFEST @@ -0,0 +1,33 @@ +support 001-1.html +support 001a.html +support 001b.html +001.html +support 002-1.html +support 002a.html +support 002b.html +002.html +support 003-1.html +support 003a.html +support 003b.html +003.html +support 004-1.html +support 004a.html +support 004b.html +004.html +support 005-1.html +support 005a.html +support 005b.html +005.html +base.html +support beforeunload-on-history-back-1.html +beforeunload-on-history-back.html +support beforeunload-on-navigation-of-parent-1.html +support beforeunload-on-navigation-of-parent-2.html +beforeunload-on-navigation-of-parent.html +support navigation-within-beforeunload-1.html +support navigation-within-beforeunload-2.html +navigation-within-beforeunload.html +support pagehide-on-history-forward-1.html +pagehide-on-history-forward.html +dir prompt +dir unload diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/base.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/base.html new file mode 100644 index 000000000..70c07cba4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/base.html @@ -0,0 +1,14 @@ +<!doctype html> +Base +<script> +onpagehide = function() { + if(top.base_hide) { + top.base_hide(); + } +} +onpageshow = function() { +if (top.base_show) { + top.base_show(); +} +} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html new file mode 100644 index 000000000..4403cfa8e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back-1.html @@ -0,0 +1,5 @@ +<!doctype html> +001-1 +<script> +addEventListener("beforeunload", function() {top.t.step(function() {top.beforeunload_fired = true})}, false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back.html new file mode 100644 index 000000000..5b0415c42 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-history-back.html @@ -0,0 +1,31 @@ +<!doctype html> +<title>beforeunload event fires on history navigation back</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +beforeunload_fired = false; +var t = async_test(); + +var base_count = 0; + +onload = function() {setTimeout(t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0] + iframe.onload = t.step_func(function() { + iframe.onload = null; + history.go(-1); + }); + + iframe.src = "beforeunload-on-history-back-1.html"; +}), 100)}; + +base_show = t.step_func(function() { + base_count++; + if (base_count > 1) { + assert_true(beforeunload_fired); + t.done(); + } +}); + +</script> +<iframe src="base.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-1.html new file mode 100644 index 000000000..4f239dad1 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-1.html @@ -0,0 +1,2 @@ +<!doctype html> +<iframe src="beforeunload-on-navigation-of-parent-2.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html new file mode 100644 index 000000000..a34b182e7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent-2.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +addEventListener("beforeunload", function() {parent.parent.beforeunload_fired=true}, false) +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html new file mode 100644 index 000000000..96d49567f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/beforeunload-on-navigation-of-parent.html @@ -0,0 +1,31 @@ +<!doctype html> +<title>beforeunload in iframe on navigation of parent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +beforeunload_fired = false; +var t = async_test(); + +var base_count = 0; + +onload = function() {setTimeout(t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0] + iframe.onload = t.step_func(function() { + iframe.onload = null; + history.go(-1); + }); + + iframe.src = "beforeunload-on-navigation-of-parent-1.html"; +}), 100)}; + +base_show = t.step_func(function() { + base_count++; + if (base_count > 1) { + assert_true(beforeunload_fired); + t.done(); + } +}); + +</script> +<iframe src="base.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/contains.json b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/contains.json new file mode 100644 index 000000000..4ebca09bf --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/contains.json @@ -0,0 +1,6 @@ +[ + { + "id": "event-definition", + "original_id": "event-definition" + } +]
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html new file mode 100644 index 000000000..b96234fba --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-1.html @@ -0,0 +1,10 @@ +<!doctype html> +004-1 +<script> +addEventListener("beforeunload", +function() { +if (top.counter++ < 999) { + location = "navigation-within-beforeunload-2.html?" + top.counter; +} +}, false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-2.html new file mode 100644 index 000000000..2dceaa6d6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload-2.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +document.write(location) +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html new file mode 100644 index 000000000..d7131b00d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/navigation-within-beforeunload.html @@ -0,0 +1,26 @@ +<!doctype html> +<title>Triggering navigation from within beforeunload event</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +beforeunload_fired = false; +var t = async_test(); + +var base_count = 0; +var counter = 0; + +onload = function() {setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0] + + iframe.onload = function() { + setTimeout(function() {iframe.contentWindow.location="navigation-within-beforeunload-2.html";}, 100); + iframe.onload = t.step_func(function() {assert_equals(counter, 1000); t.done()}); + }; + + iframe.src = "navigation-within-beforeunload-1.html?" + Math.random(); + +}, 100)}; + +</script> +<iframe src="base.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward-1.html new file mode 100644 index 000000000..a60c20ed8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward-1.html @@ -0,0 +1,2 @@ +<!doctype html> +filler text diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html new file mode 100644 index 000000000..5e64b5ec6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/pagehide-on-history-forward.html @@ -0,0 +1,19 @@ +<!doctype html> +<title>pagehide event fires on history navigation forward</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); + +onload = function() {setTimeout(t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0] + + iframe.src = "pagehide-on-history-forward-1.html"; +}), 100)}; + +base_hide = t.step_func(function() { + t.done() +}); +</script> +<iframe src="base.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-1.html new file mode 100644 index 000000000..b68afc49e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-1.html @@ -0,0 +1,10 @@ +<script> +addEventListener("beforeunload", +function() { + parent.events.push("beforeunload"); +}, false); +parent.events.push("before src change"); + +location.href = "001-2.html&pipe=trickle(d2)"; +parent.events.push("after src change"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-2.html new file mode 100644 index 000000000..9da0f9395 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001-2.html @@ -0,0 +1 @@ +001-2 diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001.html new file mode 100644 index 000000000..109dcc139 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/001.html @@ -0,0 +1,14 @@ +<!doctype html> +<title>beforeunload event order</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +events = []; +onload = t.step_func(function() { + assert_array_equals(events, ["before src change", "beforeunload", "after src change"]); + t.done(); +}) +</script> +<iframe src="001-1.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002-1.html new file mode 100644 index 000000000..c5f57375d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002-1.html @@ -0,0 +1,7 @@ +<script> +addEventListsner("beforeunload", parent.t.step_func( +function(e) { + parent.do_test(e); +}, false); +location.href = "001-2.html&pipe=trickle(d2)"; +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002.html new file mode 100644 index 000000000..d8f4fc60a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/002.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>beforeunload event properties</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); + +function do_test(e) { + assert_equals(e.type, "beforeunload"); + assert_false(e.bubbles, "bubbles"); + assert_true(e.cancelable, "bubbles"); + assert_equals(e.returnValue, ""); +} + +onload = t.step_func(function() { + t.done(); +}) +</script> +<iframe src="001-1.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/003.html new file mode 100644 index 000000000..5683f1b12 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/003.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>beforeunload event in child frame for parent navigation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); + +function do_test(e) { + assert_equals(e.type, "beforeunload"); + assert_false(e.bubbles, "bubbles"); + assert_true(e.cancelable, "bubbles"); + assert_equals(e.returnValue, ""); +} + +onload = t.step_func(function() { + t.done(); +}) +</script> +<iframe src="001-1.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/MANIFEST new file mode 100644 index 000000000..8d93279a4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/MANIFEST @@ -0,0 +1,14 @@ +support 001-1.html +support 001-2.html +001.html +support 002-1.html +002.html +003.html +manual manual-001.html +manual manual-002.html +manual manual-003.html +manual manual-004.html +manual manual-005.html +manual manual-006.html +support next.html +support slice-and-dice.php diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-001.html new file mode 100644 index 000000000..3b7ef74b7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-001.html @@ -0,0 +1,9 @@ +<!doctype html> +<title>Prompt when beforeunload is canceled</title> +<script> +addEventListener("beforeunload", +function(e) {e.preventDefault()}, +false); +</script> +<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p> +<a href="next.html">Click here</a> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-002.html new file mode 100644 index 000000000..7be8a3301 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-002.html @@ -0,0 +1,9 @@ +<!doctype html> +<title>Prompt when beforeunload has returnValue set</title> +<script> +addEventListener("beforeunload", +function(e) {e.returnValue = "PASS if you see this"}, +false); +</script> +<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p> +<a href="next.html">Click here</a> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-003.html new file mode 100644 index 000000000..ff72b6705 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-003.html @@ -0,0 +1,11 @@ +<!doctype html> +<title>Prompt when beforeunload is canceled</title> +<script> +addEventListener("beforeunload", +function(e) {e.preventDefault()}, +false); +</script> +<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p> +<form method="get" action="next.html"> +<input type="submit" value="Click here"> +</form> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-004.html new file mode 100644 index 000000000..a4d296892 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-004.html @@ -0,0 +1,11 @@ +<!doctype html> +<title>Prompt on form submit</title> +<script> +addEventListener("beforeunload", +function(e) {e.preventDefault()}, +false); +</script> +<p>When clicking the button below, you should get a prompt asking if you want to unload the document</p> +<form method="get" action="next.html"> +<input type="submit" value="Click here"> +</form> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-005.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-005.html new file mode 100644 index 000000000..71ff0a241 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-005.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>Event loop pause for beforeunload</title> +<script> +var counter = 0; + +onload = function count() { + document.getElementById("log").textContent = counter++ + setTimeout(count, 200); +} + +addEventListener("beforeunload", +function(e) { + e.preventDefault() +}, +false); +</script> +<ul> +<li>Click on the link below. When the prompt appears the counter at the bottom must stop incrementing. +<li>Opt not to leave the page. The counter must start incrementing again +</ul> +<p><a href="">Click here</a> +<div id="log"></div> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-006.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-006.html new file mode 100644 index 000000000..dae0340ad --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/manual-006.html @@ -0,0 +1,9 @@ +<!doctype html> +<title>Prompt when beforeunload returns string value</title> +<script> +addEventListener("beforeunload", +function(e) {return "PASS if you see this"}, +false); +</script> +<p>When clicking the link below, you should get a prompt asking if you want to unload the document</p> +<a href="next.html">Click here</a> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/next.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/next.html new file mode 100644 index 000000000..38e7cdd5e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/prompt/next.html @@ -0,0 +1,2 @@ +<!doctype html> +<p>You should have seen a prompt asking you to unload the previous document diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html new file mode 100644 index 000000000..72f41ae3e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001-1.html @@ -0,0 +1,23 @@ +<!DOCTYPE HTML> +<script> + t = opener.t; + do_test = t.step(function () { + localStorage.test6564729 += '4'; + var d = document; + var e = document.open(); // has no effect (ignore-opens-during-unload > 0) + localStorage.test6564729 += (e == d) ? '5' : 'A [' + e + '] '; + document.write('FAIL - document.write executed and blocked navigation!'); // has no effect (ignore-opens-during-unload > 0) + localStorage.test6564729 += document.body.textContent.match('FAIL') ? 'B' : '6'; + document.close(); // has no effect (no script-created parser) + localStorage.test6564729 += '7'; + }) +onload = t.step_func(function() { + localStorage.test6564729 = '0'; + setTimeout(t.step_func(function() {document.links[0].click()})); +}); +</script> +<body onbeforeunload="localStorage.test6564729 += '1'" + onpagehide="localStorage.test6564729 += '3'" + onunload="do_test()"> +<p><a href="001a.html">Follow this link to run the test.</a> +<p><iframe src="001b.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html new file mode 100644 index 000000000..36d4188b9 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001a.html @@ -0,0 +1,7 @@ +<!DOCTYPE HTML> +<script> +opener.t.step(function() { + opener.assert_equals(localStorage.test6564729, '0123456789'); + opener.t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html new file mode 100644 index 000000000..eaafc371a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/001b.html @@ -0,0 +1,5 @@ +<!DOCTYPE HTML> +<body onbeforeunload="localStorage.test6564729 += '2'" + onpagehide="localStorage.test6564729 += '8'" + onunload="localStorage.test6564729 += '9'"> +<p>Inner frame
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html new file mode 100644 index 000000000..0e6f7d967 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002-1.html @@ -0,0 +1,28 @@ +<!DOCTYPE HTML> +<script> + var t = opener.t; + + var do_test = t.step_func(function() { + localStorage.test6564729 += '1'; + var d = document; + var e = document.open(); // unload triggered here - beforeunload 2, 3 in 002b; pagehide 4, unload 5, pagehide 6 in 002b, unload 7 in 002b + localStorage.test6564729 += (e == d) ? '8' : 'X'; + var s = 'FAIL if you see this | ' + localStorage.test6564729; + document.write(s); + localStorage.test6564729 += document.body.textContent == s ? '9' : 'x'; + document.close(); + localStorage.test6564729 += 'Z'; + document.body.textContent += ' // ' + localStorage.test6564729; + location = '002a.html'; // unload triggers again here, but they're not registered event listeners any more + }); + +onload = t.step_func(function() { + localStorage.test6564729 = '0'; + setTimeout(function() {document.getElementsByTagName("input")[0].click()}, 100); +}); +</script> +<body onbeforeunload="localStorage.test6564729 += '2'" + onpagehide="localStorage.test6564729 += '4'" + onunload="localStorage.test6564729 += '5'"> +<input type=button value="Activate this button to run the test" onclick="do_test()"> +<p><iframe src="002b.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html new file mode 100644 index 000000000..d11f67086 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002a.html @@ -0,0 +1,7 @@ +<!DOCTYPE HTML> +<script> + opener.t.step(function() { + opener.assert_equals(localStorage.test6564729, '0123456789Z'); + opener.t.done(); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html new file mode 100644 index 000000000..d08a7a8ad --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/002b.html @@ -0,0 +1,5 @@ +<!DOCTYPE HTML> +<body onbeforeunload="localStorage.test6564729 += '3'" + onpagehide="localStorage.test6564729 += '6'" + onunload="localStorage.test6564729 += '7'"> +<p>Inner frame
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html new file mode 100644 index 000000000..b3a4754b8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003-1.html @@ -0,0 +1,23 @@ +<!DOCTYPE HTML> +<script> + var t = opener.t; + var do_test = t.step_func(function() { + localStorage.test6564729 += '1'; + var d = document; + var e = document.open(); // has no effect (ignore-opens-during-unload > 0 because we're in beforeunload) + localStorage.test6564729 += (e == d) ? '2' : 'A [' + e + '] '; + document.write('FAIL - document.write executed and blocked navigation!'); // has no effect (ignore-opens-during-unload > 0) + localStorage.test6564729 += document.body.textContent.match('FAIL') ? 'B' : '3'; + document.close(); // has no effect (no script-created parser) + localStorage.test6564729 += '4'; + }) + + onload=t.step_func(function() {localStorage.test6564729 = '0'; setTimeout(t.step_func(function() {document.links[0].click()}), 100)}) + +</script> +<body + onbeforeunload="do_test()" + onpagehide="localStorage.test6564729 += '6'" + onunload="localStorage.test6564729 += '7'"> +<p><a href="003a.html">Follow this link to run the test.</a> +<p><iframe src="003b.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html new file mode 100644 index 000000000..5393fa221 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003a.html @@ -0,0 +1,8 @@ +<!DOCTYPE HTML> +<p>FAIL</p> +<script> +opener.t.step(function() { + opener.assert_equals(localStorage.test6564729, '0123456789') + opener.t.done(); +}) +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html new file mode 100644 index 000000000..c8f1917b8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/003b.html @@ -0,0 +1,5 @@ +<!DOCTYPE HTML> +<body onbeforeunload="localStorage.test6564729 += '5'" + onpagehide="localStorage.test6564729 += '8'" + onunload="localStorage.test6564729 += '9'"> +<p>Inner frame
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html new file mode 100644 index 000000000..06aba08af --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004-1.html @@ -0,0 +1,25 @@ +<!DOCTYPE HTML> +<script> + var t = opener.t; + var do_test = t.step_func(function() { + localStorage.test6564729 += 'B'; + var d = document; + var e = document.open(); // unload triggered here - beforeunload C, D in 004b; pagehide E, unload F, pagehide G in 004b, unload HIJK in 004b + localStorage.test6564729 += (e == d) ? 'L' : 'Y'; + var s = 'FAIL if you see this | ' + localStorage.test6564729; + document.write(s); + localStorage.test6564729 += document.body.textContent == s ? 'M' : 'y'; + document.close(); + localStorage.test6564729 += 'N'; + location = '004a.html'; // unload triggers again here, but they're not registered event listeners any more + }) +onload = t.step_func(function() { + localStorage.test6564729 = 'A'; + setTimeout(t.step_func(function() {document.getElementsByTagName("input")[0].click()}), 100); +}) +</script> +<body onbeforeunload="localStorage.test6564729 += 'C'" + onpagehide="localStorage.test6564729 += 'E'" + onunload="localStorage.test6564729 += 'F'"> +<input type=button value="Activate this button to run the test" onclick="do_test()"> +<p><iframe src="004b.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html new file mode 100644 index 000000000..117e2b94a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004a.html @@ -0,0 +1,8 @@ +<!DOCTYPE HTML> +<p>FAIL</p> +<script> +opener.t.step(function() { + opener.assert_equals(localStorage.test6564729, 'ABCDEFGHIJKLMN'); + opener.t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html new file mode 100644 index 000000000..788937a0b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/004b.html @@ -0,0 +1,18 @@ +<!DOCTYPE HTML> +<script> + function testRun() { + localStorage.test6564729 += 'H'; + var d = parent.document; + var e = parent.document.open(); // no effect, since that document is already in unload + localStorage.test6564729 += (e == d) ? 'I' : 'X'; + var s = 'FAIL'; + document.write(s); + localStorage.test6564729 += document.body.textContent == s ? 'x' : 'J'; + document.close(); + localStorage.test6564729 += 'K'; + } +</script> +<body onbeforeunload="localStorage.test6564729 += 'D'" + onpagehide="localStorage.test6564729 += 'G'" + onunload="testRun()"> +<p>Inner frame
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html new file mode 100644 index 000000000..7b81a9f11 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005-1.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML> +<script> +onload = opener.t.step_func(function() { + localStorage.test6564729 = '0' + setTimeout(opener.t.step_func(function() {document.links[0].click()}), 100); +}); +</script> +<body + onbeforeunload="localStorage.test6564729 += '1'" + onpagehide="localStorage.test6564729 += '3'" + onunload="localStorage.test6564729 += '4'"> +<p><a href="005a.html">Follow this link to run the test.</a> +<p><iframe src="005b.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html new file mode 100644 index 000000000..5185d3b92 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005a.html @@ -0,0 +1,8 @@ +<!DOCTYPE HTML> +<p>FAIL</p> +<script> +opener.t.step(function() { + opener.assert_equals(localStorage.test6564729, '012345678') + opener.t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html new file mode 100644 index 000000000..476e8e38c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/support/005b.html @@ -0,0 +1,17 @@ +<!DOCTYPE HTML> +<script> + var t = parent.opener.t; + var do_test = t.step_func(function () { + localStorage.test6564729 += '5'; + var s = 'FAIL: document.open() has canceled the navigation (' + localStorage.test6564729 + ')'; + parent.document.open(); + parent.document.write(s); + parent.document.close(); + localStorage.test6564729 += parent.document.body.textContent.match('FAIL') == s ? 'X' : '6'; + localStorage.test6564729 += '7'; + }); +</script> +<body onbeforeunload="localStorage.test6564729 += '2'" + onpagehide="do_test()" + onunload="localStorage.test6564729 += '8'"> +<p>Inner frame diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-1.html new file mode 100644 index 000000000..74ba43954 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-1.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +addEventListener("pagehide", parent.t.step_func(function() {parent.pagehide_fired = true}), false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-2.html new file mode 100644 index 000000000..90e28ab7f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001-2.html @@ -0,0 +1,2 @@ +<!doctype html> +Filler diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001.html new file mode 100644 index 000000000..444a2770c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/001.html @@ -0,0 +1,25 @@ +<!doctype html> +<title>pagehide event on unload</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +pagehide_fired = false; +var t = async_test(); + +onload = function() {setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0] + + iframe.onload = function() { + setTimeout(function() { + iframe.contentWindow.location="001-2.html"; + }, 100); + iframe.onload = t.step_func(function() {assert_true(pagehide_fired); t.done()}); + }; + + iframe.src = "001-1.html?" + Math.random(); + +}, 100)}; + +</script> +<iframe></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002-1.html new file mode 100644 index 000000000..fd8e2b726 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002-1.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +addEventListener("pagehide", parent.t.step_func(parent.do_test()), false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002.html new file mode 100644 index 000000000..3fb07e484 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/002.html @@ -0,0 +1,33 @@ +<!doctype html> +<title>pagehide event properties</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); + +onload = function() {setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0] + + iframe.onload = function() { + setTimeout(function() { + iframe.contentWindow.location="001-2.html"; + }, 100); + iframe.onload = t.step_func(function() {t.done()}); + }; + + function do_test(e) { + assert_equals(e.type, "pagehide"); + assert_equals(e.target, iframe.contentDocument); + assert_equals(e.currentTarget, iframe.contentWindow); + assert_false(e.bubbles, "bubbles"); + assert_false(e.cancelable, "cancelable"); + assert_true(e.persisted, "persisted"); + } + + iframe.src = "002-1.html?" + Math.random(); + +}, 100)}; + +</script> +<iframe></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003-1.html new file mode 100644 index 000000000..9838c7945 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003-1.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +addEventListener("unload", parent.t.step_func(function(e) {parent.do_test(e)}), false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003.html new file mode 100644 index 000000000..97821be48 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/003.html @@ -0,0 +1,33 @@ +<!doctype html> +<title>unload event properties</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var do_test; + +onload = function() {setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0] + + iframe.onload = function() { + setTimeout(function() { + iframe.contentWindow.location="002-2.html"; + }, 100); + iframe.onload = t.step_func(function() {t.done()}); + }; + + do_test = function(e) { + assert_equals(e.type, "unload"); + assert_equals(e.target, iframe.contentDocument); + assert_equals(e.currentTarget, iframe.contentWindow); + assert_false(e.bubbles, "bubbles"); + assert_false(e.cancelable, "cancelable"); + } + + iframe.src = "003-1.html?" + Math.random(); + +}, 100)}; + +</script> +<iframe></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004-1.html new file mode 100644 index 000000000..5d0497556 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004-1.html @@ -0,0 +1,5 @@ +<!doctype html> +<script> +addEventListener("pagehide", function() {parent.events.push("pagehide"); setTimeout(function() {parent.events.push("timeout")}, 0)}, false); +addEventListener("unload", function() {parent.events.push("unload")}, false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004.html new file mode 100644 index 000000000..301baa3b8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/004.html @@ -0,0 +1,28 @@ +<!doctype html> +<title>pagehide / unload event order</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); + +var events = []; + +onload = function() {setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0] + + iframe.onload = function() { + setTimeout(function() { + iframe.contentWindow.location="001-2.html"; + }, 100); + iframe.onload = t.step_func(function() { + assert_array_equals(events, ["pagehide", "unload"]) + t.done()}); + }; + + iframe.src = "004-1.html?" + Math.random(); + +}, 100)}; + +</script> +<iframe></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-1.html new file mode 100644 index 000000000..8d2659623 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-1.html @@ -0,0 +1,20 @@ +<!doctype html> +006-1 +<script> +onpagehide = function() { + onpagehide = null; + setTimeout(function() { + parent.t.done() + }, 1000); +} +onload = function() { + if (!parent.loaded) { + parent.loaded = true; + setTimeout(parent.t.step_func( + function() { + location="006-2.html?" + Math.random(); + } + ), 100); + } +} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-2.html new file mode 100644 index 000000000..52365e55d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006-2.html @@ -0,0 +1,5 @@ +<!doctype html> +006-2 +<script> +onload = function() {setTimeout(parent.t.step_func(function() {history.go(-1)}), 100)} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006.html new file mode 100644 index 000000000..c9e4d68a1 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/006.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>salvagable state of document after setting pagehide listener</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); + +var loaded = false; + +onload = function() {setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0] + onload = null; + iframe.src="006-1.html?" + Math.random(); +}, 100)}; + +</script> +<iframe></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-1.html new file mode 100644 index 000000000..ed19f4498 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-1.html @@ -0,0 +1,21 @@ +<!doctype html> +007-1 +<script> +onunload = function() { + onunload = null; + parent.unload_fired = true; + setTimeout(function() { + parent.timeout_fired = true; + }, 100); +} +onload = function() { + if (!parent.loaded) { + parent.loaded = true; + setTimeout(parent.t.step_func( + function() { + location="007-2.html?" + Math.random(); + } + ), 100); + } +} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-2.html new file mode 100644 index 000000000..f74cd1e67 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007-2.html @@ -0,0 +1,5 @@ +<!doctype html> +007-2 +<script> +onload = function() {setTimeout(parent.t.step_func(function() {parent.start_test(); history.go(-1)}), 100)} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html new file mode 100644 index 000000000..0d5b72e0f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html @@ -0,0 +1,28 @@ +<!doctype html> +<title>salvagable state of document after setting unload listener</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(undefined, {timeout:2000}); + +var loaded = false; +var unload_fired = false; +var timeout_fired = false; + +function start_test() { + setTimeout(t.step_func(function() { + assert_true(unload_fired); + assert_false(timeout_fired); + t.done() + }), 1000); +} + +onload = function() {setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0] + onload = null; + iframe.src="007-1.html?" + Math.random(); +}, 100)}; + +</script> +<iframe></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008-1.html new file mode 100644 index 000000000..29de29c91 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008-1.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +onpagehide = parent.t.step_func(function() {parent.t.done()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008.html new file mode 100644 index 000000000..015507d81 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/008.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>pagehide IDL attribute</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var iframe; +var t = async_test(); +onload = function() { + setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + iframe.src="about:blank"; + }, 100) +}; +</script> +<iframe src="008-1.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009-1.html new file mode 100644 index 000000000..d69a05914 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009-1.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +onunload = parent.t.step_func(function() {parent.t.done()}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009.html new file mode 100644 index 000000000..0e93e0470 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/009.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>unload IDL attribute</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var iframe; +var t = async_test(); +onload = function() { + setTimeout(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + iframe.src="about:blank"; + }, 100) +} +</script> +<iframe src="009-1.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/MANIFEST new file mode 100644 index 000000000..637d35cf3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/MANIFEST @@ -0,0 +1,21 @@ +support 001-1.html +support 001-2.html +001.html +support 002-1.html +002.html +support 003-1.html +003.html +support 004-1.html +004.html +support 006-1.html +support 006-2.html +006.html +support 007-1.html +support 007-2.html +007.html +support 008-1.html +008.html +support 009-1.html +009.html +manual manual-001-1.html +manual manual-001.html diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001-1.html new file mode 100644 index 000000000..3da0a0de3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001-1.html @@ -0,0 +1,2 @@ +<!doctype html> +<p>Now go back. PASS should be displayed after a short pause diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001.html new file mode 100644 index 000000000..6d817a111 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/unloading-documents/unload/manual-001.html @@ -0,0 +1,5 @@ +<!doctype html> +<title>Document salvagable state after setting pagehide handler</title> +<script>onpagehide = function() {setTimeout(function(){document.body.innerHTML = "PASS"}, 100)}</script> +<p>Click the link below then navigate back to this page. Shortly after returning you should see the text "PASS"</p> +<p><A href="manual-001-1.html">Click here</a> |