Fixing a WebKit bug to see if promises are made of train tracks
Web page · https://alistair.sh/thenables
First seen by Oriel on .
AI summary
This article explains a WebKit JavaScriptCore bug where an exception during thenable assimilation left promises pending, and shows how a 16-line fix restored spec-compliant rejection.
- Safari 26 and Bun 1.3.14 hung because a promise with a throwing Symbol.species getter remained pending instead of rejecting, unlike Node.js.
- Promise resolution first reads value.then; non-functions fulfill directly, thenables are assimilated, and getter failures reject the promise.
- JavaScriptCore’s fast path looked up species before creating resolving functions, so an exception had no available reject function.
- WebKit/WebKit#68749 creates resolving functions first, making Bun 1.4 and Safari 27 behave like Node.
- Because engine operations can introduce unforeseen rejection reasons, TypeScript’s Promise<T> cannot safely expose a second failure type.
#javascript #webkit #promises #typescript
Generated by gpt-5.6-sol. Check the original for details.
Metric trends
Last 30 days · Up to 120 recorded samples per source and metric, with reposts kept separate · First and latest retained
Points
Score reported by the source.
- Lobsters: 25, latest observation ; +21 over observed period since
Comments
Comment count reported by the source.
- Lobsters: 2, latest observation ; +2 over observed period since
Aliases
| Source | External ID | URL |
|---|---|---|
| Lobsters | yxvn7j | https://alistair.sh/thenables Read discussion |