summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Bindings/NavigatorObject.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-20 17:28:13 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-20 17:50:48 +0200
commit03da70c7d0258975a9bf5164a8cc75d205047063 (patch)
tree5ead5b0463df51c13cff290651deb30ea853c82a /Libraries/LibWeb/Bindings/NavigatorObject.cpp
parent06e29fac57f0c2f2647aea6686337b3e28b6fa85 (diff)
downloadserenity-03da70c7d0258975a9bf5164a8cc75d205047063.zip
LibWeb: Split JS wrapper constructors into construct/initialize
Diffstat (limited to 'Libraries/LibWeb/Bindings/NavigatorObject.cpp')
-rw-r--r--Libraries/LibWeb/Bindings/NavigatorObject.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/Libraries/LibWeb/Bindings/NavigatorObject.cpp b/Libraries/LibWeb/Bindings/NavigatorObject.cpp
index 28fbfb23fb..5dce741196 100644
--- a/Libraries/LibWeb/Bindings/NavigatorObject.cpp
+++ b/Libraries/LibWeb/Bindings/NavigatorObject.cpp
@@ -34,19 +34,23 @@
namespace Web {
namespace Bindings {
-NavigatorObject::NavigatorObject()
- : Object(interpreter().global_object().object_prototype())
+NavigatorObject::NavigatorObject(JS::GlobalObject& global_object)
+ : Object(global_object.object_prototype())
{
- auto* languages = JS::Array::create(interpreter().global_object());
+}
+
+void NavigatorObject::initialize(JS::Interpreter& interpreter, JS::GlobalObject& global_object)
+{
+ auto* languages = JS::Array::create(global_object);
languages->indexed_properties().append(js_string(heap(), "en-US"));
- define_property("appCodeName", js_string(heap(), "Mozilla"));
- define_property("appName", js_string(heap(), "Netscape"));
- define_property("appVersion", js_string(heap(), "4.0"));
+ define_property("appCodeName", js_string(interpreter.heap(), "Mozilla"));
+ define_property("appName", js_string(interpreter.heap(), "Netscape"));
+ define_property("appVersion", js_string(interpreter.heap(), "4.0"));
define_property("language", languages->get(0));
define_property("languages", languages);
- define_property("platform", js_string(heap(), "SerenityOS"));
- define_property("product", js_string(heap(), "Gecko"));
+ define_property("platform", js_string(interpreter.heap(), "SerenityOS"));
+ define_property("product", js_string(interpreter.heap(), "Gecko"));
define_native_property("userAgent", user_agent_getter, nullptr);
}