mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
update servo for language change
This commit is contained in:
parent
e7859efa10
commit
c1773f0c70
7 changed files with 21 additions and 20 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 19a4939e13f2387cb7831623480d91301092c202
|
||||
Subproject commit bfe6b9544ff0df852bdca16a68770b9381e5f35c
|
|
@ -2439,7 +2439,7 @@ def CreateBindingJSObject(descriptor, parent):
|
|||
let handler = (*content).dom_static.proxy_handlers.get(&(prototypes::id::%s as uint));
|
||||
""" % descriptor.name
|
||||
create = handler + """ let obj = NewProxyObject(aCx, *handler,
|
||||
ptr::addr_of(&RUST_PRIVATE_TO_JSVAL(squirrel_away(aObject) as *libc::c_void)),
|
||||
ptr::to_unsafe_ptr(&RUST_PRIVATE_TO_JSVAL(squirrel_away(aObject) as *libc::c_void)),
|
||||
proto, %s,
|
||||
ptr::null(), ptr::null());
|
||||
if obj.is_null() {
|
||||
|
@ -2859,7 +2859,7 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
|||
getPrototypeOf: ptr::null()
|
||||
};
|
||||
(*content).dom_static.proxy_handlers.insert(prototypes::id::%s as uint,
|
||||
CreateProxyHandler(ptr::addr_of(&traps)));
|
||||
CreateProxyHandler(ptr::to_unsafe_ptr(&traps)));
|
||||
|
||||
""" % self.descriptor.name
|
||||
else:
|
||||
|
@ -3607,7 +3607,7 @@ def finalizeHook(descriptor, hookName, context):
|
|||
else:
|
||||
assert descriptor.nativeIsISupports
|
||||
release = """let val = JS_GetReservedSlot(obj, 0);
|
||||
let _: %s = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
|
||||
let _: %s = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
|
||||
""" % (descriptor.pointerType + descriptor.nativeType)
|
||||
#return clearWrapper + release
|
||||
return release
|
||||
|
|
|
@ -25,7 +25,7 @@ use dom::bindings::utils;
|
|||
|
||||
extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
|
||||
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
|
||||
if obj.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
|
|||
debug!("document finalize!");
|
||||
unsafe {
|
||||
let val = JS_GetReservedSlot(obj, 0);
|
||||
let _doc: @Document = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
|
||||
let _doc: @Document = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ pub fn create(compartment: @mut Compartment, doc: @mut Document) -> *JSObject {
|
|||
doc.wrapper.set_wrapper(instance.ptr);
|
||||
|
||||
unsafe {
|
||||
let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(doc));
|
||||
let raw_ptr: *libc::c_void = cast::transmute(squirrel_away(doc));
|
||||
JS_SetReservedSlot(instance.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
|
|||
#[allow(non_implicitly_copyable_typarams)]
|
||||
extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
|
||||
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
|
||||
if obj.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
|
|||
match node.type_id() {
|
||||
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
||||
do node.as_mut_element |elem| {
|
||||
let arg = ptr::offset(JS_ARGV(cx, cast::reinterpret_cast(&vp)), 0);
|
||||
let arg = ptr::offset(JS_ARGV(cx, cast::transmute(vp)), 0);
|
||||
elem.set_attr(&str(~"width"),
|
||||
&str((RUST_JSVAL_TO_INT(*arg) as int).to_str()))
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
|
|||
|
||||
extern fn getTagName(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
|
||||
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
|
||||
if obj.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ pub unsafe fn unwrap(obj: *JSObject) -> AbstractNode {
|
|||
#[allow(non_implicitly_copyable_typarams)]
|
||||
extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
|
||||
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
|
||||
if obj.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool
|
|||
#[allow(non_implicitly_copyable_typarams)]
|
||||
extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
|
||||
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
|
||||
if obj.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ impl Node {
|
|||
|
||||
extern fn getNodeType(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
|
||||
unsafe {
|
||||
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp));
|
||||
let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
|
||||
if obj.is_null() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ use core::cast;
|
|||
use content::content_task::task_from_context;
|
||||
|
||||
use core::hashmap::HashMap;
|
||||
use core::ptr::to_unsafe_ptr;
|
||||
|
||||
use dom::bindings::node;
|
||||
use dom::node::AbstractNode;
|
||||
|
@ -64,7 +65,7 @@ extern fn InterfaceObjectToString(cx: *JSContext, _argc: uint, vp: *mut JSVal) -
|
|||
}
|
||||
|
||||
let v = GetFunctionNativeReserved(callee, TOSTRING_CLASS_RESERVED_SLOT);
|
||||
let clasp: *JSClass = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(*v));
|
||||
let clasp: *JSClass = cast::transmute(RUST_JSVAL_TO_PRIVATE(*v));
|
||||
|
||||
let v = GetFunctionNativeReserved(callee, TOSTRING_NAME_RESERVED_SLOT);
|
||||
|
||||
|
@ -125,7 +126,7 @@ pub unsafe fn unwrap<T>(obj: *JSObject) -> T {
|
|||
}
|
||||
|
||||
pub unsafe fn squirrel_away<T>(x: @mut T) -> *rust_box<T> {
|
||||
let y: *rust_box<T> = cast::reinterpret_cast(&x);
|
||||
let y: *rust_box<T> = cast::transmute(x);
|
||||
cast::forget(x);
|
||||
y
|
||||
}
|
||||
|
@ -157,7 +158,7 @@ pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal {
|
|||
}
|
||||
&str(ref s) => {
|
||||
str::as_buf(*s, |buf, len| {
|
||||
let cbuf = cast::reinterpret_cast(&buf);
|
||||
let cbuf = cast::transmute(buf);
|
||||
RUST_STRING_TO_JSVAL(JS_NewStringCopyN(cx, cbuf, len as libc::size_t))
|
||||
})
|
||||
}
|
||||
|
@ -572,7 +573,7 @@ pub impl WrapperCache {
|
|||
}
|
||||
|
||||
fn get_rootable(&self) -> **JSObject {
|
||||
return ptr::addr_of(&self.wrapper);
|
||||
return to_unsafe_ptr(&self.wrapper);
|
||||
}
|
||||
|
||||
fn new() -> WrapperCache {
|
||||
|
|
|
@ -74,14 +74,14 @@ extern fn gc(cx: *JSContext, _argc: c_uint, _vp: *JSVal) -> JSBool {
|
|||
|
||||
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> {
|
||||
let val = JS_GetReservedSlot(obj, 0);
|
||||
cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val))
|
||||
cast::transmute(RUST_JSVAL_TO_PRIVATE(val))
|
||||
}
|
||||
|
||||
extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
|
||||
debug!("finalize!");
|
||||
unsafe {
|
||||
let val = JS_GetReservedSlot(obj, 0);
|
||||
let _: @Window = cast::reinterpret_cast(&RUST_JSVAL_TO_PRIVATE(val));
|
||||
let _: @Window = cast::transmute(RUST_JSVAL_TO_PRIVATE(val));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ pub fn create(compartment: @mut Compartment, win: @mut Window) {
|
|||
win.get_wrappercache().set_wrapper(obj.ptr);
|
||||
|
||||
unsafe {
|
||||
let raw_ptr: *libc::c_void = cast::reinterpret_cast(&squirrel_away(win));
|
||||
let raw_ptr: *libc::c_void = cast::transmute(squirrel_away(win));
|
||||
JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue