WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
187822
unhandledrejection event doesn't fire across realms
https://bugs.webkit.org/show_bug.cgi?id=187822
Summary
unhandledrejection event doesn't fire across realms
Timothy Gu
Reported
2018-07-19 14:50:38 PDT
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>
Attachments
Add attachment
proposed patch, testcase, etc.
Timothy Gu
Comment 1
2018-07-19 15:19:08 PDT
There is certainly some ambiguity in the HTML spec about what the right global object the event is fired on should be (should it be on frame? or window?) [1]. An enhanced version of reproduction case tries to handle this uncertainty by permitting both possibilities: <iframe></iframe> <script> const frame = frames[0]; window.onunhandledrejection = () => { alert("Rejected!"); }; frame.onunhandledrejection = () => { alert("Rejected!"); }; frame.Promise.reject(); </script> Yet, even in this case, the message is not shown. As an additional data point, with this HTML sample, the "Rejected!" message is shown as soon as I try to launch Web Inspector. [1]:
https://github.com/whatwg/html/issues/958
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug