diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index 131c6231b8c..43112882b94 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -51,7 +51,7 @@ use js::jsapi::JS_EvaluateUCScript;
use js::jsapi::JSContext;
use js::jsapi::{JS_GC, JS_GetRuntime};
use js::jsval::{JSVal, UndefinedValue};
-use js::rust::{Cx, with_compartment};
+use js::rust::{Runtime, with_compartment};
use url::{Url, UrlParser};
use libc;
@@ -133,8 +133,8 @@ pub struct Window {
/// Global static data related to the DOM.
dom_static: GlobalStaticData,
- /// The JavaScript context.
- js_context: DOMRefCell>>,
+ /// The JavaScript runtime.
+ js_runtime: DOMRefCell >,
/// A handle for communicating messages to the layout task.
layout_chan: LayoutChan,
@@ -170,15 +170,15 @@ pub struct Window {
impl Window {
#[allow(unsafe_code)]
- pub fn clear_js_context_for_script_deallocation(&self) {
+ pub fn clear_js_runtime_for_script_deallocation(&self) {
unsafe {
- *self.js_context.borrow_for_script_deallocation() = None;
+ *self.js_runtime.borrow_for_script_deallocation() = None;
*self.browser_context.borrow_for_script_deallocation() = None;
}
}
pub fn get_cx(&self) -> *mut JSContext {
- self.js_context.borrow().as_ref().unwrap().ptr
+ self.js_runtime.borrow().as_ref().unwrap().cx()
}
pub fn script_chan(&self) -> Box {
@@ -486,7 +486,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
}
pub trait WindowHelpers {
- fn clear_js_context(self);
+ fn clear_js_runtime(self);
fn init_browser_context(self, doc: JSRef, frame_element: Option>);
fn load_url(self, href: DOMString);
fn handle_fire_timer(self, timer_id: TimerId);
@@ -559,11 +559,11 @@ impl<'a, T: Reflectable> ScriptHelpers for JSRef<'a, T> {
}
impl<'a> WindowHelpers for JSRef<'a, Window> {
- fn clear_js_context(self) {
+ fn clear_js_runtime(self) {
let document = self.Document().root();
NodeCast::from_ref(document.r()).teardown();
- *self.js_context.borrow_mut() = None;
+ *self.js_runtime.borrow_mut() = None;
*self.browser_context.borrow_mut() = None;
}
@@ -883,7 +883,7 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
}
impl Window {
- pub fn new(js_context: Rc,
+ pub fn new(runtime: Runtime,
page: Rc,
script_chan: Box,
image_cache_chan: ImageCacheChan,
@@ -929,7 +929,7 @@ impl Window {
id: id,
parent_info: parent_info,
dom_static: GlobalStaticData::new(),
- js_context: DOMRefCell::new(Some(js_context.clone())),
+ js_runtime: DOMRefCell::new(Some(runtime.clone())),
resource_task: resource_task,
storage_task: storage_task,
constellation_chan: constellation_chan,
@@ -949,7 +949,7 @@ impl Window {
devtools_wants_updates: Cell::new(false),
};
- WindowBinding::Wrap(js_context.ptr, win)
+ WindowBinding::Wrap(runtime.cx(), win)
}
}
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 926d8567b46..89dcb5e6a61 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -346,7 +346,7 @@ impl<'a> Drop for ScriptMemoryFailsafe<'a> {
let page = owner.page.borrow_for_script_deallocation();
for page in page.iter() {
let window = page.window_for_script_deallocation();
- (*window.unsafe_get()).clear_js_context_for_script_deallocation();
+ (*window.unsafe_get()).clear_js_runtime_for_script_deallocation();
}
}
}
@@ -1117,7 +1117,7 @@ impl ScriptTask {
let mut page_remover = AutoPageRemover::new(self, page_to_remove);
// Create the window and document objects.
- let window = Window::new(self.js_runtime.cx.clone(),
+ let window = Window::new(self.js_runtime.clone(),
page.clone(),
self.chan.clone(),
self.image_cache_channel.clone(),
@@ -1493,7 +1493,7 @@ fn shut_down_layout(page_tree: &Rc, exit_type: PipelineExitType) {
// Drop our references to the JSContext and DOM objects.
for page in page_tree.iter() {
let window = page.window().root();
- window.r().clear_js_context();
+ window.r().clear_js_runtime();
// Sever the connection between the global and the DOM tree
page.set_frame(None);
}