Bug 124066

Summary: Uncaught exceptions raised in promise completion functions are not printed to console
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: bfulgham, graouts, inspector-bugzilla-changes, joepeck, sam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=147502
Attachments:
Description Flags
test case
none
another test case none

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 ***