diff --git a/index.bs b/index.bs index 8b9bf7ad2..03774cb42 100644 --- a/index.bs +++ b/index.bs @@ -5373,6 +5373,10 @@ The following abstract operations support the implementation of the id="writable-stream-default-controller-get-chunk-size">WritableStreamDefaultControllerGetChunkSize(|controller|, |chunk|) performs the following steps: + 1. If |controller|.[=WritableStreamDefaultController/[[strategySizeAlgorithm]]=] is undefined, then: + 1. Assert: |controller|.[=WritableStreamDefaultController/[[stream]]=].[=WritableStream/[[state]]=] is "`erroring`" or + "`errored`". + 1. Return 1. 1. Let |returnValue| be the result of performing |controller|.[=WritableStreamDefaultController/[[strategySizeAlgorithm]]=], passing in |chunk|, and interpreting the result as a [=completion record=]. diff --git a/reference-implementation/lib/abstract-ops/writable-streams.js b/reference-implementation/lib/abstract-ops/writable-streams.js index cf303bfe7..02b2ee7b1 100644 --- a/reference-implementation/lib/abstract-ops/writable-streams.js +++ b/reference-implementation/lib/abstract-ops/writable-streams.js @@ -662,6 +662,11 @@ function WritableStreamDefaultControllerGetBackpressure(controller) { } function WritableStreamDefaultControllerGetChunkSize(controller, chunk) { + if (controller._strategySizeAlgorithm === undefined) { + assert(controller._stream._state === 'erroring' || controller._stream._state === 'errored'); + return 1; + } + try { return controller._strategySizeAlgorithm(chunk); } catch (chunkSizeE) {