Bug 259439

Summary: await promise prevents error being thrown in JavaScript module
Product: WebKit Reporter: beaufort.francois
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bugs.webkit, mark.lam, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   

Description beaufort.francois 2023-07-24 01:06:43 PDT
I noticed awaiting a promise after an error was thrown in a JavaScript module does not actually throw the error.
window.onerror is never called, and the JavaScript console is empty.

```
<script type="module">
  throw new Error();
  // Adding this line will never throw the error in JavaScript console.
  await Promise.resolve();
</script>
```

Note that I can't reproduce in Chrome and Firefox.

Demo: https://early-glamorous-botany.glitch.me/
Comment 1 Radar WebKit Bug Importer 2023-07-31 01:07:16 PDT
<rdar://problem/113127236>
Comment 2 Alexey Shvayka 2024-04-06 20:22:54 PDT
*** Bug 258662 has been marked as a duplicate of this bug. ***