update servo for language change

This commit is contained in:
aydinkim 2013-05-02 14:30:14 +09:00
parent e7859efa10
commit c1773f0c70
7 changed files with 21 additions and 20 deletions

@ -1 +1 @@
Subproject commit 19a4939e13f2387cb7831623480d91301092c202 Subproject commit bfe6b9544ff0df852bdca16a68770b9381e5f35c

View file

@ -2439,7 +2439,7 @@ def CreateBindingJSObject(descriptor, parent):
let handler = (*content).dom_static.proxy_handlers.get(&(prototypes::id::%s as uint)); let handler = (*content).dom_static.proxy_handlers.get(&(prototypes::id::%s as uint));
""" % descriptor.name """ % descriptor.name
create = handler + """ let obj = NewProxyObject(aCx, *handler, 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, proto, %s,
ptr::null(), ptr::null()); ptr::null(), ptr::null());
if obj.is_null() { if obj.is_null() {
@ -2859,7 +2859,7 @@ class CGDefineDOMInterfaceMethod(CGAbstractMethod):
getPrototypeOf: ptr::null() getPrototypeOf: ptr::null()
}; };
(*content).dom_static.proxy_handlers.insert(prototypes::id::%s as uint, (*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 """ % self.descriptor.name
else: else:
@ -3607,7 +3607,7 @@ def finalizeHook(descriptor, hookName, context):
else: else:
assert descriptor.nativeIsISupports assert descriptor.nativeIsISupports
release = """let val = JS_GetReservedSlot(obj, 0); 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) """ % (descriptor.pointerType + descriptor.nativeType)
#return clearWrapper + release #return clearWrapper + release
return release return release

View file

@ -25,7 +25,7 @@ use dom::bindings::utils;
extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool { extern fn getDocumentElement(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe { unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp)); let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() { if obj.is_null() {
return 0; return 0;
} }
@ -77,7 +77,7 @@ extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
debug!("document finalize!"); debug!("document finalize!");
unsafe { unsafe {
let val = JS_GetReservedSlot(obj, 0); 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); doc.wrapper.set_wrapper(instance.ptr);
unsafe { 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)); JS_SetReservedSlot(instance.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
} }

View file

@ -240,7 +240,7 @@ extern fn HTMLImageElement_getWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
#[allow(non_implicitly_copyable_typarams)] #[allow(non_implicitly_copyable_typarams)]
extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool { extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe { unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp)); let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() { if obj.is_null() {
return 0; return 0;
} }
@ -249,7 +249,7 @@ extern fn HTMLImageElement_setWidth(cx: *JSContext, _argc: c_uint, vp: *mut JSVa
match node.type_id() { match node.type_id() {
ElementNodeTypeId(HTMLImageElementTypeId) => { ElementNodeTypeId(HTMLImageElementTypeId) => {
do node.as_mut_element |elem| { 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"), elem.set_attr(&str(~"width"),
&str((RUST_JSVAL_TO_INT(*arg) as int).to_str())) &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 { extern fn getTagName(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe { unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp)); let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() { if obj.is_null() {
return 0; return 0;
} }

View file

@ -74,7 +74,7 @@ pub unsafe fn unwrap(obj: *JSObject) -> AbstractNode {
#[allow(non_implicitly_copyable_typarams)] #[allow(non_implicitly_copyable_typarams)]
extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool { extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe { unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp)); let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() { if obj.is_null() {
return 0; return 0;
} }
@ -96,7 +96,7 @@ extern fn getFirstChild(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool
#[allow(non_implicitly_copyable_typarams)] #[allow(non_implicitly_copyable_typarams)]
extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool { extern fn getNextSibling(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe { unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp)); let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() { if obj.is_null() {
return 0; return 0;
} }
@ -146,7 +146,7 @@ impl Node {
extern fn getNodeType(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool { extern fn getNodeType(cx: *JSContext, _argc: c_uint, vp: *mut JSVal) -> JSBool {
unsafe { unsafe {
let obj = JS_THIS_OBJECT(cx, cast::reinterpret_cast(&vp)); let obj = JS_THIS_OBJECT(cx, cast::transmute(vp));
if obj.is_null() { if obj.is_null() {
return 0; return 0;
} }

View file

@ -29,6 +29,7 @@ use core::cast;
use content::content_task::task_from_context; use content::content_task::task_from_context;
use core::hashmap::HashMap; use core::hashmap::HashMap;
use core::ptr::to_unsafe_ptr;
use dom::bindings::node; use dom::bindings::node;
use dom::node::AbstractNode; 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 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); 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> { 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); cast::forget(x);
y y
} }
@ -157,7 +158,7 @@ pub unsafe fn domstring_to_jsval(cx: *JSContext, string: &DOMString) -> JSVal {
} }
&str(ref s) => { &str(ref s) => {
str::as_buf(*s, |buf, len| { 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)) 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 { fn get_rootable(&self) -> **JSObject {
return ptr::addr_of(&self.wrapper); return to_unsafe_ptr(&self.wrapper);
} }
fn new() -> WrapperCache { fn new() -> WrapperCache {

View file

@ -74,14 +74,14 @@ extern fn gc(cx: *JSContext, _argc: c_uint, _vp: *JSVal) -> JSBool {
unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> { unsafe fn unwrap(obj: *JSObject) -> *rust_box<Window> {
let val = JS_GetReservedSlot(obj, 0); 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) { extern fn finalize(_fop: *JSFreeOp, obj: *JSObject) {
debug!("finalize!"); debug!("finalize!");
unsafe { unsafe {
let val = JS_GetReservedSlot(obj, 0); 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); win.get_wrappercache().set_wrapper(obj.ptr);
unsafe { 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)); JS_SetReservedSlot(obj.ptr, 0, RUST_PRIVATE_TO_JSVAL(raw_ptr));
} }