Bug 1299581 - Crash immediately if we try to fork()/CreateProcess() in content. r?jld
MozReview-Commit-ID: Lp2ZLjKzrR1
--- 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) {