LibWeb: Update cancel_algorithm steps in AO initialize_transform_stream

This commit is contained in:
Kenneth Myhra 2024-06-07 12:23:41 +02:00 committed by Tim Flynn
parent e848249b8d
commit 38142eaf53
Notes: sideshowbarker 2024-07-17 18:23:22 +09:00

View File

@ -4742,12 +4742,9 @@ void initialize_transform_stream(TransformStream& stream, JS::NonnullGCPtr<JS::P
});
// 7. Let cancelAlgorithm be the following steps, taking a reason argument:
auto cancel_algorithm = JS::create_heap_function(realm.heap(), [&stream, &realm](JS::Value reason) {
// 1. Perform ! TransformStreamErrorWritableAndUnblockWrite(stream, reason).
transform_stream_error_writable_and_unblock_write(stream, reason);
// 2. Return a promise resolved with undefined.
return WebIDL::create_resolved_promise(realm, JS::js_undefined());
auto cancel_algorithm = JS::create_heap_function(realm.heap(), [&stream](JS::Value reason) {
// 1. Return ! TransformStreamDefaultSourceCancelAlgorithm(stream, reason).
return transform_stream_default_source_cancel_algorithm(stream, reason);
});
// 8. Set stream.[[readable]] to ! CreateReadableStream(startAlgorithm, pullAlgorithm, cancelAlgorithm, readableHighWaterMark, readableSizeAlgorithm).