зеркало из https://github.com/mozilla/pjs.git
a=brendan, ekrock
r=av, sean@beatnik.com bug=50547 This change allows the plugin to have a greater degree of control over the plugin lifecycle. This change makes it possible for the plugin to tell mozilla: 1. Whether or not they want to allow the browser to cache their instance. Default is yes, do allow the browser to cache their instance. 2. If they answer no to 1, that is, no the plugin does not want the browser to cache their instance, do you want the shutdown calls to be: a. inst->SetWindow(nsnull); inst->Stop(); inst->Destroy(); b. inst->Stop(); inst->Destroy(); inst->SetWindow(nsnull); a. is the default. Please visit the bug to see the patches: http://bugzilla.mozilla.org/show_bug.cgi?id=50547 Detail: This fix was requested by Stanley Ho of the Sun Java Plugin Team. A conference call between Eric Krock, Andrei Volkov, Sun, Adobe and other plugin vendors was used to agree on the above solution. M modules/plugin/public/nsplugindefs.h M modules/plugin/nglsrc/nsPluginHostImpl.cpp M modules/plugin/nglsrc/nsPluginViewer.cpp M layout/html/base/src/nsObjectFrame.cpp
This commit is contained in:
Родитель
7c4a94ea29
Коммит
b344cd087c
|
@ -328,8 +328,32 @@ nsObjectFrame::Destroy(nsIPresContext* aPresContext)
|
|||
nsIPluginInstance *inst;
|
||||
if(NS_OK == mInstanceOwner->GetInstance(inst))
|
||||
{
|
||||
inst->SetWindow(nsnull);
|
||||
inst->Stop();
|
||||
PRBool doCache = PR_TRUE;
|
||||
PRBool doCallSetWindowAfterDestroy = PR_FALSE;
|
||||
|
||||
// first, determine if the plugin wants to be cached
|
||||
inst->GetValue(nsPluginInstanceVariable_DoCacheBool,
|
||||
(void *) &doCache);
|
||||
if (!doCache) {
|
||||
// then determine if the plugin wants Destroy to be called after
|
||||
// Set Window. This is for bug 50547.
|
||||
inst->GetValue(nsPluginInstanceVariable_CallSetWindowAfterDestroyBool,
|
||||
(void *) &doCallSetWindowAfterDestroy);
|
||||
if (doCallSetWindowAfterDestroy) {
|
||||
inst->Stop();
|
||||
inst->Destroy();
|
||||
inst->SetWindow(nsnull);
|
||||
}
|
||||
else {
|
||||
inst->SetWindow(nsnull);
|
||||
inst->Stop();
|
||||
inst->Destroy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
inst->SetWindow(nsnull);
|
||||
inst->Stop();
|
||||
}
|
||||
NS_RELEASE(inst);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -328,8 +328,32 @@ nsObjectFrame::Destroy(nsIPresContext* aPresContext)
|
|||
nsIPluginInstance *inst;
|
||||
if(NS_OK == mInstanceOwner->GetInstance(inst))
|
||||
{
|
||||
inst->SetWindow(nsnull);
|
||||
inst->Stop();
|
||||
PRBool doCache = PR_TRUE;
|
||||
PRBool doCallSetWindowAfterDestroy = PR_FALSE;
|
||||
|
||||
// first, determine if the plugin wants to be cached
|
||||
inst->GetValue(nsPluginInstanceVariable_DoCacheBool,
|
||||
(void *) &doCache);
|
||||
if (!doCache) {
|
||||
// then determine if the plugin wants Destroy to be called after
|
||||
// Set Window. This is for bug 50547.
|
||||
inst->GetValue(nsPluginInstanceVariable_CallSetWindowAfterDestroyBool,
|
||||
(void *) &doCallSetWindowAfterDestroy);
|
||||
if (doCallSetWindowAfterDestroy) {
|
||||
inst->Stop();
|
||||
inst->Destroy();
|
||||
inst->SetWindow(nsnull);
|
||||
}
|
||||
else {
|
||||
inst->SetWindow(nsnull);
|
||||
inst->Stop();
|
||||
inst->Destroy();
|
||||
}
|
||||
}
|
||||
else {
|
||||
inst->SetWindow(nsnull);
|
||||
inst->Stop();
|
||||
}
|
||||
NS_RELEASE(inst);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,9 @@ enum nsPluginInstancePeerVariable {
|
|||
|
||||
enum nsPluginInstanceVariable {
|
||||
nsPluginInstanceVariable_WindowlessBool = 3,
|
||||
nsPluginInstanceVariable_TransparentBool = 4
|
||||
nsPluginInstanceVariable_TransparentBool = 4,
|
||||
nsPluginInstanceVariable_DoCacheBool = 5,
|
||||
nsPluginInstanceVariable_CallSetWindowAfterDestroyBool = 6
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -2200,6 +2200,15 @@ nsresult nsPluginHostImpl::FindStoppedPluginForURL(nsIURI* aURL,
|
|||
void nsPluginHostImpl::AddInstanceToActiveList(nsIPluginInstance* aInstance,
|
||||
nsIURI* aURL)
|
||||
{
|
||||
|
||||
// first, determine if the plugin wants to be cached
|
||||
PRBool doCache = PR_TRUE;
|
||||
aInstance->GetValue(nsPluginInstanceVariable_DoCacheBool,
|
||||
(void *) &doCache);
|
||||
if (!doCache) {
|
||||
return;
|
||||
}
|
||||
|
||||
char* url;
|
||||
|
||||
if(!aURL)
|
||||
|
|
|
@ -747,11 +747,22 @@ pluginInstanceOwner :: ~pluginInstanceOwner()
|
|||
{
|
||||
if (nsnull != mInstance)
|
||||
{
|
||||
PRBool doCache = PR_TRUE;
|
||||
|
||||
// determine if the plugin wants to be cached
|
||||
mInstance->GetValue(nsPluginInstanceVariable_DoCacheBool,
|
||||
(void *) &doCache);
|
||||
mInstance->Stop();
|
||||
nsCOMPtr<nsIPluginHost> host;
|
||||
host = do_GetService(kCPluginManagerCID);
|
||||
if(host)
|
||||
host->StopPluginInstance(mInstance);
|
||||
if (!doCache) {
|
||||
// if not, destroy the instance
|
||||
mInstance->Destroy();
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIPluginHost> host;
|
||||
host = do_GetService(kCPluginManagerCID);
|
||||
if(host)
|
||||
host->StopPluginInstance(mInstance);
|
||||
}
|
||||
NS_RELEASE(mInstance);
|
||||
}
|
||||
|
||||
|
|
|
@ -2200,6 +2200,15 @@ nsresult nsPluginHostImpl::FindStoppedPluginForURL(nsIURI* aURL,
|
|||
void nsPluginHostImpl::AddInstanceToActiveList(nsIPluginInstance* aInstance,
|
||||
nsIURI* aURL)
|
||||
{
|
||||
|
||||
// first, determine if the plugin wants to be cached
|
||||
PRBool doCache = PR_TRUE;
|
||||
aInstance->GetValue(nsPluginInstanceVariable_DoCacheBool,
|
||||
(void *) &doCache);
|
||||
if (!doCache) {
|
||||
return;
|
||||
}
|
||||
|
||||
char* url;
|
||||
|
||||
if(!aURL)
|
||||
|
|
|
@ -747,11 +747,22 @@ pluginInstanceOwner :: ~pluginInstanceOwner()
|
|||
{
|
||||
if (nsnull != mInstance)
|
||||
{
|
||||
PRBool doCache = PR_TRUE;
|
||||
|
||||
// determine if the plugin wants to be cached
|
||||
mInstance->GetValue(nsPluginInstanceVariable_DoCacheBool,
|
||||
(void *) &doCache);
|
||||
mInstance->Stop();
|
||||
nsCOMPtr<nsIPluginHost> host;
|
||||
host = do_GetService(kCPluginManagerCID);
|
||||
if(host)
|
||||
host->StopPluginInstance(mInstance);
|
||||
if (!doCache) {
|
||||
// if not, destroy the instance
|
||||
mInstance->Destroy();
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIPluginHost> host;
|
||||
host = do_GetService(kCPluginManagerCID);
|
||||
if(host)
|
||||
host->StopPluginInstance(mInstance);
|
||||
}
|
||||
NS_RELEASE(mInstance);
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,9 @@ enum nsPluginInstancePeerVariable {
|
|||
|
||||
enum nsPluginInstanceVariable {
|
||||
nsPluginInstanceVariable_WindowlessBool = 3,
|
||||
nsPluginInstanceVariable_TransparentBool = 4
|
||||
nsPluginInstanceVariable_TransparentBool = 4,
|
||||
nsPluginInstanceVariable_DoCacheBool = 5,
|
||||
nsPluginInstanceVariable_CallSetWindowAfterDestroyBool = 6
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Загрузка…
Ссылка в новой задаче