aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/dom/browsercontext.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2014-04-10 17:11:08 -0400
committerJosh Matthews <josh@joshmatthews.net>2014-05-03 14:18:30 -0400
commitdfdda0098a3f169a37c100b36d4dd36ec1d815aa (patch)
treeb4835f3c863c6e45849cf036faf5611925e10189 /src/components/script/dom/browsercontext.rs
parentd7b96db33ca8f2b8a162df38e0f00e95f5ea6fa1 (diff)
downloadservo-dfdda0098a3f169a37c100b36d4dd36ec1d815aa.tar.gz
servo-dfdda0098a3f169a37c100b36d4dd36ec1d815aa.zip
Remove JS::get/get_mut to enforce sound rooting practices.
Diffstat (limited to 'src/components/script/dom/browsercontext.rs')
-rw-r--r--src/components/script/dom/browsercontext.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/components/script/dom/browsercontext.rs b/src/components/script/dom/browsercontext.rs
index fbb63420520..4a452ccd2ae 100644
--- a/src/components/script/dom/browsercontext.rs
+++ b/src/components/script/dom/browsercontext.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use dom::bindings::js::{JS, JSRef};
+use dom::bindings::js::{JS, JSRef, Unrooted, RootCollection};
use dom::bindings::trace::Traceable;
use dom::bindings::utils::Reflectable;
use dom::document::Document;
@@ -32,13 +32,14 @@ impl BrowserContext {
context
}
- pub fn active_document(&self) -> JS<Document> {
- self.history.get(self.active_index).document.clone()
+ pub fn active_document(&self) -> Unrooted<Document> {
+ Unrooted::new(self.history.get(self.active_index).document.clone())
}
- pub fn active_window(&self) -> JS<Window> {
- let doc = self.active_document();
- doc.get().window.clone()
+ pub fn active_window(&self) -> Unrooted<Window> {
+ let roots = RootCollection::new();
+ let doc = self.active_document().root(&roots);
+ Unrooted::new(doc.deref().window.clone())
}
pub fn window_proxy(&self) -> *JSObject {
@@ -47,7 +48,8 @@ impl BrowserContext {
}
pub fn create_window_proxy(&self) -> *JSObject {
- let win = self.active_window();
+ let roots = RootCollection::new();
+ let win = self.active_window().root(&roots);
let page = win.get().page();
let js_info = page.js_info();