浏览代码

LibWeb: Support alert() with no arguments

No idea why someone would use that though.
Linus Groh 5 年之前
父节点
当前提交
9eb9b46640
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Libraries/LibWeb/Bindings/WindowObject.cpp

+ 4 - 4
Libraries/LibWeb/Bindings/WindowObject.cpp

@@ -89,10 +89,10 @@ JS::Value WindowObject::alert(JS::Interpreter& interpreter)
     auto* impl = impl_from(interpreter);
     auto* impl = impl_from(interpreter);
     if (!impl)
     if (!impl)
         return {};
         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();
     return JS::js_undefined();
 }
 }