mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fix JERRY_CONTEXT (error_value) handling during ecma_builtin_promise_reject_abrupt (#2519)
Fixes #2489. Co-authored-by: Daniel Balla <dballa@inf.u-szeged.hu> JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
parent
b97f5ffca0
commit
685d8b3675
@ -125,6 +125,7 @@ ecma_builtin_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argum
|
||||
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);
|
||||
ecma_string_t *reject_str_p = ecma_get_ecma_string_from_uint32 (ECMA_PROMISE_PROPERTY_REJECT);
|
||||
ecma_value_t reject = ecma_op_object_get (ecma_get_object_from_value (capability), reject_str_p);
|
||||
@ -134,6 +135,7 @@ ecma_builtin_promise_reject_abrupt (ecma_value_t capability) /**< reject descrip
|
||||
&reason,
|
||||
1);
|
||||
ecma_free_value (reject);
|
||||
ecma_free_value (reason);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (call_ret))
|
||||
{
|
||||
@ -576,11 +578,8 @@ ecma_builtin_promise_race_or_all (ecma_value_t this_arg, /**< 'this' argument */
|
||||
if (!ecma_is_value_object (array)
|
||||
|| ecma_get_object_type (ecma_get_object_from_value (array)) != ECMA_OBJECT_TYPE_ARRAY)
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Second argument is not an array."));
|
||||
ret = ecma_builtin_promise_reject_abrupt (capability);
|
||||
ecma_free_value (JERRY_CONTEXT (error_value));
|
||||
ecma_free_value (capability);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
16
tests/jerry/fail/regression-test-issue-2489.js
Normal file
16
tests/jerry/fail/regression-test-issue-2489.js
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
Object.defineProperty(Object.prototype, 0, {'get': function() { throw $ }});
|
||||
Promise.all();
|
||||
Loading…
x
Reference in New Issue
Block a user