LibWeb: Refactor WebAssembly API to use spec-defined promise AOs

This commit is contained in:
Andrew Kaster 2024-10-26 14:09:25 -06:00 committed by Andrew Kaster
commit ba6dcd7521
Notes: github-actions[bot] 2024-11-01 17:43:26 +00:00
6 changed files with 278 additions and 142 deletions

View file

@ -21,14 +21,13 @@ namespace Web::WebAssembly {
JS_DEFINE_ALLOCATOR(Instance);
WebIDL::ExceptionOr<JS::NonnullGCPtr<Instance>> Instance::construct_impl(JS::Realm& realm, Module& module, Optional<JS::Handle<JS::Object>>& import_object)
WebIDL::ExceptionOr<JS::NonnullGCPtr<Instance>> Instance::construct_impl(JS::Realm& realm, Module& module, Optional<JS::Handle<JS::Object>>& import_object_handle)
{
// FIXME: Implement the importObject parameter.
(void)import_object;
JS::GCPtr<JS::Object> import_object = import_object_handle.has_value() ? import_object_handle.value().ptr() : nullptr;
auto& vm = realm.vm();
auto module_instance = TRY(Detail::instantiate_module(vm, module.compiled_module()->module));
auto module_instance = TRY(Detail::instantiate_module(vm, module.compiled_module()->module, import_object));
return vm.heap().allocate<Instance>(realm, realm, move(module_instance));
}