diff --git a/mozilla/widget/src/cocoa/nsCocoaWindow.mm b/mozilla/widget/src/cocoa/nsCocoaWindow.mm index 704d23b6345..2909203aab0 100644 --- a/mozilla/widget/src/cocoa/nsCocoaWindow.mm +++ b/mozilla/widget/src/cocoa/nsCocoaWindow.mm @@ -2159,7 +2159,10 @@ already_AddRefed GetFocusedElement() // NSWindow's own sendEvent: method. - (void)nsCocoaWindow_NSWindow_sendEvent:(NSEvent *)anEvent { - NS_OBJC_BEGIN_TRY_ABORT_BLOCK; + // Since we've hooked a "system call" ([NSWindow sendEvent:]), we're always + // called from system code (not browser code). So avoid crashing on any + // Objective-C exceptions that occur here. + NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK; nsCOMPtr oldFocusedElement; NSResponder *oldFirstResponder; @@ -2198,7 +2201,7 @@ already_AddRefed GetFocusedElement() [oldFirstResponder release]; } - NS_OBJC_END_TRY_ABORT_BLOCK; + NS_OBJC_END_TRY_LOGONLY_BLOCK; } @end diff --git a/mozilla/xpcom/base/nsObjCExceptions.h b/mozilla/xpcom/base/nsObjCExceptions.h index d7be453aa93..40af53fe5fc 100644 --- a/mozilla/xpcom/base/nsObjCExceptions.h +++ b/mozilla/xpcom/base/nsObjCExceptions.h @@ -221,4 +221,9 @@ NS_OBJC_TRY(_e, ) } \ return _rv; +#define NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK @try { +#define NS_OBJC_END_TRY_LOGONLY_BLOCK } @catch(NSException *_exn) { \ + nsObjCExceptionLog(_exn); \ + } + #endif // nsObjCExceptions_h_