1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

LibWeb: Implement TransformStreamDefaultController::enqueue()

This commit is contained in:
Kenneth Myhra 2023-07-07 19:35:15 +02:00 committed by Andreas Kling
parent e028918a64
commit 4ae82983a4
3 changed files with 11 additions and 1 deletions

View file

@ -43,6 +43,15 @@ Optional<double> TransformStreamDefaultController::desired_size()
return readable_stream_default_controller_get_desired_size(*readable_controller); return readable_stream_default_controller_get_desired_size(*readable_controller);
} }
// https://streams.spec.whatwg.org/#ts-default-controller-enqueue
WebIDL::ExceptionOr<void> TransformStreamDefaultController::enqueue(Optional<JS::Value> chunk)
{
// 1. Perform ? TransformStreamDefaultControllerEnqueue(this, chunk).
TRY(transform_stream_default_controller_enqueue(*this, chunk.has_value() ? chunk.value() : JS::js_undefined()));
return {};
}
// https://streams.spec.whatwg.org/#ts-default-controller-error // https://streams.spec.whatwg.org/#ts-default-controller-error
WebIDL::ExceptionOr<void> TransformStreamDefaultController::error(Optional<JS::Value> reason) WebIDL::ExceptionOr<void> TransformStreamDefaultController::error(Optional<JS::Value> reason)
{ {

View file

@ -19,6 +19,7 @@ public:
virtual ~TransformStreamDefaultController() override; virtual ~TransformStreamDefaultController() override;
Optional<double> desired_size(); Optional<double> desired_size();
WebIDL::ExceptionOr<void> enqueue(Optional<JS::Value> chunk);
WebIDL::ExceptionOr<void> error(Optional<JS::Value> reason = {}); WebIDL::ExceptionOr<void> error(Optional<JS::Value> reason = {});
auto& flush_algorithm() { return m_flush_algorithm; } auto& flush_algorithm() { return m_flush_algorithm; }

View file

@ -3,7 +3,7 @@
interface TransformStreamDefaultController { interface TransformStreamDefaultController {
readonly attribute unrestricted double? desiredSize; readonly attribute unrestricted double? desiredSize;
// FIXME: undefined enqueue(optional any chunk); undefined enqueue(optional any chunk);
undefined error(optional any reason); undefined error(optional any reason);
// FIXME: undefined terminate(); // FIXME: undefined terminate();
}; };