1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibWeb: Add AO transform_stream_error()

This commit is contained in:
Kenneth Myhra 2023-07-07 16:14:09 +02:00 committed by Andreas Kling
parent ad73c03ea3
commit 69fb6f15f9
2 changed files with 17 additions and 0 deletions

View file

@ -2734,6 +2734,22 @@ void transform_stream_default_controller_clear_algorithms(TransformStreamDefault
controller.set_flush_algorithm({});
}
// https://streams.spec.whatwg.org/#transform-stream-error
WebIDL::ExceptionOr<void> transform_stream_error(TransformStream& stream, JS::Value error)
{
VERIFY(stream.readable()->controller().has_value() && stream.readable()->controller()->has<JS::NonnullGCPtr<ReadableStreamDefaultController>>());
auto readable_controller = stream.readable()->controller()->get<JS::NonnullGCPtr<ReadableStreamDefaultController>>();
// 1. Perform ! ReadableStreamDefaultControllerError(stream.[[readable]].[[controller]], e).
readable_stream_default_controller_error(*readable_controller, error);
// 2. Perform ! TransformStreamErrorWritableAndUnblockWrite(stream, e).
TRY(transform_stream_error_writable_and_unblock_write(stream, error));
return {};
}
// https://streams.spec.whatwg.org/#transform-stream-error-writable-and-unblock-write
WebIDL::ExceptionOr<void> transform_stream_error_writable_and_unblock_write(TransformStream& stream, JS::Value error)
{

View file

@ -133,6 +133,7 @@ WebIDL::ExceptionOr<void> writable_stream_default_controller_process_write(Writa
WebIDL::ExceptionOr<void> writable_stream_default_controller_write(WritableStreamDefaultController&, JS::Value chunk, JS::Value chunk_size);
void transform_stream_default_controller_clear_algorithms(TransformStreamDefaultController&);
WebIDL::ExceptionOr<void> transform_stream_error(TransformStream&, JS::Value error);
WebIDL::ExceptionOr<void> transform_stream_error_writable_and_unblock_write(TransformStream&, JS::Value error);
WebIDL::ExceptionOr<void> transform_stream_set_backpressure(TransformStream&, bool backpressure);