Clean up property existence check inconsistencies (#1860)

`jerry_has_property ()` and `jerry_has_own_property ()` are inconsistent
in that they squash their return value into a `bool` when in fact it is
a `jerry_value_t`, thereby giving the wrong impression that a property
is there when it isn't and encouraging the leaking of `jerry_value_t`s
by disguising them as `bool`s.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1859

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
This commit is contained in:
Gabriel "_|Nix|_" Schulhof
2017-05-29 16:54:32 +03:00
committed by László Langó
parent b51b6824bb
commit 708b155f38
4 changed files with 92 additions and 11 deletions
+2 -2
View File
@@ -354,8 +354,8 @@ jerry_value_t jerry_create_undefined (void);
/**
* General API functions of JS objects.
*/
bool jerry_has_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
bool jerry_has_own_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
jerry_value_t jerry_has_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
jerry_value_t jerry_has_own_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
bool jerry_delete_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
jerry_value_t jerry_get_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);