Use DOMString in a few more places in utils.rs.

This commit is contained in:
Ms2ger 2014-02-16 09:50:29 +01:00
parent 6cc8a4dfba
commit 68f534c45a

View file

@ -186,7 +186,7 @@ pub unsafe fn squirrel_away<T>(x: @mut T) -> *Box<T> {
y y
} }
pub fn jsstring_to_str(cx: *JSContext, s: *JSString) -> ~str { pub fn jsstring_to_str(cx: *JSContext, s: *JSString) -> DOMString {
unsafe { unsafe {
let length = 0; let length = 0;
let chars = JS_GetStringCharsAndLength(cx, s, &length); let chars = JS_GetStringCharsAndLength(cx, s, &length);
@ -196,7 +196,7 @@ pub fn jsstring_to_str(cx: *JSContext, s: *JSString) -> ~str {
} }
} }
pub fn jsid_to_str(cx: *JSContext, id: jsid) -> ~str { pub fn jsid_to_str(cx: *JSContext, id: jsid) -> DOMString {
unsafe { unsafe {
assert!(RUST_JSID_IS_STRING(id) != 0); assert!(RUST_JSID_IS_STRING(id) != 0);
jsstring_to_str(cx, RUST_JSID_TO_STRING(id)) jsstring_to_str(cx, RUST_JSID_TO_STRING(id))
@ -210,7 +210,7 @@ pub enum StringificationBehavior {
} }
pub fn jsval_to_str(cx: *JSContext, v: JSVal, pub fn jsval_to_str(cx: *JSContext, v: JSVal,
nullBehavior: StringificationBehavior) -> Result<~str, ()> { nullBehavior: StringificationBehavior) -> Result<DOMString, ()> {
if jsval::is_null(v) && nullBehavior == Empty { if jsval::is_null(v) && nullBehavior == Empty {
Ok(~"") Ok(~"")
} else { } else {