Bug 259439 - await promise prevents error being thrown in JavaScript module
Summary: await promise prevents error being thrown in JavaScript module
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 258662 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-07-24 01:06 PDT by beaufort.francois
Modified: 2024-04-06 20:22 PDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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. ***