mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
Simplify the implementation of cx_for_dom_reflector.
This commit is contained in:
parent
f963ed99ac
commit
954ab7a2e3
1 changed files with 2 additions and 6 deletions
|
@ -591,12 +591,8 @@ pub fn global_object_for_js_object(obj: *mut JSObject) -> JS<window::Window> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cx_for_dom_reflector(obj: *mut JSObject) -> *mut JSContext {
|
fn cx_for_dom_reflector(obj: *mut JSObject) -> *mut JSContext {
|
||||||
let win = global_object_for_js_object(obj).root();
|
let global = global_object_for_js_object(obj).root();
|
||||||
let js_info = win.deref().page().js_info();
|
global.get_cx()
|
||||||
match *js_info {
|
|
||||||
Some(ref info) => info.js_context.deref().deref().ptr,
|
|
||||||
None => fail!("no JS context for DOM global")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *mut JSContext {
|
pub fn cx_for_dom_object<T: Reflectable>(obj: &T) -> *mut JSContext {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue