Bug 890840 - calling KillHard() multiple times may crash parent process. r=jlebar

This commit is contained in:
Mark Hammond 2013-08-17 10:44:17 +10:00
Родитель 4c971fbac6
Коммит d6d156b7b1
2 изменённых файлов: 11 добавлений и 2 удалений

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

@ -1184,6 +1184,7 @@ ContentParent::ContentParent(mozIApplication* aApp,
, mIsForBrowser(aIsForBrowser)
, mCalledClose(false)
, mCalledCloseWithError(false)
, mCalledKillHard(false)
{
// No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated should
// be true.
@ -1921,6 +1922,13 @@ ContentParent::GetOrCreateActorForBlob(nsIDOMBlob* aBlob)
void
ContentParent::KillHard()
{
// On Windows, calling KillHard multiple times causes problems - the
// process handle becomes invalid on the first call, causing a second call
// to crash our process - more details in bug 890840.
if (mCalledKillHard) {
return;
}
mCalledKillHard = true;
mForceKillTask = nullptr;
// This ensures the process is eventually killed, but doesn't
// immediately KILLITWITHFIRE because we want to get a minidump if

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

@ -475,10 +475,11 @@ private:
bool mSendPermissionUpdates;
bool mIsForBrowser;
// These variables track whether we've called Close() and CloseWithError()
// on our channel.
// These variables track whether we've called Close(), CloseWithError()
// and KillHard() on our channel.
bool mCalledClose;
bool mCalledCloseWithError;
bool mCalledKillHard;
friend class CrashReporterParent;