[whatwg/streams] # Handling Abrupt Completions in ReadableStreamDefaultControllerCallPullIfNeeded? (#1161)

All calls to `ReadableStreamDefaultControllerCallPullIfNeeded` are prefixed with !, [which asserts it should never return an abrupt completion](https://tc39.es/ecma262/#sec-returnifabrupt-shorthands). 

However, the [algorithm steps](https://streams.spec.whatwg.org/commit-snapshots/1246ccb6897cdc9e6d10da06506685a374abf4c1/#readable-stream-default-controller-call-pull-if-needed) include an invocation of a user-controlled algorithm: 

> 6. Let pullPromise be the result of performing controller\.\[\[pullAlgorithm\]\]\.

I'm confused as to how we're supposed to handle an abrupt completion of [[pullAlgorithm]]. 

Exploring the SpiderMonkey implementation, it seems at one point there was an algorithm, [`PromiseCall` ](https://searchfox.org/mozilla-central/rev/9dceacf3d761eb91237108ec438d64099a56f442/js/src/builtin/streams/MiscellaneousOperations-inl.h#32-62), which would take an abrupt completion and return a promise rejected with the error; but we don’t seem to have that algorithm in the current spec. I sort of assume the expectation is that we’re supposed to continue doing that, but I don’t follow how I get that from the specification. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1161

Received on Thursday, 19 August 2021 15:23:46 UTC