-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add TrasformStream finally callback #1231
Conversation
I thought the plan was to add Adding a |
sure, seems i somehow missed that in the original issue, will change this PR to that |
@domenic adjusted the behaviour & name |
one issue i currently havent handled yet is what to do in case the |
1. Perform ! [$TransformStreamDefaultControllerClearAlgorithms$](|stream|.[=TransformStream/[[controller]]=]). | ||
1. Perform ! | ||
[$WritableStreamDefaultControllerErrorIfNeeded$](|stream|.[=TransformStream/[[writable]]=].[=WritableStream/[[controller]]=], |e|). | ||
1. If |stream|.[=TransformStream/[[backpressure]]=] is true, perform ! [$TransformStreamSetBackpressure$](|stream|, | ||
false). | ||
1. Perform ! |stream|.[=TransformStream/[[controller]]=].[=TransformStreamDefaultController/[[finallyAlgorithm]]=](). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This algorithm will already have been cleared by TransformStreamDefaultControllerClearAlgorithms
in step 1, so this won't work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, it currently isnt, as i am unsure how to proceed without moving the clear algs
@@ -5965,6 +5981,7 @@ side=] of [=transform streams=]. | |||
1. Perform ! [$TransformStreamDefaultControllerClearAlgorithms$](|controller|). | |||
1. Return the result of [=reacting=] to |flushPromise|: | |||
1. If |flushPromise| was fulfilled, then: | |||
1. Perform ! |stream|.[=TransformStream/[[controller]]=].[=TransformStreamDefaultController/[[finallyAlgorithm]]=](). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once again, this algorithm has already been cleared in step 4.
Handling this is complicated, since Should we ignore the returned promise and let it cause an unhandled promise rejection? |
Opened a new PR at #1283 that specs this with an alternative approach and fixes the "use after free" issues. That PR also has tests and an the reference implementation has been updated. |
Closing as Luca implemented this. |
Closes #1212
The only thing left is what to do in case of the callback throwing/rejecting (and potentially somehow awaiting the callback? unsure if thats necessary).
(See WHATWG Working Mode: Changes for more details.)
Preview | Diff