diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-08-24 15:29:12 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-08-25 15:46:43 +0200 |
commit | f70fa989547a256255ae74264ac6e906709b72f4 (patch) | |
tree | f49beefd8ad801a6950f3762783774565a70fccf /components/script/dom/bindings/utils.rs | |
parent | fbc8938bee86cdc8c9427092b8b2c5dd8286a47b (diff) | |
download | servo-f70fa989547a256255ae74264ac6e906709b72f4.tar.gz servo-f70fa989547a256255ae74264ac6e906709b72f4.zip |
Make has_property_on_prototype fallible
Diffstat (limited to 'components/script/dom/bindings/utils.rs')
-rw-r--r-- | components/script/dom/bindings/utils.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs index 53b69fc0b40..666dba519a4 100644 --- a/components/script/dom/bindings/utils.rs +++ b/components/script/dom/bindings/utils.rs @@ -284,12 +284,15 @@ pub fn set_dictionary_property(cx: *mut JSContext, /// Returns whether `proxy` has a property `id` on its prototype. pub unsafe fn has_property_on_prototype(cx: *mut JSContext, proxy: HandleObject, - id: HandleId) + id: HandleId, + found: &mut bool) -> bool { - let mut found = false; - !get_property_on_prototype( - cx, proxy, id, &mut found, - MutableHandleValue::from_marked_location(ptr::null_mut())) || found + rooted!(in(cx) let mut proto = ptr::null_mut()); + if !JS_GetPrototype(cx, proxy, proto.handle_mut()) { + return false; + } + assert!(!proto.is_null()); + JS_HasPropertyById(cx, proto.handle(), id, found) } /// Drop the resources held by reserved slots of a global object |