mirror of
https://github.com/servo/servo.git
synced 2025-06-21 07:38:59 +01:00
Remove all traces of Box representation from bindings. Work around file read runtime problem.
This commit is contained in:
parent
bbac8aa5c3
commit
f279abbf9f
8 changed files with 31 additions and 45 deletions
|
@ -17,7 +17,6 @@ use std::ptr;
|
|||
use std::ptr::null;
|
||||
use std::str;
|
||||
use std::vec;
|
||||
use std::raw::Box;
|
||||
use js::glue::*;
|
||||
use js::glue::{js_IsObjectProxyClass, js_IsFunctionProxyClass, IsProxyHandlerFamily};
|
||||
use js::jsapi::{JS_AlreadyHasOwnProperty, JS_NewFunction};
|
||||
|
@ -121,10 +120,10 @@ pub fn unwrap_object<T>(obj: *JSObject, proto_id: PrototypeList::id::ID, proto_d
|
|||
pub fn unwrap_jsmanaged<T: Reflectable>(obj: *JSObject,
|
||||
proto_id: PrototypeList::id::ID,
|
||||
proto_depth: uint) -> Result<JS<T>, ()> {
|
||||
let result: Result<*mut Box<T>, ()> = unwrap_object(obj, proto_id, proto_depth);
|
||||
let result: Result<*mut T, ()> = unwrap_object(obj, proto_id, proto_depth);
|
||||
result.map(|unwrapped| {
|
||||
unsafe {
|
||||
JS::from_box(unwrapped)
|
||||
JS::from_raw(unwrapped)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -136,10 +135,6 @@ pub fn unwrap_value<T>(val: *JSVal, proto_id: PrototypeList::id::ID, proto_depth
|
|||
}
|
||||
}
|
||||
|
||||
pub unsafe fn squirrel_away_unique<T>(x: ~T) -> *Box<T> {
|
||||
cast::transmute(x)
|
||||
}
|
||||
|
||||
pub unsafe fn squirrel_away_unboxed<T>(x: ~T) -> *T {
|
||||
cast::transmute(x)
|
||||
}
|
||||
|
@ -437,7 +432,6 @@ pub fn reflect_dom_object<T: Reflectable>
|
|||
#[deriving(Eq)]
|
||||
pub struct Reflector {
|
||||
object: *JSObject,
|
||||
force_box_layout: @int,
|
||||
}
|
||||
|
||||
impl Reflector {
|
||||
|
@ -455,7 +449,6 @@ impl Reflector {
|
|||
pub fn new() -> Reflector {
|
||||
Reflector {
|
||||
object: ptr::null(),
|
||||
force_box_layout: @1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -651,8 +644,8 @@ pub fn global_object_for_js_object(obj: *JSObject) -> JS<window::Window> {
|
|||
let clasp = JS_GetClass(global);
|
||||
assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0);
|
||||
// FIXME(jdm): Either don't hardcode or sanity assert prototype stuff.
|
||||
match unwrap_object::<*mut Box<window::Window>>(global, PrototypeList::id::Window, 1) {
|
||||
Ok(win) => JS::from_box(win),
|
||||
match unwrap_object::<*mut window::Window>(global, PrototypeList::id::Window, 1) {
|
||||
Ok(win) => JS::from_raw(win),
|
||||
Err(_) => fail!("found DOM global that doesn't unwrap to Window"),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue