mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Pass &JS<Window> to reflect_dom_object.
This commit is contained in:
parent
6291aac170
commit
23b7277b54
23 changed files with 26 additions and 26 deletions
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use dom::bindings::utils::{Reflector, Reflectable};
|
||||
use dom::window;
|
||||
use dom::window::Window;
|
||||
use js::jsapi::{JSContext, JSObject};
|
||||
use layout_interface::TrustedNodeAddress;
|
||||
|
||||
|
@ -31,10 +31,10 @@ impl <T> Clone for JS<T> {
|
|||
|
||||
impl<T: Reflectable> JS<T> {
|
||||
pub fn new(mut obj: ~T,
|
||||
window: &window::Window,
|
||||
window: &JS<Window>,
|
||||
wrap_fn: extern "Rust" fn(*JSContext, *JSObject, ~T) -> *JSObject) -> JS<T> {
|
||||
let cx = window.get_cx();
|
||||
let scope = window.reflector().get_jsobject();
|
||||
let cx = window.get().get_cx();
|
||||
let scope = window.get().reflector().get_jsobject();
|
||||
let raw: *mut T = &mut *obj;
|
||||
if wrap_fn(cx, scope, obj).is_null() {
|
||||
fail!("Could not eagerly wrap object");
|
||||
|
|
|
@ -493,7 +493,7 @@ pub trait Reflectable {
|
|||
|
||||
pub fn reflect_dom_object<T: Reflectable>
|
||||
(obj: ~T,
|
||||
window: &window::Window,
|
||||
window: &JS<window::Window>,
|
||||
wrap_fn: extern "Rust" fn(*JSContext, *JSObject, ~T) -> *JSObject)
|
||||
-> JS<T> {
|
||||
JS::new(obj, window, wrap_fn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue