mirror of
https://github.com/servo/servo.git
synced 2025-08-01 11:40:30 +01:00
Auto merge of #9606 - servo:bump-js, r=Ms2ger
Bump js to get fix from servo/rust-mozjs#237 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9606) <!-- Reviewable:end -->
This commit is contained in:
commit
a746522b58
6 changed files with 62 additions and 16 deletions
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue