Skip to content

Commit 6cd309b

Browse files
authored
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
1 parent 876622a commit 6cd309b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,13 @@ ecma_builtin_function_prototype_dispatch_routine (uint16_t builtin_routine_id, /
392392
{
393393
if (!ecma_op_is_callable (this_arg))
394394
{
395+
#if ENABLED (JERRY_ES2015)
396+
if (JERRY_UNLIKELY (builtin_routine_id == ECMA_FUNCTION_PROTOTYPE_SYMBOL_HAS_INSTANCE))
397+
{
398+
return ECMA_VALUE_FALSE;
399+
}
400+
#endif /* ENABLED (JERRY_ES2015) */
401+
395402
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function."));
396403
}
397404

tests/test262-es6-excludelist.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8" ?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<excludeList>
33
<test id="annexB/B.2.2.1.1.js"><reason></reason></test>
44
<test id="annexB/B.2.2.1.2.js"><reason></reason></test>
@@ -68,7 +68,6 @@
6868
<test id="built-ins/Function/prototype/bind/instance-name-non-string.js"><reason></reason></test>
6969
<test id="built-ins/Function/prototype/name.js"><reason></reason></test>
7070
<test id="built-ins/Function/prototype/Symbol.hasInstance/name.js"><reason></reason></test>
71-
<test id="built-ins/Function/prototype/Symbol.hasInstance/this-val-not-callable.js"><reason></reason></test>
7271
<test id="built-ins/Function/prototype/Symbol.hasInstance/this-val-poisoned-prototype.js"><reason></reason></test>
7372
<test id="built-ins/Function/StrictFunction_restricted-properties.js"><reason></reason></test>
7473
<test id="built-ins/GeneratorFunction/instance-name.js"><reason></reason></test>

0 commit comments

Comments
 (0)