mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:17:35 +00:00
LibJS: Pass Realm to define_native_{accessor,function}()
This is needed so that the allocated NativeFunction receives the correct realm, usually forwarded from the Object's initialize() function, rather than using the current realm.
This commit is contained in:
parent
7c468b5a77
commit
e3895e6c80
116 changed files with 893 additions and 890 deletions
|
@ -13,7 +13,7 @@ namespace Web::Bindings {
|
|||
void WebAssemblyInstancePrototype::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
define_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "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::Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
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);
|
||||
define_native_accessor(realm, "buffer", buffer_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function(realm, "grow", grow, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
|
||||
|
|
|
@ -36,9 +36,9 @@ void WebAssemblyObject::initialize(JS::Realm& realm)
|
|||
Object::initialize(realm);
|
||||
|
||||
u8 attr = JS::Attribute::Configurable | JS::Attribute::Writable | JS::Attribute::Enumerable;
|
||||
define_native_function("validate", validate, 1, attr);
|
||||
define_native_function("compile", compile, 1, attr);
|
||||
define_native_function("instantiate", instantiate, 1, attr);
|
||||
define_native_function(realm, "validate", validate, 1, attr);
|
||||
define_native_function(realm, "compile", compile, 1, attr);
|
||||
define_native_function(realm, "instantiate", instantiate, 1, attr);
|
||||
|
||||
auto& vm = this->vm();
|
||||
|
||||
|
|
|
@ -13,10 +13,10 @@ namespace Web::Bindings {
|
|||
void WebAssemblyTablePrototype::initialize(JS::Realm& realm)
|
||||
{
|
||||
Object::initialize(realm);
|
||||
define_native_accessor("length", length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function("grow", grow, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function("get", get, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function("set", set, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_accessor(realm, "length", length_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function(realm, "grow", grow, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function(realm, "get", get, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
define_native_function(realm, "set", set, 1, JS::Attribute::Writable | JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||
}
|
||||
|
||||
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyTablePrototype::grow)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue