mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Fix Reflect.getPrototypeOf for primitive arguments (#3354)
Fixes #3349. JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
This commit is contained in:
parent
1c6f334f62
commit
b2d34724d4
@ -77,8 +77,7 @@ ecma_builtin_reflect_dispatch_routine (uint16_t builtin_routine_id, /**< built-i
|
||||
JERRY_UNUSED (this_arg);
|
||||
JERRY_UNUSED (arguments_number);
|
||||
|
||||
if (!ecma_is_value_object (arguments_list[0])
|
||||
&& builtin_routine_id > ECMA_REFLECT_OBJECT_SET_PROTOTYPE_OF_UL)
|
||||
if (!ecma_is_value_object (arguments_list[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an Object."));
|
||||
}
|
||||
|
||||
@ -15,3 +15,17 @@
|
||||
assert (Reflect['getPrototypeOf']({}) === Object.prototype);
|
||||
assert (Reflect['getPrototypeOf'](Object.create(null)) === null);
|
||||
assert (Reflect['getPrototypeOf'](Object.prototype) === null);
|
||||
|
||||
try {
|
||||
Reflect.getPrototypeOf();
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e instanceof TypeError);
|
||||
}
|
||||
|
||||
try {
|
||||
Reflect.getPrototypeOf("str");
|
||||
assert (false);
|
||||
} catch (e) {
|
||||
assert (e instanceof TypeError);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user