Stop QuickTime and Flip4Mac plugins directly when requested (not off an event). b=426524 r+sr=jst a1.9=beltzner

This commit is contained in:
mats.palmgren@bredband.net 2008-04-16 13:06:48 -07:00
Родитель f139a080c0
Коммит 1bf5c1fd2f
3 изменённых файлов: 50 добавлений и 15 удалений

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

@ -427,6 +427,18 @@ public:
} }
} }
const char* GetPluginName()
{
if (mInstance && mPluginHost) {
nsCOMPtr<nsPIPluginHost> piPluginHost = do_QueryInterface(mPluginHost);
char* name = NULL;
if (NS_SUCCEEDED(piPluginHost->GetPluginName(mInstance, &name)) &&
name)
return name;
}
return "";
}
private: private:
void FixUpURLS(const nsString &name, nsAString &value); void FixUpURLS(const nsString &name, nsAString &value);
@ -1741,6 +1753,28 @@ GetMIMEType(nsIPluginInstance *aPluginInstance)
return ""; return "";
} }
static PRBool
MatchPluginName(nsPluginInstanceOwner *aInstanceOwner, const char *aPluginName)
{
return strncmp(aInstanceOwner->GetPluginName(),
aPluginName,
strlen(aPluginName)) == 0;
}
static PRBool
DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
{
// Don't delay stopping QuickTime (bug 425157), Flip4Mac (bug 426524).
if (aDelayedStop &&
!::MatchPluginName(aInstanceOwner, "QuickTime") &&
!::MatchPluginName(aInstanceOwner, "Flip4Mac")) {
nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
NS_DispatchToCurrentThread(evt);
return PR_TRUE;
}
return PR_FALSE;
}
static void static void
DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop) DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
{ {
@ -1779,14 +1813,8 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
else else
inst->SetWindow(nsnull); inst->SetWindow(nsnull);
// Don't delay stopping Quicktime (bug 425157). if (DoDelayedStop(aInstanceOwner, aDelayedStop))
if (aDelayedStop &&
strcmp(::GetMIMEType(inst), "video/quicktime") != 0) {
nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
NS_DispatchToCurrentThread(evt);
return; return;
}
inst->Stop(); inst->Stop();
inst->Destroy(); inst->Destroy();
@ -1798,14 +1826,8 @@ DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, PRBool aDelayedStop)
else else
inst->SetWindow(nsnull); inst->SetWindow(nsnull);
// Don't delay stopping Quicktime (bug 425157). if (DoDelayedStop(aInstanceOwner, aDelayedStop))
if (aDelayedStop &&
strcmp(::GetMIMEType(inst), "video/quicktime") != 0) {
nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
NS_DispatchToCurrentThread(evt);
return; return;
}
inst->Stop(); inst->Stop();
} }

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

@ -46,7 +46,7 @@ interface nsIPluginInstanceOwner;
[ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow); [ptr] native nsPluginNativeWindowPtr(nsPluginNativeWindow);
[uuid(42338435-a38f-4901-97b9-d7cba643d28d)] [uuid(75d8fcd7-06d1-4767-9022-7f8dacf48a68)]
interface nsPIPluginHost : nsISupports interface nsPIPluginHost : nsISupports
{ {
/** /**
@ -103,4 +103,9 @@ interface nsPIPluginHost : nsISupports
* be non-null, if not, it will be null. * be non-null, if not, it will be null.
*/ */
[noscript] void instantiateDummyJavaPlugin(in nsIPluginInstanceOwner aOwner); [noscript] void instantiateDummyJavaPlugin(in nsIPluginInstanceOwner aOwner);
/**
* Get the plugin name for the plugin instance.
*/
[noscript] void getPluginName(in nsIPluginInstance aInstance, out string aPluginName);
}; };

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

@ -6928,6 +6928,14 @@ nsPluginHostImpl::InstantiateDummyJavaPlugin(nsIPluginInstanceOwner *aOwner)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsPluginHostImpl::GetPluginName(nsIPluginInstance *aPluginInstance,
char** aPluginName)
{
*aPluginName = (char*)GetPluginName(aPluginInstance);
return NS_OK;
}
/* ----- end of nsPIPluginHost implementation ----- */ /* ----- end of nsPIPluginHost implementation ----- */
nsresult nsresult