Bug 691424 - Ensure that plugin processes that can't create a crash reporter actor abort the plugin creation process. r=bsmedberg
authorJosh Matthews <josh@joshmatthews.net>
Wed, 19 Oct 2011 15:32:17 -0400
changeset 79605 54dde714ef41d7b8659792a13e9cde14530fc09d
parent 79604 f1b0380e2fb6dd35cf9065fca6050b7f8a555359
child 79606 b3d39e8a44b8360740ff0f3d8dc65a4a40af5d18
push id506
push userclegnitto@mozilla.com
push dateWed, 09 Nov 2011 02:03:18 +0000
treeherdermozilla-aurora@63587fc7bb93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs691424
milestone10.0a1
Bug 691424 - Ensure that plugin processes that can't create a crash reporter actor abort the plugin creation process. r=bsmedberg
dom/ipc/CrashReporterParent.h
dom/plugins/ipc/PluginModuleParent.cpp
--- a/dom/ipc/CrashReporterParent.h
+++ b/dom/ipc/CrashReporterParent.h
@@ -81,17 +81,17 @@ public:
   template<class Toplevel>
   bool
   GenerateCrashReport(Toplevel* t, const AnnotationTable* processNotes);
 
   /* Instantiate a new crash reporter actor from a given parent that manages
      the protocol.
   */
   template<class Toplevel>
-  static void CreateCrashReporter(Toplevel* actor);
+  static bool CreateCrashReporter(Toplevel* actor);
 #endif
   /* Initialize this reporter with data from the child process */
   void
     SetChildData(const NativeThreadId& id, const PRUint32& processType);
 
   /* Returns the shared hang ID of a parent/child paired minidump.
      GeneratePairedMinidump must be called first.
   */
@@ -171,28 +171,30 @@ CrashReporterParent::GenerateCrashReport
   if (t->TakeMinidump(getter_AddRefs(crashDump)) &&
       CrashReporter::GetIDFromMinidump(crashDump, mChildDumpID)) {
     return GenerateChildData(processNotes);
   }
   return false;
 }
 
 template<class Toplevel>
-/* static */ void
+/* static */ bool
 CrashReporterParent::CreateCrashReporter(Toplevel* actor)
 {
 #ifdef MOZ_CRASHREPORTER
   NativeThreadId id;
   PRUint32 processType;
   PCrashReporterParent* p =
       actor->CallPCrashReporterConstructor(&id, &processType);
   if (p) {
     static_cast<CrashReporterParent*>(p)->SetChildData(id, processType);
   } else {
     NS_ERROR("Error creating crash reporter actor");
   }
+  return !!p;
 #endif
+  return false;
 }
 
 #endif
 
 } // namespace dom
 } // namespace mozilla
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -111,17 +111,21 @@ PluginModuleParent::LoadModule(const cha
         return nsnull;
     }
     parent->Open(parent->mSubprocess->GetChannel(),
                  parent->mSubprocess->GetChildProcessHandle());
 
     TimeoutChanged(kChildTimeoutPref, parent);
 
 #ifdef MOZ_CRASHREPORTER
-    CrashReporterParent::CreateCrashReporter(parent.get());
+    // If this fails, we're having IPC troubles, and we're doomed anyways.
+    if (!CrashReporterParent::CreateCrashReporter(parent.get())) {
+        parent->mShutdown = true;
+        return nsnull;
+    }
 #endif
 
     return parent.forget();
 }
 
 
 PluginModuleParent::PluginModuleParent(const char* aFilePath)
     : mSubprocess(new PluginProcessParent(aFilePath))