зеркало из https://github.com/mozilla/gecko-dev.git
Bug 851378 - Notify owning content when we destroy plugins from under it. r=bsmedberg
This commit is contained in:
Родитель
4b58995789
Коммит
96294aabb8
|
@ -111,6 +111,10 @@ interface nsIObjectLoadingContent : nsISupports
|
|||
*/
|
||||
[noscript] nsIFrame getPrintFrame();
|
||||
|
||||
/*
|
||||
* Notifications from pluginhost that our instance crashed or was destroyed.
|
||||
*/
|
||||
[noscript] void pluginDestroyed();
|
||||
[noscript] void pluginCrashed(in nsIPluginTag pluginTag,
|
||||
in AString pluginDumpID,
|
||||
in AString browserDumpID,
|
||||
|
|
|
@ -2266,6 +2266,18 @@ nsObjectLoadingContent::GetPrintFrame(nsIFrame** aFrame)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::PluginDestroyed()
|
||||
{
|
||||
// Called when our plugin is destroyed from under us, usually when reloading
|
||||
// plugins in plugin host. Invalidate instance owner / prototype but otherwise
|
||||
// don't take any action.
|
||||
TeardownProtoChain();
|
||||
CloseChannel();
|
||||
mInstanceOwner = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag,
|
||||
const nsAString& pluginDumpID,
|
||||
|
@ -2275,10 +2287,7 @@ nsObjectLoadingContent::PluginCrashed(nsIPluginTag* aPluginTag,
|
|||
LOG(("OBJLC [%p]: Plugin Crashed, queuing crash event", this));
|
||||
NS_ASSERTION(mType == eType_Plugin, "PluginCrashed at non-plugin type");
|
||||
|
||||
// Instance is dead, clean up
|
||||
TeardownProtoChain();
|
||||
mInstanceOwner = nullptr;
|
||||
CloseChannel();
|
||||
PluginDestroyed();
|
||||
|
||||
// Switch to fallback/crashed state, notify
|
||||
LoadFallback(eFallbackCrashed, true);
|
||||
|
|
|
@ -3782,9 +3782,21 @@ nsPluginHost::DestroyRunningInstances(nsTArray<nsCOMPtr<nsIDocument> >* aReloadD
|
|||
// Get rid of all the instances without the possibility of caching.
|
||||
nsPluginTag* pluginTag = TagForPlugin(instance->GetPlugin());
|
||||
instance->SetWindow(nullptr);
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
instance->GetDOMElement(getter_AddRefs(domElement));
|
||||
nsCOMPtr<nsIObjectLoadingContent> objectContent =
|
||||
do_QueryInterface(domElement);
|
||||
|
||||
instance->Destroy();
|
||||
|
||||
mInstances.RemoveElement(instance);
|
||||
OnPluginInstanceDestroyed(pluginTag);
|
||||
|
||||
// Notify owning content that we destroyed its plugin out from under it
|
||||
if (objectContent) {
|
||||
objectContent->PluginDestroyed();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче