Revise the usage of the global error value/exception flag (#3426)
This patch also fixes #3422. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
Zoltan Herczeg
parent
7c0b1ca88a
commit
9b33fc8cbd
@@ -137,8 +137,7 @@ ecma_builtin_generator_prototype_object_do (ecma_value_t this_arg, /**< this arg
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (arg))
|
||||
{
|
||||
arg = JERRY_CONTEXT (error_value);
|
||||
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_EXCEPTION;
|
||||
arg = jcontext_take_exception ();
|
||||
resume_mode = ECMA_ITERATOR_THROW;
|
||||
}
|
||||
}
|
||||
@@ -176,8 +175,7 @@ ecma_builtin_generator_prototype_object_do (ecma_value_t this_arg, /**< this arg
|
||||
if (ECMA_IS_VALUE_ERROR (iterator))
|
||||
{
|
||||
resume_mode = ECMA_ITERATOR_THROW;
|
||||
arg = JERRY_CONTEXT (error_value);
|
||||
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_EXCEPTION;
|
||||
arg = jcontext_take_exception ();
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,8 +127,7 @@ inline static ecma_value_t
|
||||
ecma_builtin_promise_reject_abrupt (ecma_value_t capability) /**< reject description */
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Second argument is not an array."));
|
||||
ecma_value_t reason = JERRY_CONTEXT (error_value);
|
||||
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_EXCEPTION;
|
||||
ecma_value_t reason = jcontext_take_exception ();
|
||||
ecma_string_t *reject_str_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_REJECT);
|
||||
ecma_value_t reject = ecma_op_object_get (ecma_get_object_from_value (capability), reject_str_p);
|
||||
|
||||
@@ -610,7 +609,7 @@ ecma_builtin_promise_race_or_all (ecma_value_t this_arg, /**< 'this' argument */
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ret))
|
||||
{
|
||||
ret = JERRY_CONTEXT (error_value);
|
||||
ret = jcontext_take_exception ();
|
||||
}
|
||||
|
||||
ecma_free_value (capability);
|
||||
|
||||
@@ -93,7 +93,14 @@ ecma_builtin_reflect_dispatch_routine (uint16_t builtin_routine_id, /**< built-i
|
||||
ecma_value_t result = ecma_builtin_object_object_set_prototype_of (arguments_list[0], arguments_list[1]);
|
||||
bool is_error = ECMA_IS_VALUE_ERROR (result);
|
||||
|
||||
ecma_free_value (is_error ? JERRY_CONTEXT (error_value) : result);
|
||||
if (is_error)
|
||||
{
|
||||
jcontext_release_exception ();
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_free_value (result);
|
||||
}
|
||||
|
||||
return ecma_make_boolean_value (!is_error);
|
||||
}
|
||||
@@ -121,7 +128,14 @@ ecma_builtin_reflect_dispatch_routine (uint16_t builtin_routine_id, /**< built-i
|
||||
ecma_deref_ecma_string (name_str_p);
|
||||
bool is_error = ECMA_IS_VALUE_ERROR (result);
|
||||
|
||||
ecma_free_value (is_error ? JERRY_CONTEXT (error_value) : result);
|
||||
if (is_error)
|
||||
{
|
||||
jcontext_release_exception ();
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_free_value (result);
|
||||
}
|
||||
|
||||
return ecma_make_boolean_value (!is_error);
|
||||
}
|
||||
|
||||
@@ -808,8 +808,7 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_to_string_val, /**
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (match_result))
|
||||
{
|
||||
match_result = JERRY_CONTEXT (error_value);
|
||||
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_EXCEPTION;
|
||||
match_result = jcontext_take_exception ();
|
||||
}
|
||||
|
||||
ecma_free_value (match_result);
|
||||
@@ -898,8 +897,7 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_to_string_val, /**
|
||||
curr_pos++;
|
||||
if (ECMA_IS_VALUE_ERROR (match_result))
|
||||
{
|
||||
ecma_free_value (JERRY_CONTEXT (error_value));
|
||||
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_EXCEPTION;
|
||||
jcontext_release_exception ();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user