LibWeb: Mark stream AOs as infallible as required by the spec

There were several instances where the spec marks an AO invocation as
infallible, but we were propagating WebIDL::ExceptionOr. These mostly
cannot throw due to knowledge about the values they are provided. By
unwinding these, we can remove a decent amount of exception handling.
This commit is contained in:
Timothy Flynn 2024-04-29 18:01:44 -04:00 committed by Andreas Kling
commit c29916775e
Notes: sideshowbarker 2024-07-17 01:51:00 +09:00
13 changed files with 77 additions and 98 deletions

View file

@ -49,12 +49,12 @@ WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm& realm,
}
// 3. Otherwise, if object is a Blob object, set stream to the result of running objects get stream.
else if (auto const* blob_handle = object.get_pointer<JS::Handle<FileAPI::Blob>>()) {
stream = TRY(blob_handle->cell()->get_stream());
stream = blob_handle->cell()->get_stream();
}
// 4. Otherwise, set stream to a new ReadableStream object, and set up stream with byte reading support.
else {
stream = realm.heap().allocate<Streams::ReadableStream>(realm, realm);
TRY(Streams::set_up_readable_stream_controller_with_byte_reading_support(*stream));
Streams::set_up_readable_stream_controller_with_byte_reading_support(*stream);
}
// 5. Assert: stream is a ReadableStream object.