aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorAnthony Ramine <n.oxyde@gmail.com>2015-10-17 02:33:01 +0200
committerAnthony Ramine <n.oxyde@gmail.com>2015-10-19 09:36:53 +0200
commit6ab7f646203e168c8067acf69ad262e0f3c3fe19 (patch)
tree70ff1e16d04b902b10c9edb7db092a635d871c8d /components/script
parent409b5e3695828e01fc25cbab96148c4932f07cad (diff)
downloadservo-6ab7f646203e168c8067acf69ad262e0f3c3fe19.tar.gz
servo-6ab7f646203e168c8067acf69ad262e0f3c3fe19.zip
Return a reference in BrowserContext::active_window()
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/browsercontext.rs8
-rw-r--r--components/script/dom/window.rs2
2 files changed, 5 insertions, 5 deletions
diff --git a/components/script/dom/browsercontext.rs b/components/script/dom/browsercontext.rs
index 2b00f346c1e..60dbdc5523e 100644
--- a/components/script/dom/browsercontext.rs
+++ b/components/script/dom/browsercontext.rs
@@ -48,8 +48,8 @@ impl BrowsingContext {
&*self.history[self.active_index].document
}
- pub fn active_window(&self) -> Root<Window> {
- Root::from_ref(self.active_document().window())
+ pub fn active_window(&self) -> &Window {
+ self.active_document().window()
}
pub fn frame_element(&self) -> Option<&Element> {
@@ -63,8 +63,8 @@ impl BrowsingContext {
#[allow(unsafe_code)]
pub fn create_window_proxy(&mut self) {
- let win = self.active_window();
- let win = win.r();
+ // We inline self.active_window() because we can't borrow *self here.
+ let win = self.history[self.active_index].document.window();
let WindowProxyHandler(handler) = win.windowproxy_handler();
assert!(!handler.is_null());
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 3b56b96ddb1..22598fbf844 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -1249,7 +1249,7 @@ impl Window {
// FIXME(https://github.com/rust-lang/rust/issues/23338)
let r = window.r();
let context = r.browsing_context();
- context.as_ref().unwrap().active_window()
+ Root::from_ref(context.as_ref().unwrap().active_window())
})
}
}