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
|
nsresult
|
||||||
nsObjectLoadingContent::InstantiatePluginInstance()
|
nsObjectLoadingContent::InstantiatePluginInstance()
|
||||||
{
|
{
|
||||||
if (mType != eType_Plugin || mIsLoading) {
|
if (mInstanceOwner || mType != eType_Plugin || mIsLoading || mInstantiating) {
|
||||||
LOG(("OBJLC [%p]: Not instantiating loading or non-plugin object, type %u",
|
|
||||||
this, mType));
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't do anything if we already have an active instance.
|
nsCOMPtr<nsIContent> thisContent =
|
||||||
if (mInstanceOwner) {
|
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;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't allow re-entry into initialization code.
|
|
||||||
if (mInstantiating) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
mInstantiating = true;
|
mInstantiating = true;
|
||||||
AutoSetInstantiatingToFalse autoInstantiating(this);
|
AutoSetInstantiatingToFalse autoInstantiating(this);
|
||||||
|
|
||||||
@ -710,20 +718,6 @@ nsObjectLoadingContent::InstantiatePluginInstance()
|
|||||||
// of this method.
|
// of this method.
|
||||||
nsCOMPtr<nsIObjectLoadingContent> kungFuDeathGrip = this;
|
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;
|
nsresult rv = NS_ERROR_FAILURE;
|
||||||
nsRefPtr<nsPluginHost> pluginHost =
|
nsRefPtr<nsPluginHost> pluginHost =
|
||||||
already_AddRefed<nsPluginHost>(nsPluginHost::GetInst());
|
already_AddRefed<nsPluginHost>(nsPluginHost::GetInst());
|
||||||
@ -1729,6 +1723,14 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
|
|||||||
oldType = mType;
|
oldType = mType;
|
||||||
oldState = ObjectState();
|
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,
|
rv = pluginHost->NewEmbeddedPluginStreamListener(mURI, this, nullptr,
|
||||||
getter_AddRefs(mFinalListener));
|
getter_AddRefs(mFinalListener));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
@ -3224,6 +3224,7 @@ nsresult nsPluginInstanceOwner::Init(nsIContent* aContent)
|
|||||||
// document is destroyed before we try to create the new one.
|
// document is destroyed before we try to create the new one.
|
||||||
objFrame->PresContext()->EnsureVisible();
|
objFrame->PresContext()->EnsureVisible();
|
||||||
} else {
|
} else {
|
||||||
|
NS_NOTREACHED("Should not be initializing plugin without a frame");
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user