Bug 258662
| Summary: | Promise rejections in top-level await can't be handled | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Peter Gassner <bugs.webkit> |
| Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED DUPLICATE | ||
| Severity: | Normal | CC: | ashvayka, bfulgham, bugs.webkit, joepeck, mark.lam, webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | All | ||
| OS: | All | ||
Peter Gassner
When a Promise is rejected in a JavaScript module in a top-level await position, there is no way to handle the error in WebKit.
Given an HTML document
<html>
<script src="test.js" type="module"></script>
</html>
and a script
// test.js
window.onerror = console.log;
window.addEventListener('unhandledrejection', console.log)
await Promise.reject(new Error('This should be handled'));
export {};
WebKit doesn't propagate the rejected Promise to the error handlers on window and instead crashes silently.
Both Gecko and Chromium let us handle this kind of error with `window.onerror`.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/111837095>
Alexey Shvayka
*** This bug has been marked as a duplicate of bug 259439 ***