Fixing bug 422926 (and also bugs 420886 and 423260). Don't do delayed stops of plugins unless we're deleting the frame, as some plugins apparently can't handle that. r+sr=jonas@sicking.cc

This commit is contained in:
jst%mozilla.org 2008-03-19 19:43:10 +00:00
Родитель 04f2577aa6
Коммит c84281e354
1 изменённых файлов: 5 добавлений и 19 удалений

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

@ -1683,7 +1683,7 @@ private:
};
static void
DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aIsDelayedAlready)
DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
{
nsCOMPtr<nsIPluginInstance> inst;
aInstanceOwner->GetInstance(*getter_AddRefs(inst));
@ -1720,7 +1720,7 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aIsDelayedAlready)
else
inst->SetWindow(nsnull);
if (!aIsDelayedAlready) {
if (aDelayedStop) {
nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
NS_DispatchToCurrentThread(evt);
@ -1737,7 +1737,7 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aIsDelayedAlready)
else
inst->SetWindow(nsnull);
if (!aIsDelayedAlready) {
if (aDelayedStop) {
nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
NS_DispatchToCurrentThread(evt);
@ -1763,7 +1763,7 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aIsDelayedAlready)
NS_IMETHODIMP
nsStopPluginRunnable::Run()
{
DoStopPlugin(mInstanceOwner, PR_TRUE);
DoStopPlugin(mInstanceOwner, PR_FALSE);
return NS_OK;
}
@ -1813,21 +1813,7 @@ nsObjectFrame::StopPluginInternal(PRBool aDelayedStop)
// touch it!
owner->PrepareToStop(aDelayedStop);
#ifdef XP_WIN
// We only deal with delayed stopping of plugins on Win32 for now,
// as that's the only platform where we need to (AFAIK) and it's
// unclear how safe widget parenting is on other platforms.
if (aDelayedStop) {
// nsStopPluginRunnable will hold a strong reference to owner
// (mInstanceOwner), and thus keep it alive as long as it needs
// it.
nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(owner);
NS_DispatchToCurrentThread(evt);
} else
#endif
{
DoStopPlugin(owner, PR_FALSE);
}
DoStopPlugin(owner, aDelayedStop);
// Break relationship between frame and plugin instance owner
owner->SetOwner(nsnull);