mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-02 14:48:15 +00:00
LibWeb: Use alternative workaround for null strategy algorithm on abort
This unfortunately caused a regression for the included WPT test. Instead of reordering the spec step, fall back to the default size strategy of 1.
This commit is contained in:
@@ -4255,7 +4255,7 @@ JS::NonnullGCPtr<WebIDL::Promise> writable_stream_default_writer_write(WritableS
|
||||
auto controller = stream->controller();
|
||||
|
||||
// 4. Let chunkSize be ! WritableStreamDefaultControllerGetChunkSize(controller, chunk).
|
||||
// NOTE: See FIXME below
|
||||
auto chunk_size = writable_stream_default_controller_get_chunk_size(*controller, chunk);
|
||||
|
||||
// 5. If stream is not equal to writer.[[stream]], return a promise rejected with a TypeError exception.
|
||||
if (stream.ptr() != writer.stream().ptr()) {
|
||||
@@ -4280,11 +4280,6 @@ JS::NonnullGCPtr<WebIDL::Promise> writable_stream_default_writer_write(WritableS
|
||||
if (state == WritableStream::State::Erroring)
|
||||
return WebIDL::create_rejected_promise(realm, stream->stored_error());
|
||||
|
||||
// 4. Let chunkSize be ! WritableStreamDefaultControllerGetChunkSize(controller, chunk).
|
||||
// FIXME: This is out of order due to a spec bug: https://github.com/whatwg/streams/issues/1331
|
||||
// An abort clears the strategySizeAlgorithm, so we need to move this past the "erroring" check
|
||||
auto chunk_size = writable_stream_default_controller_get_chunk_size(*controller, chunk);
|
||||
|
||||
// 10. Assert: state is "writable".
|
||||
VERIFY(state == WritableStream::State::Writable);
|
||||
|
||||
@@ -4559,6 +4554,11 @@ bool writable_stream_default_controller_get_backpressure(WritableStreamDefaultCo
|
||||
// https://streams.spec.whatwg.org/#writable-stream-default-controller-get-chunk-size
|
||||
JS::Value writable_stream_default_controller_get_chunk_size(WritableStreamDefaultController& controller, JS::Value chunk)
|
||||
{
|
||||
// FIXME: This null check is due to a spec bug: https://github.com/whatwg/streams/issues/1331
|
||||
// An abort clears the strategySizeAlgorithm, so fall back to default value if we don't have any algorithm.
|
||||
if (!controller.strategy_size_algorithm())
|
||||
return JS::Value { 1.0 };
|
||||
|
||||
// 1. Let returnValue be the result of performing controller.[[strategySizeAlgorithm]], passing in chunk, and interpreting the result as a completion record.
|
||||
auto return_value = controller.strategy_size_algorithm()->function()(chunk);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user