Bug 840277 - Explicitly check that the preallocated process hasn't been killed before we use it. r=cjones

We have to do this check /after/ we set the process's priority, since
before then, it has BACKGROUND priority and is a candidate for killing.
This commit is contained in:
Justin Lebar 2013-02-14 02:26:43 -05:00
Родитель 3161a04a33
Коммит 9f4d1cf12d
1 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -564,7 +564,22 @@ ContentParent::TransformPreallocatedIntoApp(const nsAString& aAppManifestURL,
PROCESS_PRIORITY_FOREGROUND);
}
// If this fails, the child process died.
// Now that we've increased the process's priority from BACKGROUND (where
// the preallocated app sits) to something higher, check whether the process
// is still alive. Hopefully the process won't unexpectedly crash after
// this point!
//
// It's not legal to call DidProcessCrash on Windows if the process has not
// terminated yet, so we have to skip this check there.
#ifndef XP_WIN
bool exited = false;
base::DidProcessCrash(&exited, mSubprocess->GetChildProcessHandle());
if (exited) {
return false;
}
#endif
return SendSetProcessPrivileges(aPrivs);
}