Function.prototype[@@hasInstance] should not throw error for not callable this value (#3773)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik 2020-05-22 17:23:07 +02:00 committed by GitHub
parent 876622a061
commit 6cd309b525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -392,6 +392,13 @@ ecma_builtin_function_prototype_dispatch_routine (uint16_t builtin_routine_id, /
{
if (!ecma_op_is_callable (this_arg))
{
#if ENABLED (JERRY_ES2015)
if (JERRY_UNLIKELY (builtin_routine_id == ECMA_FUNCTION_PROTOTYPE_SYMBOL_HAS_INSTANCE))
{
return ECMA_VALUE_FALSE;
}
#endif /* ENABLED (JERRY_ES2015) */
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function."));
}

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<excludeList>
<test id="annexB/B.2.2.1.1.js"><reason></reason></test>
<test id="annexB/B.2.2.1.2.js"><reason></reason></test>
@ -68,7 +68,6 @@
<test id="built-ins/Function/prototype/bind/instance-name-non-string.js"><reason></reason></test>
<test id="built-ins/Function/prototype/name.js"><reason></reason></test>
<test id="built-ins/Function/prototype/Symbol.hasInstance/name.js"><reason></reason></test>
<test id="built-ins/Function/prototype/Symbol.hasInstance/this-val-not-callable.js"><reason></reason></test>
<test id="built-ins/Function/prototype/Symbol.hasInstance/this-val-poisoned-prototype.js"><reason></reason></test>
<test id="built-ins/Function/StrictFunction_restricted-properties.js"><reason></reason></test>
<test id="built-ins/GeneratorFunction/instance-name.js"><reason></reason></test>