Skip to content

Conversation

@kennethmyhra
Copy link

@kennethmyhra kennethmyhra commented Aug 20, 2024

When the user of the API does no supply a cancel algorithm make sure to
forward the reason argument to the resolved promise.

This changes step 4. of algorithm
SetUpTransformStreamDefaultControllerFromTransformer making sure to
forward the reason argument to the resolved promise. With this change
the reason argument in step 7. 'React to cancelPromise' of algorithm
TransformStreamDefaultSourceCancel will no longer be undefined.

--

I work on the Ladybird browser and think this PR might resolve a spec bug. We have some failing WPT tests in transform-streams/backpressure/any.html, specifically:

  • writer.closed should resolve after readable is canceled during start
  • writer.closed should resolve after readable is canceled with backpressure
  • writer.closed should resolve after readable is canceled with no backpressure

Correcting step 4 in SetUpTransformStreamDefaultControllerFromTransformer as described above so that the reason argument is propagated to the resolved promise resolves these failing tests.


Preview | Diff

When the user of the API does not supply a cancel algorithm make sure to
forward the reason argument to the resolved promise.

This changes step 4. of algorithm
SetUpTransformStreamDefaultControllerFromTransformer making sure to
forward the reason argument to the resolved promise. With this change
the reason argument in step 7. 'React to cancelPromise' of algorithm
TransformStreamDefaultSourceCancel will no longer be undefined.
@domenic
Copy link
Member

domenic commented Aug 21, 2024

The reference implementation manages to pass these tests despite following the current spec:

let cancelAlgorithm = () => promiseResolvedWith(undefined);
. Are you able to explain the discrepancy?

@kennethmyhra
Copy link
Author

Right, looking through the reference implementation the incoming reason argument for TransformStreamDefaultSourceCancelAlgorithm is the one used by the onFulfilled lambda.

WritableStreamDefaultControllerErrorIfNeeded(writable._controller, reason);

Then this is a bug in our implementation and not a spec issue. Thanks for the prompt reply!

@kennethmyhra kennethmyhra deleted the propagate-reason-argument branch August 21, 2024 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants