Library changes

This commit is contained in:
Keegan McAllister 2013-08-09 13:24:10 -07:00
parent ffe60ea027
commit be061a9aa0
45 changed files with 167 additions and 183 deletions

View file

@ -21,8 +21,6 @@ use std::libc::c_uint;
use std::comm;
use std::ptr;
use std::ptr::null;
use std::result;
use std::str;
use js::glue::*;
use js::jsapi::*;
use js::jsapi::{JSContext, JSVal, JSObject, JSBool, JSFreeOp, JSPropertySpec};
@ -49,14 +47,14 @@ pub extern fn trace(tracer: *mut JSTracer, obj: *JSObject) {
return;
}
error!("tracing %s", name);
let mut node = node.get();
let mut node = node.unwrap();
let cache = node.get_wrappercache();
let wrapper = cache.get_wrapper();
assert!(wrapper.is_not_null());
unsafe {
(*tracer).debugPrinter = ptr::null();
(*tracer).debugPrintIndex = -1;
do str::as_c_str(name) |name| {
do name.as_c_str |name| {
(*tracer).debugPrintArg = name as *libc::c_void;
JS_CallTracer(cast::transmute(tracer), wrapper, JSTRACE_OBJECT as u32);
}
@ -194,14 +192,14 @@ extern fn setAttribute(cx: *JSContext, argc: c_uint, vp: *JSVal) -> JSBool {
if strval.is_err() {
return 0;
}
arg0 = str(strval.get());
arg0 = str(strval.unwrap());
let arg1: DOMString;
let strval = jsval_to_str(cx, (*argv.offset(1)));
if strval.is_err() {
return 0;
}
arg1 = str(strval.get());
arg1 = str(strval.unwrap());
do node.as_mut_element |elem| {
elem.set_attr(&arg0, &arg1);
@ -293,9 +291,9 @@ pub fn create(cx: *JSContext, node: &mut AbstractNode<ScriptView>) -> jsobj {
//XXXjdm the parent should probably be the node parent instead of the global
//TODO error checking
let compartment = utils::get_compartment(cx);
let obj = result::unwrap(compartment.new_object_with_proto(~"GenericElementInstance",
proto,
compartment.global_obj.ptr));
let obj = compartment.new_object_with_proto(~"GenericElementInstance",
proto,
compartment.global_obj.ptr).unwrap();
let cache = node.get_wrappercache();
assert!(cache.get_wrapper().is_null());