Bug 1693434 - Report uncaught Objective C exceptions. r=spohl

NSSetUncaughtExceptionHandler installs a handler which is called just before we
would crash anyway, I think. So this handler lets us collect information about
exceptions that are not even caught by the native event loop.

Differential Revision: https://phabricator.services.mozilla.com/D105561
This commit is contained in:
Markus Stange 2021-02-18 17:25:52 +00:00
Родитель f5abfe3c32
Коммит e81702af5f
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -122,8 +122,18 @@ extern int32_t gXULModalLevel;
static bool gAppShellMethodsSwizzled = false;
void OnUncaughtException(NSException* aException) {
nsObjCExceptionLog(aException);
MOZ_CRASH("Uncaught Objective C exception from NSSetUncaughtExceptionHandler");
}
@implementation GeckoNSApplication
// Load is called very early during startup, when the Objective C runtime loads this class.
+ (void)load {
NSSetUncaughtExceptionHandler(OnUncaughtException);
}
- (void)sendEvent:(NSEvent*)anEvent {
mozilla::BackgroundHangMonitor().NotifyActivity();