From 99ae94b7c068c60fa43f6d39f130981d21d04c7a Mon Sep 17 00:00:00 2001 From: Robert Fancsik Date: Wed, 4 Dec 2019 14:12:06 +0100 Subject: [PATCH] ecma_create_error_reference should clear the context's exception flag. (#3413) This patch fixes #3410. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu --- jerry-core/ecma/base/ecma-helpers.c | 1 + .../jerry/fail/regression-test-issue-3410.js | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 tests/jerry/fail/regression-test-issue-3410.js diff --git a/jerry-core/ecma/base/ecma-helpers.c b/jerry-core/ecma/base/ecma-helpers.c index 90d42b34d..1f0d4e72d 100644 --- a/jerry-core/ecma/base/ecma-helpers.c +++ b/jerry-core/ecma/base/ecma-helpers.c @@ -1256,6 +1256,7 @@ ecma_create_error_reference (ecma_value_t value, /**< referenced value */ { ecma_error_reference_t *error_ref_p = (ecma_error_reference_t *) jmem_pools_alloc (sizeof (ecma_error_reference_t)); + JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_EXCEPTION; error_ref_p->refs_and_flags = ECMA_ERROR_REF_ONE | (is_exception ? 0 : ECMA_ERROR_REF_ABORT); error_ref_p->value = value; return ecma_make_error_reference_value (error_ref_p); diff --git a/tests/jerry/fail/regression-test-issue-3410.js b/tests/jerry/fail/regression-test-issue-3410.js new file mode 100644 index 000000000..b41575e53 --- /dev/null +++ b/tests/jerry/fail/regression-test-issue-3410.js @@ -0,0 +1,20 @@ +// 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. + + +var a; +Promise.race([a]).then(function() { + [] = [] +}); +throw 0.1234;