Bug 825976: Only use the crash reporter actor if it was successfully created. r=ted
authorChris Jones <jones.chris.g@gmail.com>
Thu, 03 Jan 2013 15:39:25 -0800
changeset 123101 b33bd9f6bd697bdc8d69d3bf19c3e8af4667ad6f
parent 123100 652b044f22d6e0722673c929c85842c8acb4c677
child 123102 fc3fd7c51000b4d73baa10090dcb25a6846fdfd0
push idunknown
push userunknown
push dateunknown
reviewersted
bugs825976
milestone20.0a1
Bug 825976: Only use the crash reporter actor if it was successfully created. r=ted
dom/ipc/ContentParent.cpp
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -700,26 +700,30 @@ ContentParent::ActorDestroy(ActorDestroy
         props->Init();
 
         props->SetPropertyAsUint64(NS_LITERAL_STRING("childID"), mChildID);
 
         if (AbnormalShutdown == why) {
             props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true);
 
 #ifdef MOZ_CRASHREPORTER
-            MOZ_ASSERT(ManagedPCrashReporterParent().Length() > 0);
-            CrashReporterParent* crashReporter =
+            // There's a window in which child processes can crash
+            // after IPC is established, but before a crash reporter
+            // is created.
+            if (ManagedPCrashReporterParent().Length() > 0) {
+                CrashReporterParent* crashReporter =
                     static_cast<CrashReporterParent*>(ManagedPCrashReporterParent()[0]);
 
-            crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("URL"),
-                                               NS_ConvertUTF16toUTF8(mAppManifestURL));
-            crashReporter->GenerateCrashReport(this, NULL);
+                crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("URL"),
+                                                   NS_ConvertUTF16toUTF8(mAppManifestURL));
+                crashReporter->GenerateCrashReport(this, NULL);
 
-            nsAutoString dumpID(crashReporter->ChildDumpID());
-            props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
+                nsAutoString dumpID(crashReporter->ChildDumpID());
+                props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
+            }
 #endif
         }
         obs->NotifyObservers((nsIPropertyBag2*) props, "ipc:content-shutdown", nullptr);
     }
 
     MessageLoop::current()->
         PostTask(FROM_HERE,
                  NewRunnableFunction(DelayedDeleteSubprocess, mSubprocess));