mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 786650 - Abort load of channel-having plugins without frames at the appropriate point. r=josh
This commit is contained in:
parent
58eddd29c3
commit
4af1b4f3b9
@ -687,21 +687,29 @@ nsObjectLoadingContent::~nsObjectLoadingContent()
|
||||
nsresult
|
||||
nsObjectLoadingContent::InstantiatePluginInstance()
|
||||
{
|
||||
if (mType != eType_Plugin || mIsLoading) {
|
||||
LOG(("OBJLC [%p]: Not instantiating loading or non-plugin object, type %u",
|
||||
this, mType));
|
||||
if (mInstanceOwner || mType != eType_Plugin || mIsLoading || mInstantiating) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent *>(this));
|
||||
|
||||
// Flush layout so that the frame is created if possible and the plugin is
|
||||
// initialized with the latest information.
|
||||
nsIDocument* doc = thisContent->GetCurrentDoc();
|
||||
|
||||
if (!doc || !InActiveDocument(thisContent)) {
|
||||
NS_ERROR("Shouldn't be calling "
|
||||
"InstantiatePluginInstance without an active document");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
if (!thisContent->GetPrimaryFrame()) {
|
||||
LOG(("OBJLC [%p]: Not instantiating plugin with no frame", this));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Don't do anything if we already have an active instance.
|
||||
if (mInstanceOwner) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Don't allow re-entry into initialization code.
|
||||
if (mInstantiating) {
|
||||
return NS_OK;
|
||||
}
|
||||
mInstantiating = true;
|
||||
AutoSetInstantiatingToFalse autoInstantiating(this);
|
||||
|
||||
@ -710,20 +718,6 @@ nsObjectLoadingContent::InstantiatePluginInstance()
|
||||
// of this method.
|
||||
nsCOMPtr<nsIObjectLoadingContent> kungFuDeathGrip = this;
|
||||
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent *>(this));
|
||||
// Flush layout so that the plugin is initialized with the latest information.
|
||||
nsIDocument* doc = thisContent->GetCurrentDoc();
|
||||
if (!doc) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!InActiveDocument(thisContent)) {
|
||||
NS_ERROR("Shouldn't be calling "
|
||||
"InstantiatePluginInstance in an inactive document");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsRefPtr<nsPluginHost> pluginHost =
|
||||
already_AddRefed<nsPluginHost>(nsPluginHost::GetInst());
|
||||
@ -1729,6 +1723,14 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
|
||||
oldType = mType;
|
||||
oldState = ObjectState();
|
||||
|
||||
if (!thisContent->GetPrimaryFrame()) {
|
||||
// We're un-rendered, and can't instantiate a plugin. HasNewFrame will
|
||||
// re-start us when we can proceed.
|
||||
LOG(("OBJLC [%p]: Aborting load - plugin-type, but no frame", this));
|
||||
CloseChannel();
|
||||
break;
|
||||
}
|
||||
|
||||
rv = pluginHost->NewEmbeddedPluginStreamListener(mURI, this, nullptr,
|
||||
getter_AddRefs(mFinalListener));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -3224,6 +3224,7 @@ nsresult nsPluginInstanceOwner::Init(nsIContent* aContent)
|
||||
// document is destroyed before we try to create the new one.
|
||||
objFrame->PresContext()->EnsureVisible();
|
||||
} else {
|
||||
NS_NOTREACHED("Should not be initializing plugin without a frame");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user