From 9eb9b46640aa3a4742561abd8a41ee8875acd6d5 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Wed, 15 Apr 2020 23:14:03 +0100 Subject: [PATCH] LibWeb: Support alert() with no arguments No idea why someone would use that though. --- Libraries/LibWeb/Bindings/WindowObject.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibWeb/Bindings/WindowObject.cpp b/Libraries/LibWeb/Bindings/WindowObject.cpp index 0e6a70de86..dd3b4c3c47 100644 --- a/Libraries/LibWeb/Bindings/WindowObject.cpp +++ b/Libraries/LibWeb/Bindings/WindowObject.cpp @@ -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(); }