diff options
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/bindings/utils.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index f598068fa53..4f12d1dbc7d 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -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,17 +143,15 @@ 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))) - } else { - debug!("bad prototype"); - Err(()) - } - }) + })); + + if dom_class.interface_chain[proto_depth] == proto_id { + debug!("good prototype"); + Ok(JS::from_raw(unwrap(obj))) + } else { + debug!("bad prototype"); + Err(()) + } } } |