mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:57:34 +00:00
LibWeb: Convert WebAssemblyInstancePrototype funcs to ThrowCompletionOr
This commit is contained in:
parent
a8d39bc070
commit
c7c914800c
2 changed files with 6 additions and 8 deletions
|
@ -13,17 +13,15 @@ namespace Web::Bindings {
|
||||||
void WebAssemblyInstancePrototype::initialize(JS::GlobalObject& global_object)
|
void WebAssemblyInstancePrototype::initialize(JS::GlobalObject& global_object)
|
||||||
{
|
{
|
||||||
Object::initialize(global_object);
|
Object::initialize(global_object);
|
||||||
define_old_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
define_native_accessor("exports", exports_getter, {}, JS::Attribute::Enumerable | JS::Attribute::Configurable);
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_DEFINE_OLD_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
|
JS_DEFINE_NATIVE_FUNCTION(WebAssemblyInstancePrototype::exports_getter)
|
||||||
{
|
{
|
||||||
auto this_value = vm.this_value(global_object);
|
auto this_value = vm.this_value(global_object);
|
||||||
auto* this_object = TRY_OR_DISCARD(this_value.to_object(global_object));
|
auto* this_object = TRY(this_value.to_object(global_object));
|
||||||
if (!is<WebAssemblyInstanceObject>(this_object)) {
|
if (!is<WebAssemblyInstanceObject>(this_object))
|
||||||
vm.throw_exception<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance");
|
return vm.throw_completion<JS::TypeError>(global_object, JS::ErrorType::NotAnObjectOfType, "WebAssembly.Instance");
|
||||||
return {};
|
|
||||||
}
|
|
||||||
auto object = static_cast<WebAssemblyInstanceObject*>(this_object);
|
auto object = static_cast<WebAssemblyInstanceObject*>(this_object);
|
||||||
return object->m_exports_object;
|
return object->m_exports_object;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
virtual void initialize(JS::GlobalObject&) override;
|
virtual void initialize(JS::GlobalObject&) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
JS_DECLARE_OLD_NATIVE_FUNCTION(exports_getter);
|
JS_DECLARE_NATIVE_FUNCTION(exports_getter);
|
||||||
static JS::Handle<WebAssemblyInstancePrototype> s_instance;
|
static JS::Handle<WebAssemblyInstancePrototype> s_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue