Bug 124066 - Uncaught exceptions raised in promise completion functions are not printed to console
Summary: Uncaught exceptions raised in promise completion functions are not printed to...
Status: RESOLVED DUPLICATE of bug 150358
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-11-08 13:15 PST by Alexey Proskuryakov
Modified: 2017-04-27 20:37 PDT (History)
6 users (show)

See Also:


Attachments
test case (358 bytes, text/html)
2013-11-08 13:15 PST, Alexey Proskuryakov
no flags Details
another test case (314 bytes, text/html)
2013-12-02 16:57 PST, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2013-11-08 13:15:57 PST
Created attachment 216429 [details]
test case

E.g.

crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, true, ["sign", "verify"]).then(function(result) {
    throw("See me?");
});

Marking this as blocking WebCrypto, because it's super difficult to use WebCrypto form JS when uncaught exceptions are not visible in Inspector. In fact, this is even slowing down writing tests for me, even though I'm only targeting WebKit, and know what and when raises exceptions.
Comment 1 Alexey Proskuryakov 2013-12-02 16:57:39 PST
Created attachment 218241 [details]
another test case

A test case that doesn't use WebCrypto.

What happens here is when JSPromiseWrapperCallback::callPromiseWrapperCallback() sees an exception, it immediately clears it, and invokes resolver's reject callback with the exception as argument. But when there are no reject callbacks registered, it's just dropped on the floor.

Perhaps the exception shouldn't be cleared when there are no reject callbacks to handle it, and then JSGlobalObjectCallback could report it in the same way as other code that executes JS does. ScriptController::evaluateInWorld() and JSEventListener::handleEvent() seem like they could serve as models.
Comment 2 Joseph Pecoraro 2014-08-05 12:14:30 PDT
This sounds bad! The Web Inspector should know about all exceptions.
Comment 3 Radar WebKit Bug Importer 2014-08-05 12:14:38 PDT
<rdar://problem/17920074>
Comment 4 Joseph Pecoraro 2016-12-12 18:48:08 PST
There is already some work in this area on bug 150358.

With the HTML Spec's unhandledpromiserejection / rejectionhandled events.
Comment 5 Joseph Pecoraro 2017-04-27 20:37:48 PDT
This was addressed by: bug 150358

• The first test case is outdated (there is no Promise.fulfill anymore)
• The second test case produces:
[Error] Unhandled Promise Rejection: See me?

*** This bug has been marked as a duplicate of bug 150358 ***