15
15
#include " mozilla/ArrayUtils.h"
16
16
17
17
#include " nsCOMPtr.h"
18
- #include " nsExceptionHandler.h"
19
18
#include " nsAutoPtr.h"
20
19
#include " nsMemory.h"
21
20
#include " nsProcess.h"
@@ -246,7 +245,19 @@ void nsProcess::Monitor(void* aArg) {
246
245
exitCode = -1 ;
247
246
}
248
247
}
249
- #elif defined(XP_UNIX)
248
+
249
+ // Lock in case Kill or GetExitCode are called during this
250
+ {
251
+ MutexAutoLock lock (process->mLock );
252
+ CloseHandle (process->mProcess );
253
+ process->mProcess = nullptr ;
254
+ process->mExitValue = exitCode;
255
+ if (process->mShutdown ) {
256
+ return ;
257
+ }
258
+ }
259
+ #else
260
+ # ifdef XP_UNIX
250
261
int exitCode = -1 ;
251
262
int status = 0 ;
252
263
pid_t result;
@@ -260,30 +271,25 @@ void nsProcess::Monitor(void* aArg) {
260
271
exitCode = 256 ; // match NSPR's signal exit status
261
272
}
262
273
}
263
- #else
274
+ # else
264
275
int32_t exitCode = -1 ;
265
276
if (PR_WaitProcess (process->mProcess , &exitCode) != PR_SUCCESS) {
266
277
exitCode = -1 ;
267
278
}
268
- #endif
269
-
270
- // The application has finished executing once we reach this point
271
- RemoveExecutableCrashAnnotation ();
279
+ # endif
272
280
273
281
// Lock in case Kill or GetExitCode are called during this
274
282
{
275
283
MutexAutoLock lock (process->mLock );
276
- #if defined(PROCESSMODEL_WINAPI)
277
- CloseHandle (process->mProcess );
278
- #endif
279
- #if !defined(XP_UNIX)
284
+ # if !defined(XP_UNIX)
280
285
process->mProcess = nullptr ;
281
- #endif
286
+ # endif
282
287
process->mExitValue = exitCode;
283
288
if (process->mShutdown ) {
284
289
return ;
285
290
}
286
291
}
292
+ #endif
287
293
288
294
// If we ran a background thread for the monitor then notify on the main
289
295
// thread
@@ -541,8 +547,6 @@ nsresult nsProcess::RunProcess(bool aBlocking, char** aMyArgv,
541
547
mPid = ptrProc->pid ;
542
548
#endif
543
549
544
- AddExecutableCrashAnnotation ();
545
-
546
550
NS_ADDREF_THIS ();
547
551
mBlocking = aBlocking;
548
552
if (aBlocking) {
@@ -580,33 +584,6 @@ nsProcess::GetIsRunning(bool* aIsRunning) {
580
584
return NS_OK;
581
585
}
582
586
583
- void nsProcess::AddExecutableCrashAnnotation () {
584
- #if defined(XP_WIN)
585
- nsAutoCString executableName;
586
- if (NS_FAILED(mExecutable ->GetNativeLeafName (executableName))) {
587
- return ;
588
- }
589
-
590
- // The following executables might be launched during shutdown and lead to a
591
- // shutdown hang. We're adding this annotation to try and detect which is the
592
- // culprit of bug 1386760
593
- if (executableName.EqualsLiteral (" minidump-analyzer.exe" ) ||
594
- executableName.EqualsLiteral (" pingsender.exe" ) ||
595
- executableName.EqualsLiteral (" updater.exe" )) {
596
- CrashReporter::AnnotateCrashReport (
597
- CrashReporter::Annotation::ExecutableName, executableName.get ());
598
- }
599
- #endif // defined(XP_WIN)
600
- }
601
-
602
- /* static */
603
- void nsProcess::RemoveExecutableCrashAnnotation () {
604
- #if defined(XP_WIN)
605
- CrashReporter::RemoveCrashReportAnnotation (
606
- CrashReporter::Annotation::ExecutableName);
607
- #endif // defined(XP_WIN)
608
- }
609
-
610
587
NS_IMETHODIMP
611
588
nsProcess::GetStartHidden (bool * aStartHidden) {
612
589
*aStartHidden = mStartHidden ;
0 commit comments