- From: Mattias Buelens <notifications@github.com>
- Date: Thu, 19 Aug 2021 08:58:13 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/issues/1161/902032645@github.com>
`controller.[[pullAlgorithm]]` cannot return an abrupt completion. [SetUpReadableStreamDefaultControllerFromUnderlyingSource](https://streams.spec.whatwg.org/#set-up-readable-stream-default-controller-from-underlying-source) sets _pullAlgorithm_ to the result of [invoking](https://heycam.github.io/webidl/#invoke-a-callback-function) `underlyingSourceDict["pull"]`. Because the return type of [`UnderlyingSourcePullCallback`](https://streams.spec.whatwg.org/#callbackdef-underlyingsourcepullcallback) is `Promise<undefined>`, the WebIDL invoke algorithm will go through these steps: > 14. Return: at this point _completion_ will be set to an ECMAScript completion value. > 14.4. If _completion_ is an abrupt completion and the callback function has a return type that is not a promise type, return completion. > 14.5. Let _rejectedPromise_ be ! Call(`%Promise.reject%`, `%Promise%`, «completion.[[Value]]»). > 14.6. Return the result of converting _rejectedPromise_ to the callback function’s return type. Indeed, previously we didn't use Web IDL for this, so we had a separate `PromiseCall` helper. But now we leverage Web IDL's conversion logic, and we expect implementers to conform to the Web IDL spec. -- 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#issuecomment-902032645
Received on Thursday, 19 August 2021 15:58:26 UTC