aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Jeffrey <ajeffrey@mozilla.com>2017-05-02 11:39:36 -0500
committerAlan Jeffrey <ajeffrey@mozilla.com>2017-05-02 13:26:10 -0500
commit71f3d8a3205141d32b430384af9bca7af5aa6c22 (patch)
treeb00441bb32a34b61c79b9ef46d1065cda65e410b
parent688733a0be26f29a9e4e74bb82685c42625dfb4d (diff)
downloadservo-71f3d8a3205141d32b430384af9bca7af5aa6c22.tar.gz
servo-71f3d8a3205141d32b430384af9bca7af5aa6c22.zip
Added mozilla wpt test for adopted nodes passing same-origin-domain checks.
-rw-r--r--tests/wpt/mozilla/meta/MANIFEST.json10
-rw-r--r--tests/wpt/mozilla/meta/mozilla/adopted_node_is_same_origin_domain.html.ini4
-rw-r--r--tests/wpt/mozilla/tests/mozilla/adopted_node_is_same_origin_domain.html30
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json
index 5b451022e62..6d77e39770b 100644
--- a/tests/wpt/mozilla/meta/MANIFEST.json
+++ b/tests/wpt/mozilla/meta/MANIFEST.json
@@ -11369,6 +11369,12 @@
{}
]
],
+ "mozilla/adopted_node_is_same_origin_domain.html": [
+ [
+ "/_mozilla/mozilla/adopted_node_is_same_origin_domain.html",
+ {}
+ ]
+ ],
"mozilla/binding_keyword.html": [
[
"/_mozilla/mozilla/binding_keyword.html",
@@ -24492,6 +24498,10 @@
"170d51460da58c16f5cf94ecda18f18a1c18c116",
"support"
],
+ "mozilla/adopted_node_is_same_origin_domain.html": [
+ "3f2e6af92f9391aa1892e485c61c9e92c7661194",
+ "testharness"
+ ],
"mozilla/binding_keyword.html": [
"c79aa6d506fbabbed0f6f31d1b8600ea6ba8ff41",
"testharness"
diff --git a/tests/wpt/mozilla/meta/mozilla/adopted_node_is_same_origin_domain.html.ini b/tests/wpt/mozilla/meta/mozilla/adopted_node_is_same_origin_domain.html.ini
new file mode 100644
index 00000000000..3c4d9edc50f
--- /dev/null
+++ b/tests/wpt/mozilla/meta/mozilla/adopted_node_is_same_origin_domain.html.ini
@@ -0,0 +1,4 @@
+[adopted_node_is_same_origin_domain.html]
+ type: testharness
+ [Adopting a node should make it same-origin-domain.]
+ expected: FAIL
diff --git a/tests/wpt/mozilla/tests/mozilla/adopted_node_is_same_origin_domain.html b/tests/wpt/mozilla/tests/mozilla/adopted_node_is_same_origin_domain.html
new file mode 100644
index 00000000000..81de5b389c9
--- /dev/null
+++ b/tests/wpt/mozilla/tests/mozilla/adopted_node_is_same_origin_domain.html
@@ -0,0 +1,30 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Ensure that adopted nodes pass the same-origin-domain checks</title>
+<link rel=help href="https://dom.spec.whatwg.org/#dom-document-adoptnode">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+async_test(function(t) {
+ // This tests that adopting a node changes its same-origin-domain checks.
+ var iframe = document.createElement("iframe");
+ iframe.src = "/common/blank.html";
+ iframe.onload = t.step_func(function() {
+ // Create two nodes in the iframe's content document.
+ var nodeToAdopt = iframe.contentDocument.createElement("div");
+ var nodeToLeaveUnadopted = iframe.contentDocument.createElement("div");
+ document.adoptNode(nodeToAdopt);
+ assert_equals(nodeToAdopt.ownerDocument, document);
+ assert_equals(nodeToLeaveUnadopted.ownerDocument, iframe.contentDocument);
+ // Setting the iframe's document.domain causes it not to be same-origin-domain
+ iframe.contentDocument.domain = document.domain;
+ // We can still access the adopted node, since it is still same-origin-domain,
+ // but accessing the unadopted node throws a security exception.
+ assert_equals(nodeToAdopt.ownerDocument, document);
+ assert_throws(null, function() { nodeToLeaveUnadopted.ownerDocument; });
+ t.done();
+ });
+ document.body.appendChild(iframe);
+}, "Adopting a node should make it same-origin-domain.")
+</script>