mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 01:09:25 +00:00
LibWeb: No longer return undefined on null table entry in Wasm API
Return `null` instead, as per the specification.
This commit is contained in:
committed by
Ali Mohammad Pur
parent
93216a875e
commit
3c5e3eef10
@@ -106,8 +106,6 @@ WebIDL::ExceptionOr<JS::Value> Table::get(u32 index) const
|
||||
return vm.throw_completion<JS::RangeError>("Table element index out of range"sv);
|
||||
|
||||
auto& ref = table->elements()[index];
|
||||
if (!ref.ref().has<Wasm::Reference::Null>())
|
||||
return JS::js_undefined();
|
||||
|
||||
Wasm::Value wasm_value { ref };
|
||||
return Detail::to_js_value(vm, wasm_value);
|
||||
|
||||
@@ -450,7 +450,10 @@ JS::Value to_js_value(JS::VM& vm, Wasm::Value& wasm_value)
|
||||
case Wasm::ValueType::F32:
|
||||
return JS::Value(static_cast<double>(wasm_value.to<float>().value()));
|
||||
case Wasm::ValueType::FunctionReference: {
|
||||
auto address = wasm_value.to<Wasm::Reference::Func>().value().address;
|
||||
auto ref_ = *wasm_value.to<Wasm::Reference>();
|
||||
if (ref_.ref().has<Wasm::Reference::Null>())
|
||||
return JS::js_null();
|
||||
auto address = ref_.ref().get<Wasm::Reference::Func>().address;
|
||||
auto& cache = get_cache(realm);
|
||||
auto* function = cache.abstract_machine().store().get(address);
|
||||
auto name = function->visit(
|
||||
|
||||
Reference in New Issue
Block a user