mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Use the try macro in unwrap_jsmanaged.
This commit is contained in:
parent
58e7b8c154
commit
e1dae2f59b
1 changed files with 9 additions and 11 deletions
|
@ -127,7 +127,7 @@ pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
|
|||
proto_id: PrototypeList::ID,
|
||||
proto_depth: uint) -> Result<JS<T>, ()> {
|
||||
unsafe {
|
||||
let dom_class = get_dom_class(obj).or_else(|_| {
|
||||
let dom_class = try!(get_dom_class(obj).or_else(|_| {
|
||||
if IsWrapper(obj) == 1 {
|
||||
debug!("found wrapper");
|
||||
obj = UnwrapObject(obj, /* stopAtOuter = */ 0, ptr::null_mut());
|
||||
|
@ -143,9 +143,8 @@ pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
|
|||
debug!("not a dom wrapper");
|
||||
Err(())
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
dom_class.and_then(|dom_class| {
|
||||
if dom_class.interface_chain[proto_depth] == proto_id {
|
||||
debug!("good prototype");
|
||||
Ok(JS::from_raw(unwrap(obj)))
|
||||
|
@ -153,7 +152,6 @@ pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
|
|||
debug!("bad prototype");
|
||||
Err(())
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue