WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
291255
`export async function` changes prototype to Function instead of AsyncFunction
https://bugs.webkit.org/show_bug.cgi?id=291255
Summary
`export async function` changes prototype to Function instead of AsyncFunction
Jarred Sumner
Reported
2025-04-08 00:26:17 PDT
The following code doesn't throw an error in node/v8 and does throw an error in JSC: ``` export async function a() {} async function b() {} async function c() {} if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(c)) { throw new Error("Expected export declaration & export function to have same prototype"); } if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) { throw new Error("Expected export & non-exported functions to have same prototype"); } if (Object.getPrototypeOf(a).constructor !== Object.getPrototypeOf(c).constructor) { throw new Error("Expected export declaration & export function to have same constructor"); } if (Object.getPrototypeOf(a).constructor !== Object.getPrototypeOf(b).constructor) { throw new Error("Expected export & non-exported functions to have same constructor"); } if (Object.getPrototypeOf(a).constructor.name !== "AsyncFunction") { throw new Error("Expected AsyncFunction"); } globalThis.print ??= console.log; const AsyncFunction = Object.getPrototypeOf(a).constructor; // This should not throw new AsyncFunction("await 42")(); export { c }; ``` Originally reported in
https://github.com/oven-sh/bun/issues/18137
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2025-04-11 12:32:38 PDT
<
rdar://problem/149083588
>
Yusuke Suzuki
Comment 2
2025-04-11 12:44:45 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/43970
EWS
Comment 3
2025-04-11 15:17:16 PDT
Committed
293602@main
(910c1b00a197): <
https://commits.webkit.org/293602@main
> Reviewed commits have been landed. Closing PR #43970 and removing active labels.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug