[Webkit-unassigned] [Bug 187822] New: unhandledrejection event doesn't fire across realms

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 19 14:50:38 PDT 2018


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

            Bug ID: 187822
           Summary: unhandledrejection event doesn't fire across realms
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebCore JavaScript
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: timothygu99 at gmail.com

With this HTML:

<iframe></iframe>
<script>
const frame = frames[0];
frame.onunhandledrejection = () => { alert("Rejected!"); };
frame.Promise.reject();
</script>

The "Rejected!" message is not shown, but it is on Chrome.

----

There is an interesting twist to this, as executing the script inside a frame.setTimeout() (which makes the entry realm [1] to Promise.reject be that of the iframe) would allow the alert to execute. The following code works:

<iframe></iframe>
<script>
const frame = frames[0];
frame.setTimeout(() => {
  frame.onunhandledrejection = () => { alert("Rejected!"); };
  frame.Promise.reject();
});
</script>

[1]: https://html.spec.whatwg.org/multipage/webappapis.html#concept-entry-realm

----

Merely a setTimeout does not fix the problem. The following does not alert the message either:

<iframe></iframe>
<script>
const frame = frames[0];
setTimeout(() => {
  frame.onunhandledrejection = () => { alert("Rejected!"); };
  frame.Promise.reject();
});
</script>

-- 
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/20180719/48deb35d/attachment.html>


More information about the webkit-unassigned mailing list