Skip to content

Commit

Permalink
Ensure that grandchild same-origin iframes are added to the children …
Browse files Browse the repository at this point in the history
…of the child iframe of the root. Resolves servo#8973.
  • Loading branch information
jdm committed Dec 14, 2015
1 parent d11f96e commit 397d748
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion components/script/script_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,8 @@ impl ScriptTask {
let parent_page = self.root_page();
// TODO(gw): This find will fail when we are sharing script tasks
// between cross origin iframes in the same TLD.
parent_page.find(parent).expect("received load for subpage with missing parent");
let parent_page = parent_page.find(parent)
.expect("received load for subpage with missing parent");
parent_page.children.borrow_mut().push(page.clone());
}

Expand Down
6 changes: 6 additions & 0 deletions tests/wpt/mozilla/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -5637,6 +5637,12 @@
"url": "/_mozilla/mozilla/iframe_contentDocument.html"
}
],
"mozilla/iframe_hierarchy.html": [
{
"path": "mozilla/iframe_hierarchy.html",
"url": "/_mozilla/mozilla/iframe_hierarchy.html"
}
],
"mozilla/img_width_height.html": [
{
"path": "mozilla/img_width_height.html",
Expand Down
1 change: 1 addition & 0 deletions tests/wpt/mozilla/tests/mozilla/iframe_child1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo
18 changes: 18 additions & 0 deletions tests/wpt/mozilla/tests/mozilla/iframe_hierarchy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!doctype html>
<meta charset="utf-8">
<title></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<iframe src="iframe_parent1.html"></iframe>
<script>
var t = async_test("iframe content hierarchy is correct");
function do_test() {
console.log("whee");
t.step(function() {
var doc = document.getElementsByTagName("iframe")[0].contentDocument;
doc = doc.getElementsByTagName("iframe")[0].contentDocument;
assert_equals(doc.body.firstChild.textContent, "foo");
t.done();
});
}
</script>
1 change: 1 addition & 0 deletions tests/wpt/mozilla/tests/mozilla/iframe_parent1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<iframe src="iframe_child1.html" onload="parent.do_test()"></iframe>

0 comments on commit 397d748

Please sign in to comment.