Bug 532751 - Notify the nsNPAPIPlugin and the related nsNPAPIPluginInstances when a plugin crashes so that reloading will create a new plugin process, r=josh

This commit is contained in:
Benjamin Smedberg
2009-12-16 15:08:45 -05:00
parent 77248f633a
commit 04b5a54548
9 changed files with 93 additions and 12 deletions

View File

@@ -69,6 +69,7 @@ PluginModuleParent::PluginModuleParent(const char* aFilePath)
: mSubprocess(new PluginProcessParent(aFilePath))
, mShutdown(false)
, mNPNIface(NULL)
, mPlugin(NULL)
{
NS_ASSERTION(mSubprocess, "Out of memory!");
@@ -97,9 +98,16 @@ PluginModuleParent::ActorDestroy(ActorDestroyReason why)
{
switch (why) {
case AbnormalShutdown:
// TODObsmedberg: notify the plugin host to forget this plugin module
// and instantiate us again.
// FALL THROUGH
mShutdown = true;
// Defer the PluginCrashed method so that we don't re-enter
// and potentially modify the actor child list while enumerating it.
if (mPlugin) {
nsCOMPtr<nsIRunnable> r =
new nsRunnableMethod<nsNPAPIPlugin>(
mPlugin, &nsNPAPIPlugin::PluginCrashed);
NS_DispatchToMainThread(r);
}
break;
case NormalShutdown:
mShutdown = true;