Bug 1782199: Unregister the WER runtime module before returning from main. r=gsvelto

Differential Revision: https://phabricator.services.mozilla.com/D153728
This commit is contained in:
Bob Owen 2022-08-08 12:05:00 +00:00
Родитель 0c6ca7991f
Коммит 3dd8f8e969
2 изменённых файлов: 11 добавлений и 0 удалений

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

@ -10,6 +10,7 @@
#include "mozilla/Bootstrap.h"
#include "mozilla/ProcessType.h"
#include "mozilla/RuntimeExceptionModule.h"
#include "mozilla/ScopeExit.h"
#include "BrowserDefines.h"
#if defined(XP_WIN)
# include <windows.h>
@ -292,6 +293,11 @@ int main(int argc, char* argv[], char* envp[]) {
AUTO_BASE_PROFILER_INIT;
AUTO_BASE_PROFILER_LABEL("nsBrowserApp main", OTHER);
// Make sure we unregister the runtime exception module before returning.
// We do this here to cover both registers for child and main processes.
auto unregisterRuntimeExceptionModule =
MakeScopeExit([] { CrashReporter::UnregisterRuntimeExceptionModule(); });
#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
// We are launching as a content process, delegate to the appropriate
// main

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

@ -8,6 +8,7 @@
#include "mozilla/Bootstrap.h"
#include "mozilla/RuntimeExceptionModule.h"
#include "mozilla/ScopeExit.h"
#if defined(XP_WIN)
# include "mozilla/WindowsDllBlocklist.h"
# include "mozilla/GeckoArgs.h"
@ -76,6 +77,10 @@ int main(int argc, char* argv[]) {
// process type has been set.
CrashReporter::RegisterRuntimeExceptionModule();
// Make sure we unregister the runtime exception module before returning.
auto unregisterRuntimeExceptionModule = MakeScopeExit(
[] { CrashReporter::UnregisterRuntimeExceptionModule(); });
#ifdef HAS_DLL_BLOCKLIST
uint32_t initFlags = eDllBlocklistInitFlagIsChildProcess;
# if defined(MOZ_SANDBOX)