1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:47:44 +00:00

LibWeb: Use TRY() to convert invoke_callback result to an ExceptionOr

Otherwise, the JS::Completion is always interpretted as an error by
ExceptionOr.
This commit is contained in:
Matthew Olsson 2023-04-27 15:28:48 +00:00 committed by Andreas Kling
parent e5ff777b48
commit 5d48ade508

View file

@ -762,7 +762,7 @@ WebIDL::ExceptionOr<void> set_up_readable_stream_default_controller_from_underly
if (underlying_source.start) {
start_algorithm = [controller, underlying_source_value, callback = underlying_source.start]() -> WebIDL::ExceptionOr<JS::Value> {
// Note: callback does not return a promise, so invoke_callback may return an abrupt completion
return WebIDL::invoke_callback(*callback, underlying_source_value, controller);
return TRY(WebIDL::invoke_callback(*callback, underlying_source_value, controller)).release_value();
};
}
@ -1937,7 +1937,7 @@ WebIDL::ExceptionOr<void> set_up_writable_stream_default_controller_from_underly
if (underlying_sink.start) {
start_algorithm = [controller, underlying_sink_value, callback = underlying_sink.start]() -> WebIDL::ExceptionOr<JS::Value> {
// Note: callback does not return a promise, so invoke_callback may return an abrupt completion
return WebIDL::invoke_callback(*callback, underlying_sink_value, controller);
return TRY(WebIDL::invoke_callback(*callback, underlying_sink_value, controller)).release_value();
};
}