Fix for bug 91238 -- unwanted initial plugin stream, r=peterl, edburns, sr=jst

git-svn-id: svn://10.0.0.236/trunk@100716 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
av%netscape.com 2001-08-10 01:46:12 +00:00
parent 7e004bc6fa
commit df3f946dbf

View File

@ -2818,7 +2818,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateEmbededPlugin(const char *aMimeType,
{
nsresult rv;
nsIPluginInstance *instance = nsnull;
nsCOMPtr<nsIPluginTagInfo2> pti2 = nsnull;
nsCOMPtr<nsIPluginTagInfo2> pti2;
nsPluginTagType tagType;
PRBool isJavaEnabled = PR_TRUE;
@ -2866,7 +2866,7 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateEmbededPlugin(const char *aMimeType,
if(FindStoppedPluginForURL(aURL, aOwner) == NS_OK)
{
#ifdef NS_DEBUG
printf("InstantiateEmbededPlugin find stopped\n");
printf("InstantiateEmbededPlugin find stopped\n");
#endif
aOwner->GetInstance(instance);
@ -2937,39 +2937,53 @@ NS_IMETHODIMP nsPluginHostImpl::InstantiateEmbededPlugin(const char *aMimeType,
if(rv == NS_ERROR_FAILURE)
return rv;
// if we are here then we have loaded a plugin for this mimetype
// and it could be the Default plugin
// if we are here then we have loaded a plugin for this mimetype
// and it could be the Default plugin
nsPluginWindow *window = nsnull;
nsPluginWindow *window = nsnull;
//we got a plugin built, now stream
aOwner->GetWindow(window);
//we got a plugin built, now stream
aOwner->GetWindow(window);
if (nsnull != instance)
{
instance->Start();
aOwner->CreateWidget();
if (nsnull != instance)
{
instance->Start();
aOwner->CreateWidget();
// If we've got a native window, the let the plugin know about it.
if (window->window)
instance->SetWindow(window);
// If we've got a native window, the let the plugin know about it.
if (window->window)
instance->SetWindow(window);
// don't make an initial steam if it's a java applet
if(!aMimeType ||
(PL_strcasecmp(aMimeType, "application/x-java-vm") != 0 &&
PL_strcasecmp(aMimeType, "application/x-java-applet") != 0))
rv = NewEmbededPluginStream(aURL, nsnull, instance);
// create an initial stream with data
// don't make the stream if it's a java applet or we don't have SRC or DATA attribute
PRBool applet = (PL_strcasecmp(aMimeType, "application/x-java-vm") == 0 ||
PL_strcasecmp(aMimeType, "application/x-java-applet") == 0);
// notify Java DOM component
nsresult res;
nsCOMPtr<nsIPluginInstanceOwner> javaDOM =
do_GetService("@mozilla.org/blackwood/java-dom;1", &res);
if (NS_SUCCEEDED(res) && javaDOM)
javaDOM->SetInstance(instance);
PRBool havedata = PR_FALSE;
NS_RELEASE(instance);
nsCOMPtr<nsIPluginTagInfo> pti(do_QueryInterface(aOwner, &rv));
if(pti) {
const char *value;
if(tagType == nsPluginTagType_Embed)
havedata = NS_SUCCEEDED(pti->GetAttribute("SRC", &value));
if(tagType == nsPluginTagType_Object)
havedata = NS_SUCCEEDED(pti->GetAttribute("DATA", &value));
}
if(havedata && !applet)
rv = NewEmbededPluginStream(aURL, nsnull, instance);
// notify Java DOM component
nsresult res;
nsCOMPtr<nsIPluginInstanceOwner> javaDOM =
do_GetService("@mozilla.org/blackwood/java-dom;1", &res);
if (NS_SUCCEEDED(res) && javaDOM)
javaDOM->SetInstance(instance);
NS_RELEASE(instance);
}
#ifdef NS_DEBUG
printf("InstantiateEmbededPlugin.. returning\n");
#endif