LibWeb: Mark writable stream abort steps as infallible

These don't throw. We can remove a decent amount of exception handling
by marking them infallible.
This commit is contained in:
Timothy Flynn
2024-04-29 17:16:24 -04:00
committed by Andreas Kling
parent fc070c8cbd
commit 9d5e538247
7 changed files with 71 additions and 77 deletions

View File

@@ -27,21 +27,21 @@ void WritableStreamDefaultController::visit_edges(Visitor& visitor)
}
// https://streams.spec.whatwg.org/#ws-default-controller-error
WebIDL::ExceptionOr<void> WritableStreamDefaultController::error(JS::Value error)
void WritableStreamDefaultController::error(JS::Value error)
{
// 1. Let state be this.[[stream]].[[state]].
auto state = m_stream->state();
// 2. If state is not "writable", return.
if (state != WritableStream::State::Writable)
return {};
return;
// 3. Perform ! WritableStreamDefaultControllerError(this, e).
return writable_stream_default_controller_error(*this, error);
writable_stream_default_controller_error(*this, error);
}
// https://streams.spec.whatwg.org/#ws-default-controller-private-abort
WebIDL::ExceptionOr<JS::GCPtr<WebIDL::Promise>> WritableStreamDefaultController::abort_steps(JS::Value reason)
JS::NonnullGCPtr<WebIDL::Promise> WritableStreamDefaultController::abort_steps(JS::Value reason)
{
// 1. Let result be the result of performing this.[[abortAlgorithm]], passing reason.
auto result = m_abort_algorithm->function()(reason);