Auto merge of #11677 - asajeffrey:iframe-change-parentage-test, r=ConnorGBrewster

Added a test for changing an iframe's parentage.

<!-- Please describe your changes on the following line: -->
Add a test for what happens when an iframe's parent browsing context changes.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11677)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-06-09 13:41:47 -05:00
commit 3acb9540ff
10 changed files with 52 additions and 6 deletions

View file

@ -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",

View file

@ -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",

View file

@ -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>

View file

@ -0,0 +1,4 @@
<body>Grandchild.</body>
<script>
window.frameElement.parentNode.setAttribute("data-contains-grandchild", true);
</script>

View file

@ -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>