summaryrefslogtreecommitdiff
path: root/Tests/LibWasm/test-wasm.cpp
diff options
context:
space:
mode:
authorAli Mohammad Pur <ali.mpfard@gmail.com>2021-08-30 17:30:18 +0430
committerAndreas Kling <kling@serenityos.org>2021-08-30 22:47:02 +0200
commit30a1a25daa3ce2a279e286384f8e0d12762dada7 (patch)
treee71251ab59c3e7469a8acec9179c57ec5b0be123 /Tests/LibWasm/test-wasm.cpp
parent2c7e2e351aa2c40daedfd8ddac3ef868ebac0f2c (diff)
downloadserenity-30a1a25daa3ce2a279e286384f8e0d12762dada7.zip
Tests/LibWasm: Handle all stream errors in parse_webassembly_module
Diffstat (limited to 'Tests/LibWasm/test-wasm.cpp')
-rw-r--r--Tests/LibWasm/test-wasm.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Tests/LibWasm/test-wasm.cpp b/Tests/LibWasm/test-wasm.cpp
index 838790bdd3..2a8a44ecc5 100644
--- a/Tests/LibWasm/test-wasm.cpp
+++ b/Tests/LibWasm/test-wasm.cpp
@@ -104,6 +104,11 @@ TESTJS_GLOBAL_FUNCTION(parse_webassembly_module, parseWebAssemblyModule)
}
auto& array = static_cast<JS::Uint8Array&>(*object);
InputMemoryStream stream { array.data() };
+ ScopeGuard handle_stream_error {
+ [&] {
+ stream.handle_any_error();
+ }
+ };
auto result = Wasm::Module::parse(stream);
if (result.is_error()) {
vm.throw_exception<JS::SyntaxError>(global_object, Wasm::parse_error_to_string(result.error()));