Bug 130923

Summary: Uncaught NSExceptions should crash the web process
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: WebKit2Assignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: mitz, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch mitz: review+

Description Anders Carlsson 2014-03-28 17:34:28 PDT
Uncatched NSExceptions should crash the web process
Comment 1 Radar WebKit Bug Importer 2014-03-28 17:35:04 PDT
<rdar://problem/16463751>
Comment 2 Anders Carlsson 2014-03-28 17:37:18 PDT
Created attachment 228101 [details]
Patch
Comment 3 mitz 2014-03-28 17:40:21 PDT
Comment on attachment 228101 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=228101&action=review

> Source/WebKit2/ChangeLog:3
> +        Uncatched NSExceptions should crash the web process

Uncaught

> Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm:191
> +    [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions" : @YES }];

What is the behavior in the non-AppKit configuration? Does it already crash on exceptions? Can we make it crash on exceptions?
Comment 4 Anders Carlsson 2014-03-29 09:12:42 PDT
(In reply to comment #3)
> (From update of attachment 228101 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=228101&action=review
> 
> > Source/WebKit2/ChangeLog:3
> > +        Uncatched NSExceptions should crash the web process
> 
> Uncaught
> 
> > Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm:191
> > +    [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions" : @YES }];
> 
> What is the behavior in the non-AppKit configuration? Does it already crash on exceptions? Can we make it crash on exceptions?

I think we can use std::set_terminate to set the exception handler, but I'm not sure if it's possible to get the exception (or stack trace) from there.
Comment 5 Anders Carlsson 2014-03-29 09:15:08 PDT
Committed r166452: <http://trac.webkit.org/changeset/166452>
Comment 6 mitz 2014-03-29 10:19:42 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 228101 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=228101&action=review
> > 
> > > Source/WebKit2/ChangeLog:3
> > > +        Uncatched NSExceptions should crash the web process
> > 
> > Uncaught
> > 
> > > Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm:191
> > > +    [[NSUserDefaults standardUserDefaults] registerDefaults:@{ @"NSApplicationCrashOnExceptions" : @YES }];
> > 
> > What is the behavior in the non-AppKit configuration? Does it already crash on exceptions? Can we make it crash on exceptions?
> 
> I think we can use std::set_terminate to set the exception handler, but I'm not sure if it's possible to get the exception (or stack trace) from there.

I was thinking along the lines of using NSSetUncaughtExceptionHandler().