1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +00:00

LibWeb: Support alert() with no arguments

No idea why someone would use that though.
This commit is contained in:
Linus Groh 2020-04-15 23:14:03 +01:00 committed by Andreas Kling
parent 640a24dce8
commit 9eb9b46640

View file

@ -89,10 +89,10 @@ JS::Value WindowObject::alert(JS::Interpreter& interpreter)
auto* impl = impl_from(interpreter);
if (!impl)
return {};
auto& arguments = interpreter.call_frame().arguments;
if (arguments.size() < 1)
return {};
impl->alert(arguments[0].to_string());
String message = "";
if (interpreter.argument_count())
message = interpreter.argument(0).to_string();
impl->alert(message);
return JS::js_undefined();
}