mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:57:45 +00:00
LibJS: Remove the default length & attributes from define_native_*
These are usually incorrect, and people sometimes forget to add the correct values as a result of them being optional, so they should just be specified explicitly.
This commit is contained in:
parent
a6b8291a9b
commit
53f70e5208
10 changed files with 48 additions and 43 deletions
|
@ -33,7 +33,7 @@ void NavigatorObject::initialize(JS::GlobalObject& global_object)
|
|||
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, {});
|
||||
define_native_accessor("userAgent", user_agent_getter, {}, JS::Attribute::Configurable | JS::Attribute::Enumerable);
|
||||
}
|
||||
|
||||
NavigatorObject::~NavigatorObject()
|
||||
|
|
|
@ -57,17 +57,18 @@ void WindowObject::initialize_global_object()
|
|||
define_native_accessor("screen", screen_getter, {}, JS::Attribute::Enumerable);
|
||||
define_native_accessor("innerWidth", inner_width_getter, {}, JS::Attribute::Enumerable);
|
||||
define_native_accessor("innerHeight", inner_height_getter, {}, JS::Attribute::Enumerable);
|
||||
define_native_function("alert", alert);
|
||||
define_native_function("confirm", confirm);
|
||||
define_native_function("prompt", prompt);
|
||||
define_native_function("setInterval", set_interval, 1);
|
||||
define_native_function("setTimeout", set_timeout, 1);
|
||||
define_native_function("clearInterval", clear_interval, 1);
|
||||
define_native_function("clearTimeout", clear_timeout, 1);
|
||||
define_native_function("requestAnimationFrame", request_animation_frame, 1);
|
||||
define_native_function("cancelAnimationFrame", cancel_animation_frame, 1);
|
||||
define_native_function("atob", atob, 1);
|
||||
define_native_function("btoa", btoa, 1);
|
||||
u8 attr = JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable;
|
||||
define_native_function("alert", alert, 0, attr);
|
||||
define_native_function("confirm", confirm, 0, attr);
|
||||
define_native_function("prompt", prompt, 0, attr);
|
||||
define_native_function("setInterval", set_interval, 1, attr);
|
||||
define_native_function("setTimeout", set_timeout, 1, attr);
|
||||
define_native_function("clearInterval", clear_interval, 1, attr);
|
||||
define_native_function("clearTimeout", clear_timeout, 1, attr);
|
||||
define_native_function("requestAnimationFrame", request_animation_frame, 1, attr);
|
||||
define_native_function("cancelAnimationFrame", cancel_animation_frame, 1, attr);
|
||||
define_native_function("atob", atob, 1, attr);
|
||||
define_native_function("btoa", btoa, 1, attr);
|
||||
|
||||
// Legacy
|
||||
define_native_accessor("event", event_getter, {}, JS::Attribute::Enumerable);
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::Bindings {
|
|||
void WebAssemblyInstancePrototype::initialize(JS::GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
define_native_accessor("exports", exports_getter, {});
|
||||
define_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace Web::Bindings {
|
|||
void WebAssemblyMemoryPrototype::initialize(JS::GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
define_native_accessor("buffer", buffer_getter, {});
|
||||
define_native_function("grow", grow);
|
||||
define_native_accessor("buffer", buffer_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function("grow", grow, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue