Fix getAsyncDisposableMethod to fall back to @@dispose per TC39 spec#162
Fix getAsyncDisposableMethod to fall back to @@dispose per TC39 spec#162
Conversation
The getAsyncDisposableMethod builtin was checking !isCallable(method) before checking isUndefinedOrNull(method), causing a TypeError when @@asyncDispose was undefined instead of falling back to @@dispose. Per the TC39 spec (GetDisposeMethod with hint async-dispose): 1. Check for @@asyncDispose first 2. If undefined/null, fall back to @@dispose and wrap in Promise adapter 3. Only throw if neither is available Also fixes AsyncDisposableStackPrototype.use() which was incorrectly using @getDisposableStackInternalField instead of @getAsyncDisposableStackInternalField. Fixes oven-sh/bun#24277 Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Comment |
…4277) Add regression test for AsyncDisposableStack.use() throwing "@@asyncDispose must be callable" when passed an object that only has Symbol.dispose (not Symbol.asyncDispose). The fix is in WebKit's getAsyncDisposableMethod builtin which needs to check for undefined/null before isCallable, then fall back to @@dispose per the TC39 spec. See oven-sh/WebKit#162. Co-Authored-By: Claude <noreply@anthropic.com>
|
Will this fix be contributed to WebKit? |
Summary
getAsyncDisposableMethodJSC builtin to checkundefined/nullbeforeisCallable, then fall back to@@disposewrapped in a Promise adapter per the TC39 specAsyncDisposableStackPrototype.use()which was incorrectly using@getDisposableStackInternalField(sync) instead of@getAsyncDisposableStackInternalField(async)createDisposableResourceto reflect that either@@asyncDisposeor@@disposeis acceptedTest plan
AsyncDisposableStack.use()with sync-only@@disposeobjects works correctlyawait usingwith sync-only@@disposeobjects works correctly@@asyncDisposestill work as before@@asyncDisposenor@@disposestill throw TypeError🤖 Generated with Claude Code