diff options
author | Matthew Olsson <matthewcolsson@gmail.com> | 2023-04-16 17:40:13 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-04-17 10:27:40 +0200 |
commit | bad541a0d4069e6c0b51aee62e2960c2eeb9471f (patch) | |
tree | 25581e2e306e63a2b5d89f102a08043acfeb1131 /Userland/Libraries/LibWeb/Streams | |
parent | c40109628da05d8053cc17405d4fdff04029e774 (diff) | |
download | serenity-bad541a0d4069e6c0b51aee62e2960c2eeb9471f.zip |
LibWeb: Remove outdated FIXMEs around WebIDL::invoke_callback usages
Diffstat (limited to 'Userland/Libraries/LibWeb/Streams')
-rw-r--r-- | Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp index 20a39cc4e0..4efbb8f742 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp @@ -725,27 +725,27 @@ WebIDL::ExceptionOr<void> set_up_readable_stream_default_controller_from_underly // 5. If underlyingSourceDict["start"] exists, then set startAlgorithm to an algorithm which returns the result of invoking underlyingSourceDict["start"] with argument list « controller » and callback this value underlyingSource. if (underlying_source.start) { - start_algorithm = [&, start = underlying_source.start]() -> WebIDL::ExceptionOr<JS::GCPtr<WebIDL::Promise>> { - // FIXME: This needs to create a rejected Promise for throw completions, which invoke_callback() currently doesn't do. - auto result = TRY(WebIDL::invoke_callback(*start, underlying_source_value, controller)).release_value(); + start_algorithm = [&, callback = underlying_source.start]() -> WebIDL::ExceptionOr<JS::GCPtr<WebIDL::Promise>> { + // Note: callback return a promise, so invoke_callback will never return an abrupt completion + auto result = MUST_OR_THROW_OOM(WebIDL::invoke_callback(*callback, underlying_source_value, controller)).release_value(); return WebIDL::create_resolved_promise(realm, result); }; } // 6. If underlyingSourceDict["pull"] exists, then set pullAlgorithm to an algorithm which returns the result of invoking underlyingSourceDict["pull"] with argument list « controller » and callback this value underlyingSource. if (underlying_source.pull) { - pull_algorithm = [&, pull = underlying_source.pull]() -> WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> { - // FIXME: This needs to create a rejected Promise for throw completions, which invoke_callback() currently doesn't do. - auto result = TRY(WebIDL::invoke_callback(*pull, underlying_source_value, controller)).release_value(); + pull_algorithm = [&, callback = underlying_source.pull]() -> WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> { + // Note: callback return a promise, so invoke_callback will never return an abrupt completion + auto result = MUST_OR_THROW_OOM(WebIDL::invoke_callback(*callback, underlying_source_value, controller)).release_value(); return WebIDL::create_resolved_promise(realm, result); }; } // 7. If underlyingSourceDict["cancel"] exists, then set cancelAlgorithm to an algorithm which takes an argument reason and returns the result of invoking underlyingSourceDict["cancel"] with argument list « reason » and callback this value underlyingSource. if (underlying_source.cancel) { - cancel_algorithm = [&, cancel = underlying_source.cancel](auto const& reason) -> WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> { - // FIXME: This needs to create a rejected Promise for throw completions, which invoke_callback() currently doesn't do. - auto result = TRY(WebIDL::invoke_callback(*cancel, underlying_source_value, reason)).release_value(); + cancel_algorithm = [&, callback = underlying_source.cancel](auto const& reason) -> WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> { + // Note: callback return a promise, so invoke_callback will never return an abrupt completion + auto result = MUST_OR_THROW_OOM(WebIDL::invoke_callback(*callback, underlying_source_value, reason)).release_value(); return WebIDL::create_resolved_promise(realm, result); }; } @@ -1732,8 +1732,8 @@ WebIDL::ExceptionOr<void> set_up_writable_stream_default_controller_from_underly // 6. If underlyingSinkDict["start"] exists, then set startAlgorithm to an algorithm which returns the result of invoking underlyingSinkDict["start"] with argument list « controller » and callback this value underlyingSink. if (underlying_sink.start) { start_algorithm = [&, callback = underlying_sink.start]() -> WebIDL::ExceptionOr<JS::GCPtr<WebIDL::Promise>> { - // FIXME: This needs to create a rejected Promise for throw completions, which invoke_callback() currently doesn't do. - auto result = TRY(WebIDL::invoke_callback(*callback, underlying_sink_value, controller)).release_value(); + // Note: callback return a promise, so invoke_callback will never return an abrupt completion + auto result = MUST_OR_THROW_OOM(WebIDL::invoke_callback(*callback, underlying_sink_value, controller)).release_value(); return WebIDL::create_resolved_promise(realm, result); }; } @@ -1741,8 +1741,8 @@ WebIDL::ExceptionOr<void> set_up_writable_stream_default_controller_from_underly // 7. If underlyingSinkDict["write"] exists, then set writeAlgorithm to an algorithm which takes an argument chunk and returns the result of invoking underlyingSinkDict["write"] with argument list « chunk, controller » and callback this value underlyingSink. if (underlying_sink.write) { write_algorithm = [&, callback = underlying_sink.write](JS::Value chunk) -> WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> { - // FIXME: This needs to create a rejected Promise for throw completions, which invoke_callback() currently doesn't do. - auto result = TRY(WebIDL::invoke_callback(*callback, underlying_sink_value, chunk, controller)).release_value(); + // Note: callback return a promise, so invoke_callback will never return an abrupt completion + auto result = MUST_OR_THROW_OOM(WebIDL::invoke_callback(*callback, underlying_sink_value, chunk, controller)).release_value(); return WebIDL::create_resolved_promise(realm, result); }; } @@ -1750,8 +1750,8 @@ WebIDL::ExceptionOr<void> set_up_writable_stream_default_controller_from_underly // 8. If underlyingSinkDict["close"] exists, then set closeAlgorithm to an algorithm which returns the result of invoking underlyingSinkDict["close"] with argument list «» and callback this value underlyingSink. if (underlying_sink.close) { close_algorithm = [&, callback = underlying_sink.close]() -> WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> { - // FIXME: This needs to create a rejected Promise for throw completions, which invoke_callback() currently doesn't do. - auto result = TRY(WebIDL::invoke_callback(*callback, underlying_sink_value)).release_value(); + // Note: callback return a promise, so invoke_callback will never return an abrupt completion + auto result = MUST_OR_THROW_OOM(WebIDL::invoke_callback(*callback, underlying_sink_value)).release_value(); return WebIDL::create_resolved_promise(realm, result); }; } @@ -1759,8 +1759,8 @@ WebIDL::ExceptionOr<void> set_up_writable_stream_default_controller_from_underly // 9. If underlyingSinkDict["abort"] exists, then set abortAlgorithm to an algorithm which takes an argument reason and returns the result of invoking underlyingSinkDict["abort"] with argument list « reason » and callback this value underlyingSink. if (underlying_sink.abort) { abort_algorithm = [&, callback = underlying_sink.abort](JS::Value reason) -> WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> { - // FIXME: This needs to create a rejected Promise for throw completions, which invoke_callback() currently doesn't do. - auto result = TRY(WebIDL::invoke_callback(*callback, underlying_sink_value, reason)).release_value(); + // Note: callback return a promise, so invoke_callback will never return an abrupt completion + auto result = MUST_OR_THROW_OOM(WebIDL::invoke_callback(*callback, underlying_sink_value, reason)).release_value(); return WebIDL::create_resolved_promise(realm, result); }; } |