mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
Tests/LibWasm: Handle all stream errors in parse_webassembly_module
This commit is contained in:
parent
2c7e2e351a
commit
30a1a25daa
Notes:
sideshowbarker
2024-07-18 05:03:52 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/30a1a25daa3 Pull-request: https://github.com/SerenityOS/serenity/pull/9685
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user