<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>291255</bug_id>
          
          <creation_ts>2025-04-08 00:26:17 -0700</creation_ts>
          <short_desc>`export async function` changes prototype to Function instead of AsyncFunction</short_desc>
          <delta_ts>2025-04-11 15:17:18 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jarred Sumner">jarred</reporter>
          <assigned_to name="Yusuke Suzuki">ysuzuki</assigned_to>
          <cc>keith_miller</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2109664</commentid>
    <comment_count>0</comment_count>
    <who name="Jarred Sumner">jarred</who>
    <bug_when>2025-04-08 00:26:17 -0700</bug_when>
    <thetext>The following code doesn&apos;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(&quot;Expected export declaration &amp; export function to have same prototype&quot;);
}

if (Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) {
  throw new Error(&quot;Expected export &amp; non-exported functions to have same prototype&quot;);
}

if (Object.getPrototypeOf(a).constructor !== Object.getPrototypeOf(c).constructor) {
  throw new Error(&quot;Expected export declaration &amp; export function to have same constructor&quot;);
}

if (Object.getPrototypeOf(a).constructor !== Object.getPrototypeOf(b).constructor) {
  throw new Error(&quot;Expected export &amp; non-exported functions to have same constructor&quot;);
}

if (Object.getPrototypeOf(a).constructor.name !== &quot;AsyncFunction&quot;) {
  throw new Error(&quot;Expected AsyncFunction&quot;);
}
globalThis.print ??= console.log;

const AsyncFunction = Object.getPrototypeOf(a).constructor;

// This should not throw
new AsyncFunction(&quot;await 42&quot;)();

export { c };
```

Originally reported in https://github.com/oven-sh/bun/issues/18137</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110501</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-04-11 12:32:38 -0700</bug_when>
    <thetext>&lt;rdar://problem/149083588&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110503</commentid>
    <comment_count>2</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2025-04-11 12:44:45 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/43970</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2110561</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-04-11 15:17:16 -0700</bug_when>
    <thetext>Committed 293602@main (910c1b00a197): &lt;https://commits.webkit.org/293602@main&gt;

Reviewed commits have been landed. Closing PR #43970 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>