Test or specification problem with TransformStream readable.cancel and calling controller.error #1296
Description
What is the issue with the Streams Standard?
There is a test for TansformStream cancel (#1283) called
readable.cancel() and a parallel writable.close() should reject if a transformer.cancel() calls controller.error()
I think that test is wrong or the specification for TransformStreamDefaultSourceCancelAlgorithm
is wrong.
We can observe in that test that the promise for the cancel callback is going to be fulfilled. So we are in
Step 7.1. If cancelPromise was fulfilled, then:
The next step is
If writable.[[state]] is "errored", reject controller.[[finishPromise]] with writable.[[storedError]].
I think this step is not going to be taken, because the [[state]] is "erroring". As set by controller.error
, via WritableStreamStartErroring.
The whole path is
- TransformStreamDefaultControllerError
- TransformStreamError
- TransformStreamErrorWritableAndUnblockWrite
- WritableStreamDefaultControllerErrorIfNeeded
- WritableStreamDefaultControllerError
- WritableStreamStartErroring
So this could be fixed by changing the condition to
If writable.[[state]] is "errored" or "erroring"
Or of course adjusting the test to except a different promise resolution.