diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-20 17:28:13 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-20 17:50:48 +0200 |
commit | 03da70c7d0258975a9bf5164a8cc75d205047063 (patch) | |
tree | 5ead5b0463df51c13cff290651deb30ea853c82a /Libraries/LibWeb/Bindings/NavigatorObject.cpp | |
parent | 06e29fac57f0c2f2647aea6686337b3e28b6fa85 (diff) | |
download | serenity-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.cpp | 20 |
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); } |