mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Added mozilla wpt test for adopted nodes passing same-origin-domain checks.
This commit is contained in:
parent
688733a0be
commit
71f3d8a320
3 changed files with 44 additions and 0 deletions
|
@ -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"
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
[adopted_node_is_same_origin_domain.html]
|
||||
type: testharness
|
||||
[Adopting a node should make it same-origin-domain.]
|
||||
expected: FAIL
|
|
@ -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>
|
Loading…
Add table
Add a link
Reference in a new issue