Re: [whatwg/streams] Settle reader.[[closedPromise]] before performing close/error steps of read requests (#1102)

> As you've found, it is observable, so please remove this sentence. 😄

Good point. Updated the PR description. 🙂

> On balance, I think it's still worth trying to avoid multiple resolves / rejects in the reference implementation and standard, since it helps us catch some kinds of bugs.

Would it make sense for the promise helpers in the reference implementation to *assert* that the promise is still pending? That is, change these lines in `resolvePromise` and `rejectPromise`:
```diff
- if (promiseSideTable.get(p).stateIsPending === false) {
-   return;
- }
+ assert(promiseSideTable.get(p).stateIsPending === true);
```
We could do this *only* in the reference implementation, just to help catch bugs. Or would we also want to add normative asserts everywhere we resolve or reject a promise in the specification text?

-- 
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/pull/1102#issuecomment-773658589

Received on Thursday, 4 February 2021 22:59:19 UTC