mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-04-25 22:13:13 +00:00
LibWeb: Add support for accessing exported wasm table instances
This commit is contained in:
committed by
Ali Mohammad Pur
parent
0d1471e72f
commit
af511a64cd
@@ -14,6 +14,7 @@
|
||||
#include <LibWeb/WebAssembly/WebAssemblyInstanceObject.h>
|
||||
#include <LibWeb/WebAssembly/WebAssemblyMemoryPrototype.h>
|
||||
#include <LibWeb/WebAssembly/WebAssemblyObject.h>
|
||||
#include <LibWeb/WebAssembly/WebAssemblyTableObject.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
@@ -51,6 +52,14 @@ void WebAssemblyInstanceObject::initialize(JS::Realm& realm)
|
||||
}
|
||||
m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes);
|
||||
},
|
||||
[&](Wasm::TableAddress const& address) {
|
||||
Optional<WebAssemblyTableObject*> object = cache.table_instances.get(address);
|
||||
if (!object.has_value()) {
|
||||
object = heap().allocate<Web::Bindings::WebAssemblyTableObject>(realm, realm, address);
|
||||
cache.table_instances.set(address, *object);
|
||||
}
|
||||
m_exports_object->define_direct_property(export_.name(), *object, JS::default_attributes);
|
||||
},
|
||||
[&](auto const&) {
|
||||
// FIXME: Implement other exports!
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user