Bug 843671 - Fix plugin instance owner teardown. r=bsmedberg

This commit is contained in:
John Schoenick 2013-03-14 18:29:16 -07:00
parent 1c38d16428
commit 961e5573aa
2 changed files with 9 additions and 17 deletions

View File

@ -101,8 +101,6 @@ interface nsIObjectLoadingContent : nsISupports
*/
[noscript] void hasNewFrame(in nsIObjectFrame aFrame);
[noscript] void disconnectFrame();
/**
* If this object is in going to be printed, this method
* returns the nsIObjectFrame object which should be used when

View File

@ -981,7 +981,7 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
}
// Disconnect any existing frame
DisconnectFrame();
mInstanceOwner->SetFrame(nullptr);
// Set up relationship between instance owner and frame.
nsObjectFrame *objFrame = static_cast<nsObjectFrame*>(aFrame);
@ -994,15 +994,6 @@ nsObjectLoadingContent::HasNewFrame(nsIObjectFrame* aFrame)
return NS_OK;
}
NS_IMETHODIMP
nsObjectLoadingContent::DisconnectFrame()
{
if (mInstanceOwner) {
mInstanceOwner->SetFrame(nullptr);
}
return NS_OK;
}
NS_IMETHODIMP
nsObjectLoadingContent::GetPluginInstance(nsNPAPIPluginInstance** aInstance)
{
@ -2273,7 +2264,8 @@ nsObjectLoadingContent::PluginDestroyed()
// plugins in plugin host. Invalidate instance owner / prototype but otherwise
// don't take any action.
TeardownProtoChain();
CloseChannel();
mInstanceOwner->SetFrame(nullptr);
mInstanceOwner->Destroy();
mInstanceOwner = nullptr;
return NS_OK;
}
@ -2521,8 +2513,8 @@ nsObjectLoadingContent::DoStopPlugin(nsPluginInstanceOwner* aInstanceOwner,
pluginHost->StopPluginInstance(inst);
}
TeardownProtoChain();
aInstanceOwner->Destroy();
mIsStopping = false;
}
@ -2546,7 +2538,7 @@ nsObjectLoadingContent::StopPluginInstance()
CloseChannel();
}
DisconnectFrame();
mInstanceOwner->SetFrame(nullptr);
bool delayedStop = false;
#ifdef XP_WIN
@ -2563,10 +2555,12 @@ nsObjectLoadingContent::StopPluginInstance()
}
#endif
DoStopPlugin(mInstanceOwner, delayedStop);
nsRefPtr<nsPluginInstanceOwner> ownerGrip(mInstanceOwner);
mInstanceOwner = nullptr;
// This can/will re-enter
DoStopPlugin(ownerGrip, delayedStop);
return NS_OK;
}