1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:37:37 +00:00

LibJS: Add define_direct_property and remove the define_property helper

This removes all usages of the non-standard define_property helper
method and replaces all it's usages with the specification required
alternative or with define_direct_property where appropriate.
This commit is contained in:
Idan Horowitz 2021-07-06 02:15:08 +03:00 committed by Linus Groh
parent e915155ca4
commit a6b8291a9b
81 changed files with 246 additions and 275 deletions

View file

@ -24,13 +24,14 @@ void NavigatorObject::initialize(JS::GlobalObject& global_object)
languages->indexed_properties().append(js_string(heap, "en-US"));
// FIXME: All of these should be in Navigator's prototype and be native accessors
define_property("appCodeName", js_string(heap, "Mozilla"));
define_property("appName", js_string(heap, "Netscape"));
define_property("appVersion", js_string(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"));
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
define_direct_property("appCodeName", js_string(heap, "Mozilla"), attr);
define_direct_property("appName", js_string(heap, "Netscape"), attr);
define_direct_property("appVersion", js_string(heap, "4.0"), attr);
define_direct_property("language", languages->get(0), attr);
define_direct_property("languages", languages, attr);
define_direct_property("platform", js_string(heap, "SerenityOS"), attr);
define_direct_property("product", js_string(heap, "Gecko"), attr);
define_native_accessor("userAgent", user_agent_getter, {});
}