Auto merge of #6600 - Ms2ger:top, r=Manishearth

Implement Window#top.



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6600)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2015-07-11 04:01:33 -06:00
commit bd3380e0b6
4 changed files with 10 additions and 10 deletions

View file

@ -33,6 +33,7 @@
readonly attribute Window frames;
//[Replaceable] readonly attribute unsigned long length;
//[Unforgeable] readonly attribute WindowProxy top;
readonly attribute Window top;
// attribute any opener;
//readonly attribute WindowProxy parent;
readonly attribute Window parent;

View file

@ -442,6 +442,15 @@ impl<'a> WindowMethods for &'a Window {
self.parent().unwrap_or(self.Window())
}
// https://html.spec.whatwg.org/multipage/#dom-top
fn Top(self) -> Root<Window> {
let mut window = self.Window();
while let Some(parent) = window.parent() {
window = parent;
}
window
}
fn Performance(self) -> Root<Performance> {
self.performance.or_init(|| {
Performance::new(self, self.navigation_start,

View file

@ -1,5 +0,0 @@
[034.html]
type: testharness
[ scheduler: innerHTML adding frames with JS in]
expected: FAIL

View file

@ -1,5 +0,0 @@
[039.html]
type: testharness
[ scheduler: IFRAMEs added with DOM]
expected: FAIL