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/windows | |
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/windows')
43 files changed, 658 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/browsers/windows/.gitkeep b/testing/web-platform/tests/html/browsers/windows/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json new file mode 100644 index 000000000..9f2ca3b6f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/auxiliary-browsing-contexts/contains.json @@ -0,0 +1,6 @@ +[ + { + "id": "navigating-auxiliary-browsing-contexts-in-the-dom", + "original_id": "navigating-auxiliary-browsing-contexts-in-the-dom" + } +]
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-first-created.xhtml b/testing/web-platform/tests/html/browsers/windows/browsing-context-first-created.xhtml new file mode 100644 index 000000000..a059eec4c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-first-created.xhtml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>HTML Test: Browsing context is first created</title> + <link rel="author" title="Intel" href="http://www.intel.com/" /> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script> + <![CDATA[ + + var doc, iframe; + + setup(function () { + iframe = document.createElement("iframe"); + document.body.appendChild(iframe); + doc = iframe.contentDocument; + }); + + test(function () { + assert_equals(iframe.contentWindow.history.length, 1, "The history.length should be 1."); + }, "Check the history.length of the first created browsing context"); + + test(function () { + assert_equals(doc.documentURI, "about:blank", "The document's address should be 'about:blank'."); + assert_equals(doc.URL, "about:blank", "The document's address should be 'about:blank'."); + assert_equals(doc.contentType, "text/html", "The document should be an HTML document."); + assert_equals(doc.doctype, null, "The docType of a document without a document type declaration should be null."); + assert_equals(doc.compatMode, "BackCompat", "The compatMode of a document without a document type declaration should be 'BackCompat'."); + assert_equals(doc.characterSet, "UTF-8", "The document's encoding should be 'UTF-8'."); + assert_equals(iframe.contentWindow.parent.document, document); + assert_equals(doc.referrer, document.URL, "The document's referrer should be its creator document's address."); + }, "Check the document's meta data"); + + test(function () { + assert_equals(doc.readyState, "complete", "The readyState attribute should be 'complete'."); + }, "Check the document's status"); + + test(function () { + assert_equals(doc.childNodes.length, 1, "The document must have only one child."); + assert_equals(doc.documentElement.tagName, "HTML"); + assert_equals(doc.documentElement.childNodes.length, 2, "The HTML element should have 2 children."); + assert_equals(doc.documentElement.childNodes[0].tagName, "HEAD", "The first child of HTML element should be a HEAD element."); + assert_false(doc.documentElement.childNodes[0].hasChildNodes(), "The HEAD element should not have children."); + assert_equals(doc.documentElement.childNodes[1].tagName, "BODY", "The second child of HTML element should be a BODY element."); + assert_false(doc.documentElement.childNodes[1].hasChildNodes(), "The BODY element should not have children."); + }, "Check the document's content"); + + ]]> + </script> + </body> +</html> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/.gitkeep b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001-1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001-1.html new file mode 100644 index 000000000..d413c3019 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001-1.html @@ -0,0 +1,8 @@ +<!doctype html> +001-1 +<script> +if (window.opener !== null) { + window.opener.postMessage("FAIL", "*"); +} +window.close(); +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001.html new file mode 100644 index 000000000..2478cdc8f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/001.html @@ -0,0 +1,22 @@ +<!doctype html> +<title>Link with target=_blank, rel=noreferrer</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<a href="001-1.html" rel="noreferrer" target="_blank">Link</a> +<script> +var t = async_test(); +var a; +t.step(function() { + a = document.getElementsByTagName("a")[0]; + a.click(); + //This is a bit hacky; if the test passes there isn't a link back to the parent + //window so we have to pass on a timeout. But opening the link could be slow in + //some cases, so there is some possibility of false passes + setTimeout(t.step_func(function() { + t.done(); + }), 1000); +}); + +onmessage = t.step_func(function() {assert_unreached("Opened window had a reference to opener")}); +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002-1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002-1.html new file mode 100644 index 000000000..ca8a485de --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002-1.html @@ -0,0 +1,8 @@ +<!doctype html> +002-1 +<script> +if (window.opener !== null) { + window.opener.postMessage("PASS", "*"); +} +window.close(); +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002.html new file mode 100644 index 000000000..4a1df8e4d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/002.html @@ -0,0 +1,25 @@ +<!doctype html> +<title>Link with target=_blank, no rel</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<a href="002-1.html" target="_blank">Link</a> +<script> +var a; +async_test(function(t) { + a = document.getElementsByTagName("a")[0]; + a.click(); + + // This is a bit hacky; if the test fails there isn't a link back to the parent + // window so we have to pass on a timeout. But opening the link could be slow in + // some cases, so there is some possibility of false fails + step_timeout(t.step_func(function() { + assert_unreached("Failed to get callback from opened window"); + }), 5000); + + onmessage = t.step_func(function(e) { + assert_equals(e.data, "PASS"); + t.done() + }); +}); +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/MANIFEST b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/MANIFEST new file mode 100644 index 000000000..efecf51e3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/MANIFEST @@ -0,0 +1,4 @@ +001.html +support 001-1.html +002.html +support 002-1.html diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html new file mode 100644 index 000000000..2eaba22f6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-existing.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: Choose browsing context - the given name is same as an existing browsing context's name</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="existing.html" style="display:none"></iframe> +<iframe name="existWin" style="display:none"></iframe> +<script> + +var t = async_test("The browsing context must be chosen if the given name is same as its name"); + +window.addEventListener("message", function (e) { + t.step(function() { + assert_equals(e.data.name, "existWin", "The browsing context name should be 'existWin'."); + }); + t.done(); +}, false); + +frames[0].onload = t.step_func(function(e) { + frames[0].do_test(); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html new file mode 100644 index 000000000..c771a8fd7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-parent.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: Choose browsing context - the given name is '_parent'</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="parent1.html" name="parentWin" style="display:none"></iframe> +<script> + +var t = async_test("The parent browsing context must be chosen if the given name is '_parent'"); + +window.addEventListener("message", function (e) { + t.step(function() { + assert_equals(e.data.name, "parentWin", "The browsing context name should be 'parentWin'."); + }); + t.done(); +}, false); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html new file mode 100644 index 000000000..99d7fe7d3 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-1.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: Choose browsing context - the given name is '_self'</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="self1.html" style="display:none"></iframe> +<script> + +var t = async_test("The current browsing context must be chosen if the given name is '_self'"); + +window.addEventListener("message", function (e) { + t.step(function () { + assert_equals(e.data.name, "selfWin1", "The browsing context name should be 'selfWin1'."); + }); + t.done(); +}, false); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html new file mode 100644 index 000000000..e25a5b442 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-choose-self-2.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: Choose browsing context - the given name is empty string</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="self2.html" style="display:none"></iframe> +<script> + +var t = async_test("The current browsing context must be chosen if the given name is empty string"); + +window.addEventListener("message", function (e) { + t.step(function () { + assert_equals(e.data.name, "selfWin2", "The browsing context name should be 'selfWin2'."); + }); + t.done(); +}, false); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-default-name.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-default-name.html new file mode 100644 index 000000000..0bad8e606 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/browsing-context-default-name.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: Browsing context - Default name</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<iframe src="message.html" style="display:none"></iframe> +<script> + +test(function () { + assert_equals(window.frames[0].name, "", "The browsing context should not have a default name."); +}, "A embedded browsing context has no default name"); + +test(function () { + var win = window.open("about:blank", "_blank"); + assert_equals(win.name, "", "The browsing context should not have a name."); + win.close(); +}, "A browsing context which is opened by window.open() method with '_blank' parameter has no default name"); + +//This test must be run when the current browsing context's name is not set +test(function () { + assert_equals(window.name, "", "The browsing context should not have a name."); +}, "A browsing context has no default name"); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/existing.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/existing.html new file mode 100644 index 000000000..13d2c6ab4 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/existing.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>This is a test page</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script> + +function do_test() { + window.open("message.html", "existWin"); +} + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/message.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/message.html new file mode 100644 index 000000000..90720d46a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/message.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: post window's name to top browsing context</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script> + +top.postMessage({name: window.name}, "*"); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent1.html new file mode 100644 index 000000000..fb34b2fe7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent1.html @@ -0,0 +1,5 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: browsing context name - parent</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<iframe src="parent2.html"></iframe> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent2.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent2.html new file mode 100644 index 000000000..34eb1c76b --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/parent2.html @@ -0,0 +1,9 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: browsing context name - parent</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script> + +window.open("message.html", "_parent"); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self1.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self1.html new file mode 100644 index 000000000..2c8e3a414 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self1.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: browsing context name - self</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script> + +window.name = "selfWin1"; +var win = window.open("message.html", "_self"); +win.close(); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self2.html b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self2.html new file mode 100644 index 000000000..57276fada --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/browsing-context-names/self2.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>HTML Test: browsing context name - self</title> +<link rel="author" title="Intel" href="http://www.intel.com/"> +<script> + +window.name = "selfWin2"; +var win = window.open("message.html", ""); +win.close(); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/groupings-of-browsing-contexts/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/MANIFEST b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/MANIFEST new file mode 100644 index 000000000..3bc8c0f3f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/MANIFEST @@ -0,0 +1 @@ +window-top-001.html diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/contains.json b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/contains.json new file mode 100644 index 000000000..121284dca --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/contains.json @@ -0,0 +1,6 @@ +[ + { + "id": "navigating-nested-browsing-contexts-in-the-dom", + "original_id": "navigating-nested-browsing-contexts-in-the-dom" + } +]
\ No newline at end of file diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html new file mode 100644 index 000000000..f1d5581f6 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/frameElement.sub.html @@ -0,0 +1,74 @@ +<!DOCTYPE html> +<meta charset="utf-8"/> +<title>HTML Test: window.frameElement</title> +<link rel="author" title="Intel" href="http://www.intel.com/" /> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script> + +var t1 = async_test("The window's frameElement attribute must return its container element if it is a nested browsing context"); +var t2 = async_test("The SecurityError must be thrown if the window accesses to frameElement attribute of a Window which does not have the same effective script origin"); +var t3 = async_test("The window's frameElement attribute must return null if the container's document does not have the same effective script origin"); + +function on_load() { + t1.step(function () { + assert_equals(frames[0].frameElement, document.getElementById("fr1"), + "The frameElement attribute should be the first iframe element."); + assert_equals(window["win2"].frameElement, document.getElementById("obj"), + "The frameElement attribute should be the object element."); + assert_equals(window["win3"].frameElement, document.getElementById("emb"), + "The frameElement attribute should be the embed element."); + assert_equals(document.getElementById("fr4").contentWindow[0].frameElement, + document.getElementById("fr4").contentDocument.getElementById("f1"), + "The frameElement attribute should be the frame element in 'test.html'."); + }); + t1.done(); + + t2.step(function () { + assert_throws("SecurityError", function () { frames[1].frameElement; }, + "The SecurityError exception should be thrown."); + }); + t2.done(); + + t3.step(function () { + document.getElementById("fr5").contentWindow.postMessage(null, "*"); + }); + window.addEventListener("message", function (event) { + var data = JSON.parse(event.data); + if (data.name == "testcase3") { + t3.step(function () { + assert_equals(data.result, "window.frameElement = null", + "The frameElement attribute should be null."); + }); + t3.done(); + } + }, false); +} + +</script> +<body onload="on_load()"> + <div id="log"></div> + <iframe id="fr1"></iframe> + <iframe id="fr2" src="test.html"></iframe> <!-- cross origin --> + <iframe id="fr3" src="" style="display:none"></iframe> + <object id="obj" name="win2" type="text/html" data="about:blank"></object> + <embed id="emb" name="win3" type="image/svg+xml" src="/images/green.svg" /> + <iframe id="fr4" src="test.html"></iframe> <!-- same origin --> + <iframe id="fr5" src="testcase3.html"></iframe> <!-- cross origin --> + <script> + + setup(function () { + var src_base = get_host_info().HTTP_REMOTE_ORIGIN; + src_base += document.location.pathname.substring(0, document.location.pathname.lastIndexOf("/") + 1); + document.getElementById("fr2").src = src_base + "test.html"; + document.getElementById("fr5").src = src_base + "testcase3.html"; + }); + + test(function () { + assert_equals(window.frameElement, null, + "The frameElement attribute should be null."); + }, "The window's frameElement attribute must return null if it is not a nested browsing context"); + + </script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html new file mode 100644 index 000000000..d066b8d4c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/test.html @@ -0,0 +1,7 @@ +<!DOCTYPE html> +<meta charset="utf-8"/> +<title>HTML Test: child browsing context created by the frame element</title> +<link rel="author" title="Intel" href="http://www.intel.com/" /> +<frameset> + <frame id="f1" name="frame"> +</frameset> diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html new file mode 100644 index 000000000..d67bde26f --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/testcase3.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<meta charset="utf-8"/> +<title>Testcase 3: frameElement attribute must return null if the container\'s document does not have the same effective script origin</title> +<script> +window.addEventListener("message", function (event) { + try { + var result = "window.frameElement = " + window.frameElement; + } catch (e) { + result = e.message; + } + event.source.postMessage(JSON.stringify({name: "testcase3", result: result}), + "*"); +}, false); +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-001.html b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-001.html new file mode 100644 index 000000000..9dbccfc7c --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/nested-browsing-contexts/window-top-001.html @@ -0,0 +1,63 @@ +<!doctype html> +<meta charset="utf-8"> +<title>window.top</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + assert_equals(window, top) +}, "Top level browsing context"); + +function step_func(test) { + return function (top_pointer) { + test.step(function() {assert_equals(top_pointer, window);}) + test.done(); + } +} + +var t1 = async_test("One nested iframe"); +t1.step(function() { + var iframe = document.createElement("iframe"); + //iframe.src = "data:text/html," + + iframe.onload = t1.step_func( + function() { + var doc = iframe.contentDocument; + iframe.contentWindow.test_func = step_func(t1); + + var script = doc.createElement("script") + script.textContent = "test_func(top);" + doc.body.appendChild(script); + }); + document.body.appendChild(iframe); +}); + +var t2 = async_test("Two nested iframes"); +t2.step(function() { + var iframe = document.createElement("iframe"); + //iframe.src = "data:text/html," + + iframe.onload = t2.step_func( + function() { + var doc = iframe.contentDocument; + iframe2 = document.createElement("iframe"); + //iframe2.src = "data:text/html," + + iframe2.onload = t2.step_func( + function() { + var doc2 = iframe2.contentDocument; + + iframe2.contentWindow.test_func = step_func(t2); + + var script = doc2.createElement("script") + script.textContent = "test_func(top);" + doc2.body.appendChild(script); + }); + doc.body.appendChild(iframe2); + }); + + document.body.appendChild(iframe); +}); + +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-close-manual.sub.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-close-manual.sub.html new file mode 100644 index 000000000..0191fa61e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-close-manual.sub.html @@ -0,0 +1,3 @@ +<meta charset=utf-8> +<p>Follow this link to open a new browsing context and then confirm it can be closed: +<a rel=noreferrer target=reallydoesnotmatter href="//天気の良い日.{{location[host]}}/html/browsers/windows/support-close.html">link</a>. diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-manual.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-manual.html new file mode 100644 index 000000000..f5879ee6d --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-manual.html @@ -0,0 +1,10 @@ +<ol> + <li><p>After clicking these two links in order a single browsing context should be open showing + <code>example.org</code>: + <a target=doesnotmatter href="http://example.com/">one</a>, + <a target=doesnotmatter href="http://example.org/">two</a>. + + <li><p>After clicking these two links two browsing contexts should have been opened: + <a rel=noreferrer target=reallydoesnotmatter href="http://example.com/">one</a>, + <a rel=noreferrer target=reallydoesnotmatter href="http://example.com/">two</a>. +</ol> diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-window-name.sub.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-window-name.sub.html new file mode 100644 index 000000000..790c22157 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-cross-origin-window-name.sub.html @@ -0,0 +1,3 @@ +<meta charset=utf-8> +<p>Follow this link to open a new browsing context and then confirm it says "idonteven": +<a rel=noreferrer target=idonteven href="//天気の良い日.{{location[host]}}/html/browsers/windows/support-window-name-echo.html">link</a>. diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer-window-name.html b/testing/web-platform/tests/html/browsers/windows/noreferrer-window-name.html new file mode 100644 index 000000000..ecd2e7658 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/noreferrer-window-name.html @@ -0,0 +1,85 @@ +<!doctype html> +<title>rel=noreferrer and reuse of names</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> + async_test(function(t) { + localStorage.clear() + + function makeHyperlink(n) { + var hyperlink = document.body.appendChild(document.createElement("a")) + hyperlink.rel = "noreferrer" + hyperlink.target = "sufficientlyrandomwindownameamiright" + hyperlink.href = "support-named-null-opener.html#" + n + return hyperlink + } + + var hyperlink1 = makeHyperlink(1), + hyperlink2 = makeHyperlink(2) + + t.add_cleanup(function() { + localStorage.setItem("x", "close") + localStorage.clear() + document.body.removeChild(hyperlink1) + document.body.removeChild(hyperlink2) + }) + + addEventListener("storage", function(e) { + t.step(function() { + if(localStorage.getItem("window1") && localStorage.getItem("window2")) { + localStorage.setItem("x", "close") + t.done() + } + }) + }) + + hyperlink1.click() + hyperlink2.click() + }, "Following a noreferrer link with a named target should not cause creation of a window that can be targeted by another noreferrer link with the same named target"); + + async_test(function(t) { + var ifr = document.createElement("iframe"); + ifr.name = "sufficientlyrandomwindownameamiright2"; + ifr.onload = t.step_func(function() { + var hyperlink = document.body.appendChild(document.createElement("a")); + t.add_cleanup(function() { + hyperlink.remove(); + }); + hyperlink.rel = "noreferrer"; + hyperlink.href = URL.createObjectURL(new Blob(["hello subframe"], + { type: "text/html"})); + hyperlink.target = "sufficientlyrandomwindownameamiright2"; + ifr.onload = t.step_func_done(function() { + assert_equals(ifr.contentDocument.documentElement.textContent, + "hello subframe"); + }); + hyperlink.click(); + }); + document.body.appendChild(ifr); + t.add_cleanup(function() { + ifr.remove(); + }); + }, "Targeting a rel=noreferrer link at an existing named subframe should work"); + + async_test(function(t) { + var win = window.open("", "sufficientlyrandomwindownameamiright3"); + t.add_cleanup(function() { + win.close(); + }); + + var hyperlink = document.body.appendChild(document.createElement("a")); + t.add_cleanup(function() { + hyperlink.remove(); + }); + hyperlink.rel = "noreferrer"; + hyperlink.href = URL.createObjectURL(new Blob(["hello window"], + { type: "text/html"})); + hyperlink.target = "sufficientlyrandomwindownameamiright3"; + win.onload = t.step_func_done(function() { + assert_equals(win.document.documentElement.textContent, + "hello window"); + }); + hyperlink.click(); + }, "Targeting a rel=noreferrer link at an existing named window should work"); +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/noreferrer.html b/testing/web-platform/tests/html/browsers/windows/noreferrer.html new file mode 100644 index 000000000..c072486b0 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/noreferrer.html @@ -0,0 +1,25 @@ +<!doctype html> +<title>rel=noreferrer nullifies window.opener</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> + async_test(function(t) { + localStorage.clear() + + var hyperlink = document.body.appendChild(document.createElement("a")) + hyperlink.rel = "noreferrer" + hyperlink.target = "_blank" + hyperlink.href = "support-opener-null.html" + hyperlink.click() + document.body.removeChild(hyperlink) + + addEventListener("storage", function(e) { + t.step(function() { + assert_equals(e.newValue, "null") + localStorage.clear() + t.done() + }) + }) + }) +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep b/testing/web-platform/tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/secondary-browsing-contexts/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/windows/security-nav/.gitkeep b/testing/web-platform/tests/html/browsers/windows/security-nav/.gitkeep new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/security-nav/.gitkeep diff --git a/testing/web-platform/tests/html/browsers/windows/support-close.html b/testing/web-platform/tests/html/browsers/windows/support-close.html new file mode 100644 index 000000000..38ec2aef5 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/support-close.html @@ -0,0 +1 @@ +<p>Clicking this button should close this browsing context: <button onclick=window.close()>button</button> diff --git a/testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html b/testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html new file mode 100644 index 000000000..8c106ca88 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/support-named-null-opener.html @@ -0,0 +1,8 @@ +<script> + addEventListener("storage", function(e) { + if(e.newValue === "close") { + close() + } + }) + localStorage.setItem("window" + location.hash.slice(1), "tralala") +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html b/testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html new file mode 100644 index 000000000..e92b69d7e --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/support-nested-browsing-contexts.html @@ -0,0 +1,12 @@ +<body> +<script> + var i = document.createElement("iframe"); + i.name = "nested1"; + document.body.appendChild(i); + + window.opener.postMessage({ + "name": window.name, + "isTop": window.top === window + }, "*"); +</script> +</body> diff --git a/testing/web-platform/tests/html/browsers/windows/support-opener-null.html b/testing/web-platform/tests/html/browsers/windows/support-opener-null.html new file mode 100644 index 000000000..c734eb305 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/support-opener-null.html @@ -0,0 +1,4 @@ +<script> + localStorage.setItem("opener", window.opener) + window.close() +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html b/testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html new file mode 100644 index 000000000..453fec97a --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/support-post-to-opener.html @@ -0,0 +1,8 @@ +<script> + if (window.opener) { + window.opener.postMessage({ + "name": window.name, + "isTop": window.top === window + }, "*"); + } +</script> diff --git a/testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html b/testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html new file mode 100644 index 000000000..a437fecb2 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/support-window-name-echo.html @@ -0,0 +1 @@ +<script>document.write(name)</script> diff --git a/testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html b/testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html new file mode 100644 index 000000000..e37a595f7 --- /dev/null +++ b/testing/web-platform/tests/html/browsers/windows/targeting-cross-origin-nested-browsing-contexts.sub.html @@ -0,0 +1,39 @@ +<!doctype html> +<html> +<head> + <meta charset="utf-8"> + <title>Targeting nested browsing contexts</title> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> +</head> +<body> + <script src="/common/get-host-info.sub.js"></script> + <script> + async_test(function (t) { + var windowsToClose = []; + window.onmessage = t.step_func(function (e) { + if (e.data.name == "openee") { + var a = document.body.appendChild(document.createElement('a')); + a.target = "nested1"; + a.href = "support-post-to-opener.html"; + a.click(); + windowsToClose.push(e.source); + } else { + assert_equals(e.data.name, "nested1"); + assert_equals(e.data.isTop, true); + windowsToClose.push(e.source); + windowsToClose.forEach(function (w) { + w.close(); + }); + t.done(); + } + }); + + var a = document.body.appendChild(document.createElement('a')); + a.target = "openee"; + a.href = get_host_info().HTTP_REMOTE_ORIGIN + "/html/browsers/windows/support-nested-browsing-contexts.html"; + a.click(); + }); + </script> +</body> +</html> |