Skip to content

Commit

Permalink
Added a test for changing an iframe's parentage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Jeffrey committed Jun 9, 2016
1 parent 77e0089 commit 999e057
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 6 deletions.
12 changes: 12 additions & 0 deletions tests/wpt/metadata/MANIFEST.json
Expand Up @@ -36036,6 +36036,18 @@
"url": "/cssom-view/scrolling-no-browsing-context.html"
}
],
"html/semantics/embedded-content/the-iframe-element/change_parentage.html": [
{
"path": "html/semantics/embedded-content/the-iframe-element/change_parentage.html",
"url": "/html/semantics/embedded-content/the-iframe-element/change_parentage.html"
}
],
"html/semantics/embedded-content/the-iframe-element/same_origin_parentage.html": [
{
"path": "html/semantics/embedded-content/the-iframe-element/same_origin_parentage.html",
"url": "/html/semantics/embedded-content/the-iframe-element/same_origin_parentage.html"
}
],
"url/url-domainToUnicode.html": [
{
"path": "url/url-domainToUnicode.html",
Expand Down
6 changes: 0 additions & 6 deletions tests/wpt/mozilla/meta/MANIFEST.json
Expand Up @@ -6448,12 +6448,6 @@
"url": "/_mozilla/mozilla/iframe-unblock-onload.html"
}
],
"mozilla/iframe/same_origin_parentage.html": [
{
"path": "mozilla/iframe/same_origin_parentage.html",
"url": "/_mozilla/mozilla/iframe/same_origin_parentage.html"
}
],
"mozilla/iframe_contentDocument.html": [
{
"path": "mozilla/iframe_contentDocument.html",
Expand Down
@@ -0,0 +1,14 @@
<body>
Child.
<iframe id="grandchild" src="change_grandchild.html"></iframe>
</body>
<script>
var timer = window.setInterval(poll, 100);
function poll() {
if (document.body.getAttribute("data-contains-grandchild")) {
var grandchild = document.getElementById("grandchild");
window.frameElement.parentNode.appendChild(grandchild);
window.clearTimeout(timer);
}
}
</script>
@@ -0,0 +1,4 @@
<body>Grandchild.</body>
<script>
window.frameElement.parentNode.setAttribute("data-contains-grandchild", true);
</script>
@@ -0,0 +1,22 @@
<!doctype html>
<meta charset="utf-8">
<title>Change the frame heriarchy</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<iframe src="change_child.html"></iframe>
</body>
<script>
async_test(function(t) {
var timer = window.setInterval(t.step_func(poll), 100);
function poll() {
// We wait for the grandchild's script to set the custom attribtue.
// Note that if this test passes, the grandchild's script must have been run twice,
// once to trigger the move from the child to here, and once to pass this test.
if (document.body.getAttribute("data-contains-grandchild")) {
window.clearTimeout(timer);
t.done();
}
}
});
</script>

0 comments on commit 999e057

Please sign in to comment.