Correctly report error in for-in start in case of proxies (#4165)

In case of Proxies the "ownKeys" call can return an incompatible
value for a for-in statement. In such cases the error should be
propagated to the user.

Fixes: #4159

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-08-28 12:46:35 +02:00
committed by GitHub
parent a470fef8a5
commit 4ed9e2c033
4 changed files with 109 additions and 6 deletions
+8
View File
@@ -3737,6 +3737,14 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (prop_names_p == NULL)
{
#if ENABLED (JERRY_ESNEXT)
if (JERRY_UNLIKELY (ECMA_IS_VALUE_ERROR (expr_obj_value)))
{
result = expr_obj_value;
goto error;
}
#endif /* ENABLED (JERRY_ESNEXT) */
/* The collection is already released */
byte_code_p = byte_code_start_p + branch_offset;
continue;