Bug 977955 - Cleanup PluginModule shutdown r=bsmedberg

This commit is contained in:
John Schoenick 2014-02-28 15:39:17 -08:00
Родитель 548fe541ea
Коммит bc1a522ee9
1 изменённых файлов: 12 добавлений и 9 удалений

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

@ -96,7 +96,7 @@ PluginModuleParent::LoadModule(const char* aFilePath)
nsAutoPtr<PluginModuleParent> parent(new PluginModuleParent(aFilePath));
bool launched = parent->mSubprocess->Launch(prefSecs * 1000);
if (!launched) {
// Need to set this so the destructor doesn't complain.
// We never reached open
parent->mShutdown = true;
return nullptr;
}
@ -108,7 +108,7 @@ PluginModuleParent::LoadModule(const char* aFilePath)
#ifdef MOZ_CRASHREPORTER
// If this fails, we're having IPC troubles, and we're doomed anyways.
if (!CrashReporterParent::CreateCrashReporter(parent.get())) {
parent->mShutdown = true;
parent->Close();
return nullptr;
}
#ifdef XP_WIN
@ -160,7 +160,9 @@ PluginModuleParent::PluginModuleParent(const char* aFilePath)
PluginModuleParent::~PluginModuleParent()
{
NS_ASSERTION(OkToCleanup(), "unsafe destruction");
if (!OkToCleanup()) {
NS_RUNTIMEABORT("unsafe destruction");
}
#ifdef MOZ_ENABLE_PROFILER_SPS
ShutdownPluginProfiling();
@ -171,6 +173,7 @@ PluginModuleParent::~PluginModuleParent()
NPError err;
NP_Shutdown(&err);
}
NS_ASSERTION(mShutdown, "NP_Shutdown didn't");
if (mSubprocess) {
@ -228,7 +231,7 @@ PluginModuleParent::WriteExtraDataForMinidump(AnnotationTable& notes)
pluginVersion = tag->mVersion;
}
}
notes.Put(NS_LITERAL_CSTRING("PluginName"), pluginName);
notes.Put(NS_LITERAL_CSTRING("PluginVersion"), pluginVersion);
@ -751,7 +754,7 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
break;
default:
NS_ERROR("Unexpected shutdown reason for toplevel actor.");
NS_RUNTIMEABORT("Unexpected shutdown reason for toplevel actor.");
}
}
@ -1194,11 +1197,11 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs
uint32_t flags = 0;
if (!CallNP_Initialize(flags, error)) {
mShutdown = true;
Close();
return NS_ERROR_FAILURE;
}
else if (*error != NPERR_NO_ERROR) {
mShutdown = true;
Close();
return NS_OK;
}
@ -1225,11 +1228,11 @@ PluginModuleParent::NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error)
#endif
if (!CallNP_Initialize(flags, error)) {
mShutdown = true;
Close();
return NS_ERROR_FAILURE;
}
if (*error != NPERR_NO_ERROR) {
mShutdown = true;
Close();
return NS_OK;
}