LibJS: Object.setPrototypeOf throws error on too few arguments

This commit is contained in:
Matthew Olsson 2020-06-03 14:25:30 -07:00 committed by Andreas Kling
parent 79958f4520
commit 24430b3860
Notes: sideshowbarker 2024-07-19 05:47:40 +09:00

View file

@ -98,7 +98,7 @@ Value ObjectConstructor::get_prototype_of(Interpreter& interpreter)
Value ObjectConstructor::set_prototype_of(Interpreter& interpreter)
{
if (interpreter.argument_count() < 2)
return {};
interpreter.throw_exception<TypeError>("Object.setPrototypeOf requires at least two arguments");
auto* object = interpreter.argument(0).to_object(interpreter);
if (interpreter.exception())
return {};