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

LibWeb: Implement ReadableByteStreamController.[[CancelSteps]]

This commit is contained in:
Matthew Olsson 2023-04-08 06:31:36 -07:00 committed by Linus Groh
parent 8274906301
commit c97f6b7701
5 changed files with 68 additions and 0 deletions

View file

@ -22,6 +22,25 @@ ReadableByteStreamController::ReadableByteStreamController(JS::Realm& realm)
{
}
// https://streams.spec.whatwg.org/#rbs-controller-private-cancel
WebIDL::ExceptionOr<JS::GCPtr<WebIDL::Promise>> ReadableByteStreamController::cancel_steps(JS::Value reason)
{
// 1. Perform ! ReadableByteStreamControllerClearPendingPullIntos(this).
readable_byte_stream_controller_clear_pending_pull_intos(*this);
// 2. Perform ! ResetQueue(this).
reset_queue(*this);
// 3. Let result be the result of performing this.[[cancelAlgorithm]], passing in reason.
auto result = (*m_cancel_algorithm)(reason);
// 4. Perform ! ReadableByteStreamControllerClearAlgorithms(this).
readable_byte_stream_controller_clear_algorithms(*this);
// 5. Return result.
return result;
}
void ReadableByteStreamController::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);