LibWeb: Remove exceptional return types from infallible stream IDL

This commit is contained in:
Timothy Flynn 2024-04-29 18:34:19 -04:00 committed by Andreas Kling
commit 2d4d16ac37
Notes: sideshowbarker 2024-07-16 23:51:07 +09:00
15 changed files with 26 additions and 29 deletions

View file

@ -9,20 +9,19 @@
#include <LibWeb/Streams/AbstractOperations.h>
#include <LibWeb/Streams/ReadableStream.h>
#include <LibWeb/Streams/ReadableStreamGenericReader.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
#include <LibWeb/WebIDL/Promise.h>
namespace Web::Streams {
// https://streams.spec.whatwg.org/#generic-reader-closed
WebIDL::ExceptionOr<JS::GCPtr<JS::Promise>> ReadableStreamGenericReaderMixin::closed()
JS::GCPtr<JS::Promise> ReadableStreamGenericReaderMixin::closed()
{
// 1. Return this.[[closedPromise]].
return JS::GCPtr { verify_cast<JS::Promise>(*m_closed_promise->promise()) };
}
// https://streams.spec.whatwg.org/#generic-reader-cancel
WebIDL::ExceptionOr<JS::NonnullGCPtr<JS::Promise>> ReadableStreamGenericReaderMixin::cancel(JS::Value reason)
JS::NonnullGCPtr<JS::Promise> ReadableStreamGenericReaderMixin::cancel(JS::Value reason)
{
// 1. If this.[[stream]] is undefined, return a promise rejected with a TypeError exception.
if (!m_stream) {