Bump js to get fix from servo/rust-mozjs#237

This commit is contained in:
Anthony Ramine 2016-02-08 18:20:17 +01:00
parent 5942e9e3cb
commit 71092e142d
6 changed files with 62 additions and 16 deletions

View file

@ -97,11 +97,15 @@ impl<T: Float + FromJSValConvertible<Config=()>> FromJSValConvertible for Finite
impl <T: Reflectable + IDLInterface> FromJSValConvertible for Root<T> {
type Config = ();
unsafe fn from_jsval(_cx: *mut JSContext,
unsafe fn from_jsval(cx: *mut JSContext,
value: HandleValue,
_config: Self::Config)
-> Result<Root<T>, ()> {
root_from_handlevalue(value)
-> Result<Root<T>, ()> {
let result = root_from_handlevalue(value);
if let Err(()) = result {
throw_type_error(cx, "value is not an object");
}
result
}
}
@ -323,16 +327,24 @@ pub fn root_from_object<T>(obj: *mut JSObject) -> Result<Root<T>, ()>
}
/// Get a `*const T` for a DOM object accessible from a `HandleValue`.
/// Caller is responsible for throwing a JS exception if needed in case of error.
pub fn native_from_handlevalue<T>(v: HandleValue) -> Result<*const T, ()>
where T: Reflectable + IDLInterface
{
if !v.get().is_object() {
return Err(());
}
native_from_object(v.get().to_object())
}
/// Get a `Root<T>` for a DOM object accessible from a `HandleValue`.
/// Caller is responsible for throwing a JS exception if needed in case of error.
pub fn root_from_handlevalue<T>(v: HandleValue) -> Result<Root<T>, ()>
where T: Reflectable + IDLInterface
{
if !v.get().is_object() {
return Err(());
}
root_from_object(v.get().to_object())
}