1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:57:45 +00:00

LibWeb: Make WebAssembly.Memory.prototype.buffer an accessor property

This commit is contained in:
Linus Groh 2021-07-05 12:33:29 +01:00
parent b73b6fbd4c
commit b5da876817

View file

@ -13,7 +13,7 @@ namespace Web::Bindings {
void WebAssemblyMemoryPrototype::initialize(JS::GlobalObject& global_object) void WebAssemblyMemoryPrototype::initialize(JS::GlobalObject& global_object)
{ {
Object::initialize(global_object); Object::initialize(global_object);
define_native_property("buffer", buffer_getter, nullptr); define_native_accessor("buffer", buffer_getter, {});
define_native_function("grow", grow); define_native_function("grow", grow);
} }
@ -42,7 +42,7 @@ JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::grow)
return JS::Value(static_cast<u32>(previous_size)); return JS::Value(static_cast<u32>(previous_size));
} }
JS_DEFINE_NATIVE_GETTER(WebAssemblyMemoryPrototype::buffer_getter) JS_DEFINE_NATIVE_FUNCTION(WebAssemblyMemoryPrototype::buffer_getter)
{ {
auto* this_object = vm.this_value(global_object).to_object(global_object); auto* this_object = vm.this_value(global_object).to_object(global_object);
if (!this_object || !is<WebAssemblyMemoryObject>(this_object)) { if (!this_object || !is<WebAssemblyMemoryObject>(this_object)) {