diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-06-14 11:59:23 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-14 11:59:23 -0400 |
commit | 3279d1fe85d3aa8dbb99c59b4184e4bc3cc6c54b (patch) | |
tree | 860a179e55bf345cf4569e1f4ea6410955ce8db1 /components/script/dom | |
parent | d6edd5b4381168d76e7a58c3991c8896eba74eb2 (diff) | |
parent | ba9975e0991b700e7560dfc81c00ae4d77136aa2 (diff) | |
download | servo-3279d1fe85d3aa8dbb99c59b4184e4bc3cc6c54b.tar.gz servo-3279d1fe85d3aa8dbb99c59b4184e4bc3cc6c54b.zip |
Auto merge of #21051 - jonathanKingston:window-length, r=jdm
Implement window.length DOM attribute.
Implements the `window.length` DOM attribute for enumerating frames on the document.
---
<!-- 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
<!-- Either: -->
- [X] There are tests for these changes
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- 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="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21051)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/webidls/Window.webidl | 2 | ||||
-rw-r--r-- | components/script/dom/window.rs | 6 |
2 files changed, 7 insertions, 1 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. |