mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
LibWeb: Convert WebAssemblyObject AOs to ThrowCompletionOr
This commit is contained in:
parent
a76cd669b1
commit
3e8c76d5ab
6 changed files with 62 additions and 102 deletions
|
@ -36,12 +36,8 @@ JS::ThrowCompletionOr<JS::Object*> WebAssemblyInstanceConstructor::construct(Fun
|
|||
if (!is<WebAssemblyModuleObject>(module_argument))
|
||||
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Module");
|
||||
auto& module_object = static_cast<WebAssemblyModuleObject&>(*module_argument);
|
||||
auto result = WebAssemblyObject::instantiate_module(module_object.module(), vm, global_object);
|
||||
if (result.is_error()) {
|
||||
vm.throw_exception(global_object, result.error());
|
||||
return JS::throw_completion(result.error());
|
||||
}
|
||||
return heap().allocate<WebAssemblyInstanceObject>(global_object, global_object, result.value());
|
||||
auto result = TRY(WebAssemblyObject::instantiate_module(module_object.module(), vm, global_object));
|
||||
return heap().allocate<WebAssemblyInstanceObject>(global_object, global_object, result);
|
||||
}
|
||||
|
||||
void WebAssemblyInstanceConstructor::initialize(JS::GlobalObject& global_object)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue