[Webkit-unassigned] [Bug 258662] New: Promise rejections in top-level await can't be handled

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 29 02:13:25 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=258662

            Bug ID: 258662
           Summary: Promise rejections in top-level await can't be handled
           Product: WebKit
           Version: Safari 16
          Hardware: Mac (Intel)
                OS: macOS 13
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: bugs.webkit at peter.gassner.io

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`.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230629/a1cf902f/attachment.htm>


More information about the webkit-unassigned mailing list