aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/script/dom/webidls/Window.webidl2
-rw-r--r--components/script/dom/window.rs6
-rw-r--r--tests/wpt/metadata/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html.ini14
-rw-r--r--tests/wpt/metadata/html/browsers/the-window-object/security-window/window-security.https.html.ini3
-rw-r--r--tests/wpt/metadata/html/browsers/the-window-object/window-properties.https.html.ini3
5 files changed, 7 insertions, 21 deletions
diff --git a/components/script/dom/webidls/Window.webidl b/components/script/dom/webidls/Window.webidl
index 0cda7d2d800..8416cd49334 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.
diff --git a/tests/wpt/metadata/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html.ini b/tests/wpt/metadata/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html.ini
index cb2181467b2..14c025aa804 100644
--- a/tests/wpt/metadata/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html.ini
+++ b/tests/wpt/metadata/html/browsers/the-window-object/accessing-other-browsing-contexts/window_length.html.ini
@@ -1,19 +1,5 @@
[window_length.html]
type: testharness
- [No child browsing contexts]
- expected: FAIL
-
- [iframe not inserted into the document]
- expected: FAIL
-
- [One iframe inserted into the document]
- expected: FAIL
-
- [Child browsing context has a child browsing context]
- expected: FAIL
-
- [window.length in child frame]
- expected: FAIL
[Opened window]
expected: FAIL
diff --git a/tests/wpt/metadata/html/browsers/the-window-object/security-window/window-security.https.html.ini b/tests/wpt/metadata/html/browsers/the-window-object/security-window/window-security.https.html.ini
index 09988facd1b..c18a4adb31e 100644
--- a/tests/wpt/metadata/html/browsers/the-window-object/security-window/window-security.https.html.ini
+++ b/tests/wpt/metadata/html/browsers/the-window-object/security-window/window-security.https.html.ini
@@ -335,9 +335,6 @@
[A SecurityError exception must be thrown when window.stop is accessed from a different origin.]
expected: FAIL
- [A SecurityError exception should not be thrown when window.length is accessed from a different origin.]
- expected: FAIL
-
[A SecurityError exception should not be thrown when window.opener is accessed from a different origin.]
expected: FAIL
diff --git a/tests/wpt/metadata/html/browsers/the-window-object/window-properties.https.html.ini b/tests/wpt/metadata/html/browsers/the-window-object/window-properties.https.html.ini
index 69a79de6c40..a3d1d406971 100644
--- a/tests/wpt/metadata/html/browsers/the-window-object/window-properties.https.html.ini
+++ b/tests/wpt/metadata/html/browsers/the-window-object/window-properties.https.html.ini
@@ -53,9 +53,6 @@
[Window replaceable attribute: external]
expected: FAIL
- [Window replaceable attribute: length]
- expected: FAIL
-
[Window replaceable attribute: screen]
expected: FAIL