- From: Mattias Buelens <notifications@github.com>
- Date: Wed, 18 Oct 2023 02:12:40 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/issues/1296/1768023180@github.com>
@saschanaz The WebIDL specification (as currently written) requires this. In step 13 of [invoke a callback function type](https://webidl.spec.whatwg.org/#invoke-a-callback-function), the call result is converted to an IDL value. This must be an IDL Promise, whose [conversion](https://webidl.spec.whatwg.org/#es-promise) is defined as: > 1. Let _promiseCapability_ be [?](https://tc39.es/ecma262/#sec-returnifabrupt-shorthands) [NewPromiseCapability](https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-newpromisecapability)([`%Promise%`](https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promise-constructor)). > 2. Perform [?](https://tc39.es/ecma262/#sec-returnifabrupt-shorthands) [Call](https://tc39.es/ecma262/multipage/abstract-operations.html#sec-call)(_promiseCapability_.\[[Resolve]], **undefined**, « _V_ »). > 3. Return _promiseCapability_. It would be nice if this could use [the `PromiseResolve` abstract op](https://webidl.spec.whatwg.org/#a-promise-resolved-with) instead, but then the "shape" of an IDL Promise type would change. Right now, it's a [Promise Capability Record](https://tc39.es/ecma262/multipage/control-abstraction-objects.html#sec-promisecapability-records), with \[[Promise]], \[[Resolve]] and \[[Reject]] internal slots. But `PromiseResolve` only returns the promise... Maybe we could give it no-op resolve and reject functions, since they won't be used anyway? -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/issues/1296#issuecomment-1768023180 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/streams/issues/1296/1768023180@github.com>
Received on Wednesday, 18 October 2023 09:12:47 UTC