Skip to content

Test or specification problem with TransformStream readable.cancel and calling controller.error #1296

Open
@evilpie

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()

https://github.com/web-platform-tests/wpt/blob/4ab37a2aa733a03162ce2d5e3782d5da7940c330/streams/transform-streams/cancel.any.js#L79

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.

@lucacasonato @MattiasBuelens

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions