summaryrefslogtreecommitdiff
path: root/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2020-05-25 13:55:46 +0100
committerAndreas Kling <kling@serenityos.org>2020-05-25 15:15:31 +0200
commitfd7cbb5389fd916004c708bca119d96047f99aa1 (patch)
tree9ce94cd81d61484bf2af2c372104afae61aface4 /Libraries
parentc1a26f0b358f9c381c0346d8d98c4bdce9c2f767 (diff)
downloadserenity-fd7cbb5389fd916004c708bca119d96047f99aa1.zip
LibWeb: Add navigator.language and navigator.languages
Hardcoded to "en-US" and ["en-US"] respectively.
Diffstat (limited to 'Libraries')
-rw-r--r--Libraries/LibWeb/Bindings/NavigatorObject.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibWeb/Bindings/NavigatorObject.cpp b/Libraries/LibWeb/Bindings/NavigatorObject.cpp
index cb91b5f35c..83c79ed953 100644
--- a/Libraries/LibWeb/Bindings/NavigatorObject.cpp
+++ b/Libraries/LibWeb/Bindings/NavigatorObject.cpp
@@ -26,6 +26,7 @@
#include <AK/FlyString.h>
#include <LibJS/Interpreter.h>
+#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/GlobalObject.h>
#include <LibWeb/Bindings/NavigatorObject.h>
#include <LibWeb/ResourceLoader.h>
@@ -36,9 +37,14 @@ namespace Bindings {
NavigatorObject::NavigatorObject()
: Object(interpreter().global_object().object_prototype())
{
+ auto* languages = JS::Array::create(interpreter().global_object());
+ languages->elements().append(js_string(heap(), "en-US"));
+
put("appCodeName", js_string(heap(), "Mozilla"));
put("appName", js_string(heap(), "Netscape"));
put("appVersion", js_string(heap(), "4.0"));
+ put("language", languages->elements().first());
+ put("languages", languages);
put("platform", js_string(heap(), "SerenityOS"));
put("product", js_string(heap(), "Gecko"));