Bug 1367591 - Process gDelayedAnnotations on Windows and Mac as well, not just on Linux. r?jdm
MozReview-Commit-ID: LQrU8NTdj7V
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -2328,16 +2328,28 @@ static void
EnqueueDelayedNote(DelayedNote* aNote)
{
if (!gDelayedAnnotations) {
gDelayedAnnotations = new nsTArray<nsAutoPtr<DelayedNote> >();
}
gDelayedAnnotations->AppendElement(aNote);
}
+static void
+RunAndCleanUpDelayedNotes()
+{
+ if (gDelayedAnnotations) {
+ for (nsAutoPtr<DelayedNote>& note : *gDelayedAnnotations) {
+ note->Run();
+ }
+ delete gDelayedAnnotations;
+ gDelayedAnnotations = nullptr;
+ }
+}
+
nsresult AnnotateCrashReport(const nsACString& key, const nsACString& data)
{
if (!GetEnabled())
return NS_ERROR_NOT_INITIALIZED;
nsCString escapedData;
nsresult rv = EscapeAnnotation(key, data, escapedData);
if (NS_FAILED(rv))
@@ -3807,16 +3819,17 @@ SetRemoteExceptionHandler(const nsACStri
ChildFPEFilter,
nullptr, // no minidump callback
nullptr, // no callback context
google_breakpad::ExceptionHandler::HANDLER_ALL,
GetMinidumpType(),
NS_ConvertASCIItoUTF16(crashPipe).get(),
nullptr);
gExceptionHandler->set_handle_debug_exceptions(true);
+ RunAndCleanUpDelayedNotes();
#ifdef _WIN64
SetJitExceptionHandler();
#endif
mozalloc_set_oom_abort_handler(AnnotateOOMAllocationSize);
oldTerminateHandler = std::set_terminate(&TerminateHandler);
@@ -3857,23 +3870,17 @@ SetRemoteExceptionHandler()
gExceptionHandler = new google_breakpad::
ExceptionHandler(path,
ChildFilter,
nullptr, // no minidump callback
nullptr, // no callback context
true, // install signal handlers
gMagicChildCrashReportFd);
-
- if (gDelayedAnnotations) {
- for (uint32_t i = 0; i < gDelayedAnnotations->Length(); i++) {
- gDelayedAnnotations->ElementAt(i)->Run();
- }
- delete gDelayedAnnotations;
- }
+ RunAndCleanUpDelayedNotes();
mozalloc_set_oom_abort_handler(AnnotateOOMAllocationSize);
oldTerminateHandler = std::set_terminate(&TerminateHandler);
// we either do remote or nothing, no fallback to regular crash reporting
return gExceptionHandler->IsOutOfProcess();
}
@@ -3892,16 +3899,17 @@ SetRemoteExceptionHandler(const nsACStri
gExceptionHandler = new google_breakpad::
ExceptionHandler("",
ChildFilter,
nullptr, // no minidump callback
nullptr, // no callback context
true, // install signal handlers
crashPipe.BeginReading());
+ RunAndCleanUpDelayedNotes();
mozalloc_set_oom_abort_handler(AnnotateOOMAllocationSize);
oldTerminateHandler = std::set_terminate(&TerminateHandler);
// we either do remote or nothing, no fallback to regular crash reporting
return gExceptionHandler->IsOutOfProcess();
}