summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/WebAssembly
diff options
context:
space:
mode:
authorTim Schumacher <timschumi@gmx.de>2023-01-21 11:44:19 +0100
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2023-01-25 17:10:05 +0330
commit982ebbc304a8e2ed637009f9bcc4dac53b43e06c (patch)
tree5e671d853859510a19534cbfde184b6c683ba4b3 /Userland/Libraries/LibWeb/WebAssembly
parent409fb0fe79071686590cfd1fdbc815193a15d795 (diff)
downloadserenity-982ebbc304a8e2ed637009f9bcc4dac53b43e06c.zip
LibWasm: Port the parser to `Core::Stream`
Diffstat (limited to 'Userland/Libraries/LibWeb/WebAssembly')
-rw-r--r--Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
index 5d1592bce1..e7557025c1 100644
--- a/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
+++ b/Userland/Libraries/LibWeb/WebAssembly/WebAssemblyObject.cpp
@@ -12,6 +12,7 @@
#include "WebAssemblyTableObject.h"
#include "WebAssemblyTablePrototype.h"
#include <AK/ScopeGuard.h>
+#include <LibCore/MemoryStream.h>
#include <LibJS/Runtime/Array.h>
#include <LibJS/Runtime/ArrayBuffer.h>
#include <LibJS/Runtime/BigInt.h>
@@ -118,13 +119,8 @@ JS::ThrowCompletionOr<size_t> parse_module(JS::VM& vm, JS::Object* buffer_object
} else {
return vm.throw_completion<JS::TypeError>("Not a BufferSource");
}
- InputMemoryStream stream { data };
- auto module_result = Wasm::Module::parse(stream);
- ScopeGuard drain_errors {
- [&] {
- stream.handle_any_error();
- }
- };
+ auto stream = Core::Stream::FixedMemoryStream::construct(data).release_value_but_fixme_should_propagate_errors();
+ auto module_result = Wasm::Module::parse(*stream);
if (module_result.is_error()) {
// FIXME: Throw CompileError instead.
return vm.throw_completion<JS::TypeError>(Wasm::parse_error_to_deprecated_string(module_result.error()));