Bug 1132874 - Improve PPluginWidget shutdown logic. r=aklotz

This commit is contained in:
Jim Mathies
2015-02-19 07:05:12 -06:00
parent e99782bf81
commit 0167655cf1
6 changed files with 93 additions and 65 deletions

View File

@@ -38,7 +38,7 @@ PluginWidgetProxy::PluginWidgetProxy(dom::TabChild* aTabChild,
mActor(aActor)
{
// See ChannelDestroyed() in the header
mActor->mWidget = this;
mActor->SetWidget(this);
}
PluginWidgetProxy::~PluginWidgetProxy()
@@ -99,22 +99,9 @@ PluginWidgetProxy::Destroy()
PWLOG("PluginWidgetProxy::Destroy()\n");
if (mActor) {
/**
* We need to communicate that the sub protocol is going to be torn down
* before the sub protocol dies. Otherwise we can end up with async events
* in transit from chrome to content, which on arrival will trigger an abort
* in the content process, crashing all tabs.
*
* Note, this is one of two ways PluginWidget tear down initiates. Here we
* are a plugin in content and content has just unloaded us for some reason,
* usually due to swap out for flash ads or the user simply loaded a
* different page. The other involves a full tear down of the tab (PBrowser)
* which happens prior to widgets getting collected by ref counting in
* layout. We still get this Destroy call, but in all likelyhood mActor is
* already null via a call on ChannelDestroyed from PluginWidgetChild.
*/
mActor->SendDestroy();
mActor->mWidget = nullptr;
// Communicate that the layout widget has been torn down before the sub
// protocol.
mActor->ProxyShutdown();
mActor = nullptr;
}