From 03629a2b3cc2b39ba434cca2049059cdb3f5f7ed Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Thu, 22 Jul 2021 13:24:45 +0430 Subject: [PATCH] LibWeb: Read the correct types in WebAssembly's to_js_value() A wasm value containing an F64 does not contain a float, etc. --- Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp index d383994ad1..8398c8afab 100644 --- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp +++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp @@ -348,12 +348,12 @@ JS::Value to_js_value(Wasm::Value& wasm_value, JS::GlobalObject& global_object) case Wasm::ValueType::I32: return JS::Value(wasm_value.to().value()); case Wasm::ValueType::F64: - return JS::Value(static_cast(wasm_value.to().value())); - case Wasm::ValueType::F32: return JS::Value(wasm_value.to().value()); + case Wasm::ValueType::F32: + return JS::Value(static_cast(wasm_value.to().value())); case Wasm::ValueType::FunctionReference: // FIXME: What's the name of a function reference that isn't exported? - return create_native_function(wasm_value.to().value(), "FIXME_IHaveNoIdeaWhatThisShouldBeCalled", global_object); + return create_native_function(wasm_value.to().value().address, "FIXME_IHaveNoIdeaWhatThisShouldBeCalled", global_object); case Wasm::ValueType::NullFunctionReference: return JS::js_null(); case Wasm::ValueType::ExternReference: