From 48921add866e2b2302e3a51e1806016979d2cecb Mon Sep 17 00:00:00 2001 From: Kenneth Myhra Date: Fri, 7 Jul 2023 21:58:12 +0200 Subject: [PATCH] LibWeb: Add AO transform_stream_default_sink_abort_algorithm() --- .../Libraries/LibWeb/Streams/AbstractOperations.cpp | 12 ++++++++++++ .../Libraries/LibWeb/Streams/AbstractOperations.h | 1 + 2 files changed, 13 insertions(+) diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp index 815d85507d..951c187218 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.cpp @@ -2845,6 +2845,18 @@ WebIDL::ExceptionOr> transform_stream_default_ return WebIDL::create_resolved_promise(realm, react_result); } +// https://streams.spec.whatwg.org/#transform-stream-default-sink-abort-algorithm +WebIDL::ExceptionOr> transform_stream_default_sink_abort_algorithm(TransformStream& stream, JS::Value reason) +{ + auto& realm = stream.realm(); + + // 1. Perform ! TransformStreamError(stream, reason). + TRY(transform_stream_error(stream, reason)); + + // 2. Return a promise resolved with undefined. + return WebIDL::create_resolved_promise(realm, JS::js_undefined()); +} + // https://streams.spec.whatwg.org/#transform-stream-default-sink-write-algorithm WebIDL::ExceptionOr> transform_stream_default_sink_write_algorithm(TransformStream& stream, JS::Value chunk) { diff --git a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h index 5ba7af528c..6590ea0f33 100644 --- a/Userland/Libraries/LibWeb/Streams/AbstractOperations.h +++ b/Userland/Libraries/LibWeb/Streams/AbstractOperations.h @@ -138,6 +138,7 @@ WebIDL::ExceptionOr transform_stream_default_controller_enqueue(TransformS WebIDL::ExceptionOr transform_stream_default_controller_error(TransformStreamDefaultController&, JS::Value error); WebIDL::ExceptionOr transform_stream_default_controller_terminate(TransformStreamDefaultController&); WebIDL::ExceptionOr> transform_stream_default_controller_perform_transform(TransformStreamDefaultController&, JS::Value chunk); +WebIDL::ExceptionOr> transform_stream_default_sink_abort_algorithm(TransformStream&, JS::Value reason); WebIDL::ExceptionOr> transform_stream_default_sink_write_algorithm(TransformStream&, JS::Value chunk); WebIDL::ExceptionOr transform_stream_error(TransformStream&, JS::Value error); WebIDL::ExceptionOr transform_stream_error_writable_and_unblock_write(TransformStream&, JS::Value error);