aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmliframeelement.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-10 10:53:35 -0500
committerGitHub <noreply@github.com>2016-06-10 10:53:35 -0500
commit08a55e29511a2b26b7ae26ebb0b9271f80e2a7bd (patch)
tree502483f3666037c9a636a02c921ffb6e6b32897a /components/script/dom/htmliframeelement.rs
parent2fb8525919a72a1e1d5c873fb18a97c67c93bd95 (diff)
parentfda011923eda8cc8553ab480ff6340c69b409583 (diff)
downloadservo-08a55e29511a2b26b7ae26ebb0b9271f80e2a7bd.tar.gz
servo-08a55e29511a2b26b7ae26ebb0b9271f80e2a7bd.zip
Auto merge of #11214 - farodin91:windowproxy, r=jdm
Support WindowProxy return values in bindings 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 --faster` does not report any errors - [x] These changes fix #10965 (github issue number if applicable). Either: - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ 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="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11214) <!-- Reviewable:end -->
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();