aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom
diff options
context:
space:
mode:
authorJonathan Kingston <jonathan@jooped.co.uk>2018-06-14 05:52:31 -0700
committerJonathan Kingston <jonathan@jooped.co.uk>2018-06-14 05:56:16 -0700
commitba9975e0991b700e7560dfc81c00ae4d77136aa2 (patch)
treedc478bc40060c377fb699897b53345e0bf58506d /components/script/dom
parent5c4f54c4035d316eba55eda0186e2f2e010042d5 (diff)
downloadservo-ba9975e0991b700e7560dfc81c00ae4d77136aa2.tar.gz
servo-ba9975e0991b700e7560dfc81c00ae4d77136aa2.zip
Implement window.length DOM attribute.
Diffstat (limited to 'components/script/dom')
-rw-r--r--components/script/dom/webidls/Window.webidl2
-rw-r--r--components/script/dom/window.rs6
2 files changed, 7 insertions, 1 deletions
diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl
index 37bba020622..86f4d655a8e 100644
--- a/components/script/dom/webidls/Window.webidl
+++ b/components/script/dom/webidls/Window.webidl
@@ -31,7 +31,7 @@
// other browsing contexts
[Replaceable] readonly attribute WindowProxy frames;
- //[Replaceable] readonly attribute unsigned long length;
+ [Replaceable] readonly attribute unsigned long length;
// Note that this can return null in the case that the browsing context has been discarded.
// https://github.com/whatwg/html/issues/2115
[Unforgeable] readonly attribute WindowProxy? top;
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 756bfb5a555..2db7609bec4 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -694,6 +694,12 @@ impl WindowMethods for Window {
self.window_proxy()
}
+ // https://html.spec.whatwg.org/multipage/#accessing-other-browsing-contexts
+ fn Length(&self) -> u32 {
+ let doc = self.Document();
+ doc.iter_iframes().count() as u32
+ }
+
// https://html.spec.whatwg.org/multipage/#dom-parent
fn GetParent(&self) -> Option<DomRoot<WindowProxy>> {
// Steps 1-3.