mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
LibWeb/Streams: Update comments for resolved spec bug
Our bug report has been resolved in the same way we had already applied a fix (just with some asserts added) with: https://github.com/whatwg/streams/commit/86d07e
This commit is contained in:
parent
cc0ad0d1ef
commit
1647893fc8
Notes:
github-actions[bot]
2024-11-27 09:59:43 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/1647893fc88 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2607 Reviewed-by: https://github.com/gmta ✅
1 changed files with 11 additions and 7 deletions
|
@ -4554,15 +4554,19 @@ 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. If controller.[[strategySizeAlgorithm]] is undefined, then:
|
||||
if (!controller.strategy_size_algorithm()) {
|
||||
// 1. Assert: controller.[[stream]].[[state]] is "erroring" or "errored".
|
||||
VERIFY(controller.stream()->state() == WritableStream::State::Erroring || controller.stream()->state() == WritableStream::State::Errored);
|
||||
|
||||
// 1. Let returnValue be the result of performing controller.[[strategySizeAlgorithm]], passing in chunk, and interpreting the result as a completion record.
|
||||
// 2. Return 1.
|
||||
return JS::Value { 1.0 };
|
||||
}
|
||||
|
||||
// 2. 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);
|
||||
|
||||
// 2. If returnValue is an abrupt completion,
|
||||
// 3. If returnValue is an abrupt completion,
|
||||
if (return_value.is_abrupt()) {
|
||||
// 1. Perform ! WritableStreamDefaultControllerErrorIfNeeded(controller, returnValue.[[Value]]).
|
||||
writable_stream_default_controller_error_if_needed(controller, *return_value.release_value());
|
||||
|
@ -4571,7 +4575,7 @@ JS::Value writable_stream_default_controller_get_chunk_size(WritableStreamDefaul
|
|||
return JS::Value { 1.0 };
|
||||
}
|
||||
|
||||
// 3. Return returnValue.[[Value]].
|
||||
// 4. Return returnValue.[[Value]].
|
||||
return *return_value.release_value();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue