Pārlūkot izejas kodu

Tests/LibWasm: Handle all stream errors in parse_webassembly_module

Ali Mohammad Pur 3 gadi atpakaļ
vecāks
revīzija
30a1a25daa
1 mainītis faili ar 5 papildinājumiem un 0 dzēšanām
  1. 5 0
      Tests/LibWasm/test-wasm.cpp

+ 5 - 0
Tests/LibWasm/test-wasm.cpp

@@ -104,6 +104,11 @@ TESTJS_GLOBAL_FUNCTION(parse_webassembly_module, parseWebAssemblyModule)
     }
     }
     auto& array = static_cast<JS::Uint8Array&>(*object);
     auto& array = static_cast<JS::Uint8Array&>(*object);
     InputMemoryStream stream { array.data() };
     InputMemoryStream stream { array.data() };
+    ScopeGuard handle_stream_error {
+        [&] {
+            stream.handle_any_error();
+        }
+    };
     auto result = Wasm::Module::parse(stream);
     auto result = Wasm::Module::parse(stream);
     if (result.is_error()) {
     if (result.is_error()) {
         vm.throw_exception<JS::SyntaxError>(global_object, Wasm::parse_error_to_string(result.error()));
         vm.throw_exception<JS::SyntaxError>(global_object, Wasm::parse_error_to_string(result.error()));