Fix freeing this_arg in ecma_builtin_promise_race_or_all (#3482)

Fixes #3478

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
Daniel Balla 2020-01-03 14:18:40 +01:00 committed by Robert Fancsik
parent 518fcf2c6a
commit e21e4a18ba
2 changed files with 21 additions and 1 deletions

View File

@ -515,7 +515,6 @@ ecma_builtin_promise_race_or_all (ecma_value_t this_arg, /**< 'this' argument */
if (!ecma_is_value_null (species_symbol) && !ecma_is_value_undefined (species_symbol))
{
ecma_free_value (constructor_value);
constructor_value = species_symbol;
}
else

View File

@ -0,0 +1,21 @@
// 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.prototype["symbol"] = 0;
try {
Promise.race([]);
assert(false);
} catch(e) {
assert(e instanceof TypeError);
}