Stop sticking a Page in the JSContext's private.

This commit is contained in:
Ms2ger 2014-03-05 21:04:57 +01:00
parent 14f679d455
commit 57be68ca8b
2 changed files with 2 additions and 18 deletions

View file

@ -5262,7 +5262,7 @@ class CGBindingRoot(CGThing):
'dom::bindings::codegen::*', #XXXjdm 'dom::bindings::codegen::*', #XXXjdm
'dom::bindings::codegen::UnionTypes::*', #XXXjdm 'dom::bindings::codegen::UnionTypes::*', #XXXjdm
'dom::bindings::codegen::UnionConversions::*', #XXXjdm 'dom::bindings::codegen::UnionConversions::*', #XXXjdm
'script_task::{JSPageInfo, page_from_context}', 'script_task::JSPageInfo',
'dom::bindings::proxyhandler', 'dom::bindings::proxyhandler',
'dom::bindings::proxyhandler::*', 'dom::bindings::proxyhandler::*',
'servo_util::str::DOMString', 'servo_util::str::DOMString',

View file

@ -35,8 +35,7 @@ use geom::size::Size2D;
use js::JSVAL_NULL; use js::JSVAL_NULL;
use js::global::DEBUG_FNS; use js::global::DEBUG_FNS;
use js::glue::RUST_JSVAL_TO_OBJECT; use js::glue::RUST_JSVAL_TO_OBJECT;
use js::jsapi::{JSContext, JSObject, JS_InhibitGC, JS_AllowGC}; use js::jsapi::{JSObject, JS_InhibitGC, JS_AllowGC, JS_CallFunctionValue};
use js::jsapi::{JS_CallFunctionValue, JS_GetContextPrivate};
use js::rust::{Compartment, Cx, CxUtils, RtUtils}; use js::rust::{Compartment, Cx, CxUtils, RtUtils};
use js; use js;
use servo_msg::compositor_msg::{FinishedLoading, Loading, PerformingLayout, ScriptListener}; use servo_msg::compositor_msg::{FinishedLoading, Loading, PerformingLayout, ScriptListener};
@ -420,15 +419,7 @@ impl Page {
Err(()) => fail!("Failed to create a compartment"), Err(()) => fail!("Failed to create a compartment"),
}; };
// Indirection for Rust Issue #6248, dynamic freeze scope artifically extended
let page_ptr = {
let borrowed_page = &*self;
borrowed_page as *Page
};
unsafe { unsafe {
js_context.borrow().set_cx_private(page_ptr as *());
JS_InhibitGC(js_context.borrow().ptr); JS_InhibitGC(js_context.borrow().ptr);
} }
@ -489,13 +480,6 @@ pub struct ScriptTask {
mouse_over_targets: RefCell<Option<~[JS<Node>]>> mouse_over_targets: RefCell<Option<~[JS<Node>]>>
} }
/// Returns the relevant page from the associated JS Context.
pub fn page_from_context(js_context: *JSContext) -> *Page {
unsafe {
JS_GetContextPrivate(js_context) as *Page
}
}
impl ScriptTask { impl ScriptTask {
/// Creates a new script task. /// Creates a new script task.
pub fn new(id: PipelineId, pub fn new(id: PipelineId,