Bug 1299581 - Crash immediately if we try to fork()/CreateProcess() in content. r?jld draft
authorGian-Carlo Pascutto <gcp@mozilla.com>
Mon, 24 Oct 2016 16:44:34 +0200
changeset 428676 51045445671613b8e379c4750a0d864a974e6c2a
parent 428665 dbedfec333961ef77c6016b23932d68a1f39f37a
child 534812 9aaedb68971f3d01b3af4b066a17d651e8973091
push id33394
push userbmo:gpascutto@mozilla.com
push dateMon, 24 Oct 2016 14:44:54 +0000
reviewersjld
bugs1299581
milestone52.0a1
Bug 1299581 - Crash immediately if we try to fork()/CreateProcess() in content. r?jld MozReview-Commit-ID: Lp2ZLjKzrR1
xpcom/threads/nsProcessCommon.cpp
--- a/xpcom/threads/nsProcessCommon.cpp
+++ b/xpcom/threads/nsProcessCommon.cpp
@@ -18,16 +18,17 @@
 #include "nsAutoPtr.h"
 #include "nsMemory.h"
 #include "nsProcess.h"
 #include "prio.h"
 #include "prenv.h"
 #include "nsCRT.h"
 #include "nsThreadUtils.h"
 #include "nsIObserverService.h"
+#include "nsXULAppAPI.h"
 #include "mozilla/Services.h"
 
 #include <stdlib.h>
 
 #if defined(PROCESSMODEL_WINAPI)
 #include "prmem.h"
 #include "nsString.h"
 #include "nsLiteralString.h"
@@ -425,16 +426,19 @@ nsProcess::CopyArgsAndRunProcessw(bool a
   free(my_argv);
   return rv;
 }
 
 nsresult
 nsProcess::RunProcess(bool aBlocking, char** aMyArgv, nsIObserver* aObserver,
                       bool aHoldWeak, bool aArgsUTF8)
 {
+  if (GeckoProcessType_Content == XRE_GetProcessType()) {
+    MOZ_CRASH("No launching of new processes in the content process.");
+  }
   if (NS_WARN_IF(!mExecutable)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   if (NS_WARN_IF(mThread)) {
     return NS_ERROR_ALREADY_INITIALIZED;
   }
 
   if (aObserver) {