diff options
Diffstat (limited to 'testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents')
54 files changed, 710 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-1.html new file mode 100644 index 000000000..df8d884e8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-1.html @@ -0,0 +1,7 @@ +<!doctype html> +001-1 +<script> +addEventListener("unload", function() { + location = location.href.replace("http://", "http://www.").replace(/\d{3}-\d\.html/, "001-3.html"); +}, false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-2.html new file mode 100644 index 000000000..1cffc59b2 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-2.html @@ -0,0 +1,5 @@ +<!doctype html> +001-2 +<script> +parent.postMessage("001-2", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-3.html new file mode 100644 index 000000000..5f1310e07 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001-3.html @@ -0,0 +1,5 @@ +<!doctype html> +001-3.html +<script> +parent.postMessage("001-3", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001.html new file mode 100644 index 000000000..7d99f6beb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/001.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Cross-origin navigation started from unload handler</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="001-1.html"></iframe> +<script> +var t = async_test(); +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + var new_src = iframe.src.replace(/\d{3}-\d\.html/, "001-2.html"); + iframe.src = new_src; +}); + +onmessage = t.step_func(function(e) { + assert_equals(e.data, "001-2"); + t.done(); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-1.html new file mode 100644 index 000000000..716e182ad --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-1.html @@ -0,0 +1,5 @@ +<!doctype html> +002-1 +<script> +parent.postMessage("002-1", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-2.html new file mode 100644 index 000000000..a29a6bbcd --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002-2.html @@ -0,0 +1,5 @@ +<!doctype html> +002-2 +<script> +parent.postMessage("002-2", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002.html new file mode 100644 index 000000000..0efc7016f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/002.html @@ -0,0 +1,23 @@ +<!doctype html> +<title>Multiple simultaneous navigations</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="about:blank"></iframe> +<script> +var t = async_test(); +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + + setTimeout(t.step_func(function() { + iframe.src = "002-1.html?pipe=trickle(d1)"; + setTimeout(t.step_func(function(){iframe.src = "002-2.html"}), 500); + }), 100); +}); + +onmessage = t.step_func(function(e) { + assert_equals(e.data, "002-2"); + t.done(); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-1.html new file mode 100644 index 000000000..4d2229eb5 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-1.html @@ -0,0 +1,7 @@ +<!doctype html> +<script> +onload = function() { + parent.postMessage("003-1", "*"); + setTimeout(function() {location = "003-2.html";}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-2.html new file mode 100644 index 000000000..827a06947 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-2.html @@ -0,0 +1,9 @@ +<!doctype html> +003-2 +<script> +onload = function() { + parent.postMessage("003-2", "*") + setTimeout(function() {history.go(-1)}) +} +onunload = function() {location = "003-3.html"} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-3.html new file mode 100644 index 000000000..8b26c896f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003-3.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +parent.postMessage("003-3", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003.html new file mode 100644 index 000000000..f43715096 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/003.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>Navigation from unload whilst traversing history</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="003-1.html"></iframe> +<script> +var t = async_test(); + +var pages = []; +var iframe = document.getElementsByTagName("iframe")[0]; + + +onmessage = t.step_func(function(e) { + pages.push(e.data); + if(pages.length == 3) { + assert_array_equals(pages, ["003-1", "003-2", "003-1"]); + t.done(); + iframe.parentNode.removeChild(iframe); + } +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-1.html new file mode 100644 index 000000000..02f916fd9 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-1.html @@ -0,0 +1,7 @@ +<!doctype html> +<script> +onload = function() { + parent.postMessage("004-1", "*"); + setTimeout(function() {location = location.href.replace("http://", "http://www.").replace("004-1.html", "004-2.html");}, 100); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-2.html new file mode 100644 index 000000000..f2ef83ee1 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-2.html @@ -0,0 +1,9 @@ +<!doctype html> +003-2 +<script> +onload = function() { + parent.postMessage("004-2", "*") + setTimeout(function() {history.go(-1)}) +} +onunload = function() {location = "004-3.html"} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-3.html new file mode 100644 index 000000000..c98711ae9 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004-3.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +parent.postMessage("004-3", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004.html new file mode 100644 index 000000000..dddde4918 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/004.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>Navigation from unload whilst traversing cross-origin history</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="004-1.html"></iframe> +<script> +var t = async_test(); + +var pages = []; +var iframe = document.getElementsByTagName("iframe")[0]; + + +onmessage = t.step_func(function(e) { + pages.push(e.data); + if(pages.length == 3) { + assert_array_equals(pages, ["004-1", "004-2", "004-1"]); + t.done(); + iframe.parentNode.removeChild(iframe); + } +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/005.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/005.html new file mode 100644 index 000000000..4a044bb25 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/005.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>Link with onclick navigation and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<a target="test" onclick="document.getElementById('test').contentWindow.location='click.html'" href="href.html">Test</a> +<script> +var t = async_test(); +t.step(function() {document.links[0].click()}); +onmessage = t.step_func( + function(e) { + assert_equals(e.data, "href"); + t.done(); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/006.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/006.html new file mode 100644 index 000000000..1e7aa2020 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/006.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Link with onclick form submit and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe name="test"></iframe> +<form target="test" action="click.html"></form> +<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a> +<script> +var t = async_test(); +t.step(function() {document.links[0].click()}); +onmessage = t.step_func( + function(e) { + assert_equals(e.data, "href"); + t.done(); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/007.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/007.html new file mode 100644 index 000000000..d4bcfc290 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/007.html @@ -0,0 +1,16 @@ +<!doctype html> +<title>Link with onclick javascript url and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<a target="test" onclick="document.getElementById('test').contentWindow.location = 'javascript:\'abc<script>parent.postMessage("click", "*")</script>\'';" href="href.html">Test</a> +<script> +var t = async_test(); +t.step(function() {document.getElementsByTagName("a")[0].click()}); +onmessage = t.step_func( + function(e) { + assert_equals(e.data, "href"); + t.done(); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/008.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/008.html new file mode 100644 index 000000000..7d1495a08 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/008.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Link with onclick form submit to javascript url and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<form target="test" action="javascript:'<script>parent.postMessage("click", "*")</script>'"></form> +<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a> +<script> +var t = async_test(); +t.step(function() {document.getElementsByTagName("a")[0].click()}); +onmessage = t.step_func( + function(e) { + assert_equals(e.data, "href"); + t.done(); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/009.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/009.html new file mode 100644 index 000000000..0fcd1d37f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/009.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>Link with onclick form submit to javascript url with document.write and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<form target="test" action="javascript:(function() {document.write('<script>parent.postMessage("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</script>'})()"></form> +<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a> +<script> +var t = async_test(); +var events = []; +t.step(function() { + document.getElementsByTagName("a")[0].click()}); +onmessage = t.step_func( + function(e) { + events.push(e.data); + if (events.length === 2) { + assert_array_equals(events, ["write", "href"]); + t.done(); + } + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/010.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/010.html new file mode 100644 index 000000000..3917cd16e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/010.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Link with onclick form submit to javascript url with delayed document.write and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<form target="test" action="javascript:(function() {var x = new XMLHttpRequest(); x.open('GET', 'blank.html?pipe=trickle(d2)', false); x.send(); document.write('<script>parent.postMessage("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</script>'})()"></form> +<a target="test" onclick="document.forms[0].submit()" href="href.html">Test</a> +<script> +var t = async_test(undefined, {timeout:4000}); +t.step(function() {document.getElementsByTagName("a")[0].click()}); +onmessage = t.step_func( + function(e) { + assert_equals(e.data, "href"); + t.done(); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/011.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/011.html new file mode 100644 index 000000000..fe6b8dbc3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/011.html @@ -0,0 +1,21 @@ +<!doctype html> +<title>Link with onclick navigation to javascript url with document.write and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<a target="test" onclick="javascript:(function() {document.write('<script>parent.postMessage("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</script>'})()" href="href.html">Test</a> +<script> +var t = async_test(); +var events = []; +t.step(function() { + document.getElementsByTagName("a")[0].click()}); +onmessage = t.step_func( + function(e) { + events.push(e.data); + if (events.length === 2) { + assert_array_equals(events, ["write", "href"]); + t.done(); + } + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/012.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/012.html new file mode 100644 index 000000000..be8f2feba --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/012.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Link with onclick navigation to javascript url with delayed document.write and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<!-- XXX: What is this test trying to do? It's navigating the subframe, but + doing a write() to _this_ document, and the "javascript:" in there is + completely a red herring: it's a label, not a protocol. There is no + javascript url involved here, unlike what the title claims! --> +<a target="test" onclick="javascript:(function() {var x = new XMLHttpRequest(); x.open('GET', 'blank.html?pipe=trickle(d2)', false); x.send(); document.write('write<script>parent.postMessage("write", "*")</script>'); return '<script>parent.postMessage("click", "*")</script>'})()" href="href.html">Test</a> +<script> +var t = async_test(undefined, {timeout:4000}); +t.step(function() {document.getElementsByTagName("a")[0].click()}); +onmessage = t.step_func( + function(e) { + assert_equals(e.data, "href"); + t.done(); + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/013.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/013.html new file mode 100644 index 000000000..69ce7bc61 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/013.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Link with onclick navigation to javascript url with delayed document.write and href navigation </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<a target="test" href="javascript:parent.events.push('javascript');">Test</a> +<script> +var t = async_test(undefined, {timeout:4000}); +var events = []; +t.step(function() { + document.getElementsByTagName("a")[0].click(); + events.push('after script'); +}); +onload = t.step_func(function() { + // javascript: executions are async. + assert_array_equals(events, ['after script', 'javascript']); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/014.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/014.html new file mode 100644 index 000000000..605e18185 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/014.html @@ -0,0 +1,21 @@ +<!doctype html> +<title> Link with javascript onclick form submission script order </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<form target="test" action="javascript:parent.events.push('submit');"></form> +<a target="test" onclick="document.forms[0].submit()">Test</a> +<script> +var t = async_test(undefined, {timeout:4000}); +var events = []; +t.step(function() { + document.getElementsByTagName("a")[0].click(); + events.push('after script'); +}); +onload = t.step_func(function() { + // javascript: executions are async. + assert_array_equals(events, ['after script', 'submit']); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/015.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/015.html new file mode 100644 index 000000000..eb54622b7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/015.html @@ -0,0 +1,20 @@ +<!doctype html> +<title> Link with javascript onclick and href script order </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe id="test" name="test"></iframe> +<a target="test" onclick="parent.events.push('click');" href="javascript:parent.events.push('href')">Test</a> +<script> +var t = async_test(undefined, {timeout:4000}); +var events = []; +t.step(function() { + document.getElementsByTagName("a")[0].click(); + events.push('after script'); +}); +onload = t.step_func(function() { + // javascript: executions are async. + assert_array_equals(events, ['click', 'after script', 'href']); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/MANIFEST b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/MANIFEST new file mode 100644 index 000000000..0467aa3b4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/MANIFEST @@ -0,0 +1,42 @@ +support 001-1.html +support 001-2.html +support 001-3.html +http 001.html +support 002-1.html +support 002-2.html +002.html +support 003-1.html +support 003-2.html +support 003-3.html +003.html +support 004-1.html +support 004-2.html +support 004-3.html +004.html +005.html +006.html +007.html +008.html +009.html +010.html +011.html +012.html +013.html +014.html +015.html +support blank.html +support child_navigates_parent_location-1.html +support child_navigates_parent_location-2.html +support child_navigates_parent_location-3.html +child_navigates_parent_location.html +support child_navigates_parent_submit-1.html +support child_navigates_parent_submit-2.html +support child_navigates_parent_submit-3.html +child_navigates_parent_submit.html +support click.html +support href.html +support navigation_unload_data_url-1.html +navigation_unload_data_url.html +support navigation_unload_same_origin-1.html +navigation_unload_same_origin.html +support slice-and-dice.php diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/blank.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/blank.html new file mode 100644 index 000000000..c50eddd41 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/blank.html @@ -0,0 +1 @@ +<!doctype html> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-1.html new file mode 100644 index 000000000..66afcff22 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-1.html @@ -0,0 +1,3 @@ +<!doctype html> +<script>parent.postMessage("initial", "*")</script> +<iframe src="child_navigates_parent_location-2.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-2.html new file mode 100644 index 000000000..746cf4b0f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-2.html @@ -0,0 +1,5 @@ +<!doctype html> +<script> +parent.parent.postMessage("inner", "*"); +parent.location = "child_navigates_parent_location-3.html" +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-3.html new file mode 100644 index 000000000..bb8ba4e69 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location-3.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +parent.postMessage("destination", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location.html new file mode 100644 index 000000000..9111232e2 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_location.html @@ -0,0 +1,17 @@ +<!doctype html> +<title>Child document navigating parent via location </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var events = []; +onmessage = t.step_func(function(e) { + events.push(e.data); + if (events.length == 3) { + assert_array_equals(events, ["initial", "inner", "destination"]); + t.done(); + } +}); +</script> +<iframe src="child_navigates_parent_location-1.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-1.html new file mode 100644 index 000000000..cc8616670 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-1.html @@ -0,0 +1,3 @@ +<!doctype html> +<script>parent.postMessage("initial", "*")</script> +<iframe src="child_navigates_parent_submit-2.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-2.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-2.html new file mode 100644 index 000000000..34e513de9 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-2.html @@ -0,0 +1,6 @@ +<!doctype html> +<form action="child_navigates_parent_submit-3.html" target="_parent"></form> +<script> +parent.parent.postMessage("inner", "*"); +document.forms[0].submit() +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-3.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-3.html new file mode 100644 index 000000000..bb8ba4e69 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit-3.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +parent.postMessage("destination", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html new file mode 100644 index 000000000..d491a26c1 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/child_navigates_parent_submit.html @@ -0,0 +1,18 @@ +<!doctype html> +<title>Child document navigating parent via submit </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +var t = async_test(); +var events = []; +onmessage = t.step_func(function(e) { + events.push(e.data); + if (events.length == 3) { + assert_array_equals(events, ["initial", "inner", "destination"]); + + t.done(); + } +}); +</script> +<iframe src="child_navigates_parent_submit-1.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/click.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/click.html new file mode 100644 index 000000000..8cb03b74d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/click.html @@ -0,0 +1,4 @@ +<!doctype html> +<script> +parent.postMessage("click", "*"); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html new file mode 100644 index 000000000..18a6f84c9 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment.html @@ -0,0 +1,20 @@ +<!doctype html> +<meta charset="utf-8"> +<title>Navigating to the same URL with an empty fragment aborts the navigation</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<iframe src="empty_fragment_iframe.html"></iframe> +<script> +// If the navigation were not aborted, we would expect multiple load events +// as the page continually reloads itself. +async_test(function(t) { + var count = 0; + var iframe = document.querySelector('iframe'); + iframe.onload = t.step_func(function() { + count++; + }); + window.child_succeeded = t.step_func_done(function() { + assert_equals(count, 1); + }); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment_iframe.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment_iframe.html new file mode 100644 index 000000000..26b28a0d7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/empty_fragment_iframe.html @@ -0,0 +1,11 @@ +<script> +var timeout; +onload = function() { + location.hash = ""; + timeout = setTimeout(function() { parent.child_succeeded() }, 2000); +}; + +onbeforeunload = function() { + clearTimeout(timeout); +} +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/href.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/href.html new file mode 100644 index 000000000..eccadadf4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/href.html @@ -0,0 +1,5 @@ +<!doctype html> +<script> +parent.postMessage("href", "*"); +</script> +href diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html new file mode 100644 index 000000000..9c18f109c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-query-fragment-components.html @@ -0,0 +1,28 @@ +<!doctype html> +<title> javascript url with query and fragment components </title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +var a = null; +var b = null; +var c = null; +</script> + +<iframe id="a" src='javascript:"nope" ? "yep" : "what";'></iframe> +<iframe id="b" src='javascript:"wrong"; // # %0a "ok";'></iframe> +<iframe id="c" src='javascript:"%252525 ? %252525 # %252525"'></iframe> + +<script> +var t = async_test("iframes with javascript src", {timeout:1000}); +function check(id, expected) { + assert_equals( + document.getElementById(id).contentDocument.body.textContent, + expected); +} +onload = t.step_func(function() { + check("a", "yep"); + check("b", "ok"); + check("c", "%2525 ? %2525 # %2525"); + t.done(); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html new file mode 100644 index 000000000..621a8cbae --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/javascript-url-return-value-handling.html @@ -0,0 +1,36 @@ +<!doctype html> +<meta charset=utf-8> +<title>Test that javascript: evaluation only performs a navigation to the + result when the result is a string value.</title> +<script src=/resources/testharness.js></script> +<script src=/resources/testharnessreport.js></script> +<iframe src="javascript:'1'"></iframe> +<iframe src="javascript:1"></iframe> +<iframe src="javascript:({ toString: function() { return '1'; } })"></iframe> +<iframe src="javascript:undefined"></iframe> +<iframe src="javascript:null"></iframe> +<iframe src="javascript:true"></iframe> +<iframe src="javascript:new String('1')"></iframe> +<script> + var t = async_test(); + onload = t.step_func_done(function() { + assert_equals(frames[0].document.documentElement.textContent, + "1", "string return should cause navigation"); + // The rest of the test is disabled for now, until + // https://github.com/whatwg/html/issues/1895 gets sorted out +/* + assert_equals(frames[1].document.documentElement.textContent, + "", "number return should not cause navigation"); + assert_equals(frames[2].document.documentElement.textContent, + "", "object return should not cause navigation"); + assert_equals(frames[3].document.documentElement.textContent, + "", "undefined return should not cause navigation"); + assert_equals(frames[4].document.documentElement.textContent, + "", "null return should not cause navigation"); + assert_equals(frames[5].document.documentElement.textContent, + "", "null return should not cause navigation"); + assert_equals(frames[6].document.documentElement.textContent, + "", "String object return should not cause navigation"); +*/ + }); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url-1.html new file mode 100644 index 000000000..8c412e657 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url-1.html @@ -0,0 +1,7 @@ +<!doctype html> +001-1 +<script> +addEventListener("unload", function() { + location = "data:text/html,unload<script>parent.postMessage('fail', '*');<\/script>"; +}, false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url.html new file mode 100644 index 000000000..7a8be3e91 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_data_url.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Same-origin navigation started from unload handler</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="navigation_unload_data_url-1.html"></iframe> +<script> +var t = async_test(); +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + var new_src = "data:text/html,load<script>parent.postMessage('pass', '*')<\/script>"; + iframe.src = new_src; +}); + +onmessage = t.step_func(function(e) { + assert_equals(e.data, "pass"); + t.done(); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin-1.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin-1.html new file mode 100644 index 000000000..4b52fe3cf --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin-1.html @@ -0,0 +1,7 @@ +<!doctype html> +001-1 +<script> +addEventListener("unload", function() { + location = location.href.replace(/[^\/\.]*\.html/, "001-3.html"); +}, false); +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin.html new file mode 100644 index 000000000..b75409cc8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/navigation_unload_same_origin.html @@ -0,0 +1,20 @@ +<!doctype html> +<title>Same-origin navigation started from unload handler</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="navigation_unload_same_origin-1.html"></iframe> +<script> +var t = async_test(); +onload = t.step_func(function() { + var iframe = document.getElementsByTagName("iframe")[0]; + var new_src = iframe.src.replace(/[^\/\.]*\.html/, "001-2.html"); + iframe.src = new_src; +}); + +onmessage = t.step_func(function(e) { + assert_equals(e.data, "001-3"); + t.done(); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html new file mode 100644 index 000000000..bd2d9dfdb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-parent.html @@ -0,0 +1,17 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set location from a parent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe></iframe> +<script> + onload = function() { + var fr = document.querySelector("iframe") + fr.contentWindow.location = "support/dummy.html" + fr.onload = function() { + assert_equals(fr.contentDocument.referrer, document.URL) + done() + } + } +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html new file mode 100644 index 000000000..4a15b3f08 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function-src.html @@ -0,0 +1,17 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set src from a function called from a parent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe src="support/set-parent-src.html"></iframe> +<script> + onload = function() { + var fr = document.querySelector("iframe") + fr.contentWindow.go() + fr.onload = function() { + assert_equals(fr.contentDocument.referrer, document.URL) + done() + } + } +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html new file mode 100644 index 000000000..b75062b8d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-function.html @@ -0,0 +1,18 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set location from a function called from a parent</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe src="support/location-set.html"></iframe> +<script> + onload = function() { + var fr = document.querySelector("iframe") + var url = fr.contentDocument.URL + fr.contentWindow.go() + fr.onload = function() { + assert_equals(fr.contentDocument.referrer, url) + done() + } + } +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html new file mode 100644 index 000000000..dce6ab2f6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/navigate-child-src-about-blank.html @@ -0,0 +1,17 @@ +<!doctype html> +<meta charset=utf-8> +<title>Set the src attribute to about:blank and check referrer</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id=log></div> +<iframe></iframe> +<script> + onload = function() { + var fr = document.querySelector("iframe") + fr.src = "about:blank" + fr.onload = function() { + assert_equals(fr.contentDocument.referrer, document.URL) + done() + } + } +</script> diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html new file mode 100644 index 000000000..063865709 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/dummy.html @@ -0,0 +1,3 @@ +<!doctype html> +<meta charset=utf-8> +<p>Hello.
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html new file mode 100644 index 000000000..ad733afac --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/location-set.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<script> + function go() { + location.href = "support/dummy.html" + } +</script> +<p>Hello. Go.
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html new file mode 100644 index 000000000..9d45be8c8 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/browsing-the-web/navigating-across-documents/source/support/set-parent-src.html @@ -0,0 +1,8 @@ +<!doctype html> +<meta charset=utf-8> +<script> + function go() { + frameElement.src = "support/dummy.html" + } +</script> +<p>Hello. Go.
\ No newline at end of file |