aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authorJansen Jan <farodin91@sek-server.de>2016-05-17 23:46:04 +0200
committerJansen Jan <farodin91@sek-server.de>2016-06-09 23:42:27 +0200
commitfda011923eda8cc8553ab480ff6340c69b409583 (patch)
tree243fc2e90db0518d1720ab9a4382207185c7e3dd /components/script/dom/htmliframeelement.rs
parent3acb9540ffdf1caa496e624de6661ec05f7d17b6 (diff)
downloadservo-fda011923eda8cc8553ab480ff6340c69b409583.tar.gz
servo-fda011923eda8cc8553ab480ff6340c69b409583.zip
Support WindowProxy return values in bindings
unscopable
Diffstat (limited to 'components/script/dom/htmliframeelement.rs')
-rw-r--r--components/script/dom/htmliframeelement.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index 1c0e0c9cf1a..44122f07fe4 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -22,6 +22,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::{Root, LayoutJS};
use dom::bindings::reflector::Reflectable;
use dom::bindings::str::DOMString;
+use dom::browsingcontext::BrowsingContext;
use dom::customevent::CustomEvent;
use dom::document::Document;
use dom::element::{AttributeMutation, Element, RawLayoutElementHelpers};
@@ -256,6 +257,15 @@ impl HTMLIFrameElement {
}
}
+ pub fn get_content_window(&self) -> Option<Root<Window>> {
+ self.subpage_id.get().and_then(|subpage_id| {
+ let window = window_from_node(self);
+ let window = window.r();
+ let browsing_context = window.browsing_context();
+ browsing_context.find_child_by_subpage(subpage_id)
+ })
+ }
+
}
pub trait HTMLIFrameElementLayoutMethods {
@@ -422,18 +432,16 @@ impl HTMLIFrameElementMethods for HTMLIFrameElement {
}
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentwindow
- fn GetContentWindow(&self) -> Option<Root<Window>> {
- self.subpage_id.get().and_then(|subpage_id| {
- let window = window_from_node(self);
- let window = window.r();
- let browsing_context = window.browsing_context();
- browsing_context.find_child_by_subpage(subpage_id)
- })
+ fn GetContentWindow(&self) -> Option<Root<BrowsingContext>> {
+ match self.get_content_window() {
+ Some(ref window) => Some(window.browsing_context()),
+ None => None
+ }
}
// https://html.spec.whatwg.org/multipage/#dom-iframe-contentdocument
fn GetContentDocument(&self) -> Option<Root<Document>> {
- self.GetContentWindow().and_then(|window| {
+ self.get_content_window().and_then(|window| {
// FIXME(#10964): this should use the Document's origin and the
// origin of the incumbent settings object.
let self_url = self.get_url();