зеркало из https://github.com/mozilla/gecko-dev.git
Fixing 124936 -- refresh loop with dup plugins, r=peterl, sr=beard
This commit is contained in:
Родитель
67b2ee6518
Коммит
8e83ca22c3
|
@ -1046,7 +1046,6 @@ PRBool nsPluginTag::Equals(nsPluginTag *aPluginTag)
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
class nsPluginStreamListenerPeer;
|
class nsPluginStreamListenerPeer;
|
||||||
|
|
||||||
|
@ -4452,6 +4451,37 @@ static PRBool isUnwantedPlugin(nsPluginTag * tag)
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsPluginTag * nsPluginHostImpl::HaveSamePlugin(nsPluginTag * aPluginTag)
|
||||||
|
{
|
||||||
|
for(nsPluginTag* tag = mPlugins; tag; tag = tag->mNext) {
|
||||||
|
if(tag->Equals(aPluginTag))
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
|
PRBool nsPluginHostImpl::IsDuplicatePlugin(nsPluginTag * aPluginTag)
|
||||||
|
{
|
||||||
|
nsPluginTag * tag = HaveSamePlugin(aPluginTag);
|
||||||
|
if (tag) {
|
||||||
|
// if we got the same plugin, check the full path to see if this is a dup;
|
||||||
|
|
||||||
|
// mFileName contains full path on Windows and Unix and leaf name on Mac
|
||||||
|
// if those are not equal, we have the same plugin with different path,
|
||||||
|
// i.e. duplicate, return true
|
||||||
|
if (PL_strcmp(tag->mFileName, aPluginTag->mFileName))
|
||||||
|
return PR_TRUE;
|
||||||
|
|
||||||
|
// if they are equal, compare mFullPath fields just in case
|
||||||
|
// mFileName contained leaf name only, and if not equal, return true
|
||||||
|
if (tag->mFullPath && aPluginTag->mFullPath && PL_strcmp(tag->mFullPath, aPluginTag->mFullPath))
|
||||||
|
return PR_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we do not have it at all, return false
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
// Structure for collecting plugin files found during directory scanning
|
// Structure for collecting plugin files found during directory scanning
|
||||||
struct pluginFileinDirectory
|
struct pluginFileinDirectory
|
||||||
{
|
{
|
||||||
|
@ -4568,7 +4598,8 @@ nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// if it is unwanted plugin we are checking for, get it back to the cache info list
|
// if it is unwanted plugin we are checking for, get it back to the cache info list
|
||||||
if(checkForUnwantedPlugins && isUnwantedPlugin(pluginTag)) {
|
// if this is a duplicate plugin, too place it back in the cache info list marking unwantedness
|
||||||
|
if((checkForUnwantedPlugins && isUnwantedPlugin(pluginTag)) || IsDuplicatePlugin(pluginTag)) {
|
||||||
pluginTag->Mark(NS_PLUGIN_FLAG_UNWANTED);
|
pluginTag->Mark(NS_PLUGIN_FLAG_UNWANTED);
|
||||||
pluginTag->mNext = mCachedPlugins;
|
pluginTag->mNext = mCachedPlugins;
|
||||||
mCachedPlugins = pluginTag;
|
mCachedPlugins = pluginTag;
|
||||||
|
@ -4621,9 +4652,10 @@ nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir,
|
||||||
pluginTag->mLibrary = pluginLibrary;
|
pluginTag->mLibrary = pluginLibrary;
|
||||||
pluginTag->mLastModifiedTime = fileModTime;
|
pluginTag->mLastModifiedTime = fileModTime;
|
||||||
|
|
||||||
// if this is unwanted plugin we are checkin for, add it to our cache info list so we
|
// if this is unwanted plugin we are checkin for, or this is a duplicate plugin,
|
||||||
// can cache the unwantedness of this plugin when we sync cached plugins to registry
|
// add it to our cache info list so we can cache the unwantedness of this plugin
|
||||||
if(checkForUnwantedPlugins && isUnwantedPlugin(pluginTag)) {
|
// when we sync cached plugins to registry
|
||||||
|
if((checkForUnwantedPlugins && isUnwantedPlugin(pluginTag)) || IsDuplicatePlugin(pluginTag)) {
|
||||||
pluginTag->Mark(NS_PLUGIN_FLAG_UNWANTED);
|
pluginTag->Mark(NS_PLUGIN_FLAG_UNWANTED);
|
||||||
pluginTag->mNext = mCachedPlugins;
|
pluginTag->mNext = mCachedPlugins;
|
||||||
mCachedPlugins = pluginTag;
|
mCachedPlugins = pluginTag;
|
||||||
|
@ -4641,15 +4673,12 @@ nsresult nsPluginHostImpl::ScanPluginsDirectory(nsIFile * pluginsDir,
|
||||||
// check if we already have this plugin in the list which
|
// check if we already have this plugin in the list which
|
||||||
// is possible if we do refresh
|
// is possible if we do refresh
|
||||||
if(bAddIt) {
|
if(bAddIt) {
|
||||||
for(nsPluginTag* tag = mPlugins; tag != nsnull; tag = tag->mNext) {
|
if (HaveSamePlugin(pluginTag)) {
|
||||||
if(tag->Equals(pluginTag)) {
|
// we cannot get here if the plugin has just been added
|
||||||
bAddIt = PR_FALSE;
|
// and thus |pluginTag| is not from cache, because otherwise
|
||||||
// we cannot get here if the plugin has just been added
|
// it would not be present in the list;
|
||||||
// and thus |pluginTag| is not from cache, because otherwise
|
// so there is no need to delete |pluginTag| -- it _is_ from the cache info list.
|
||||||
// it would not be present in the list;
|
bAddIt = PR_FALSE;
|
||||||
// so there is no need to delete |pluginTag| -- it _is_ from the cache info list.
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5221,19 +5250,13 @@ nsPluginHostImpl::LoadXPCOMPlugins(nsIComponentManager* aComponentManager, nsIFi
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// skip it if we already have it
|
|
||||||
PRBool bAddIt = PR_TRUE;
|
PRBool bAddIt = PR_TRUE;
|
||||||
for(nsPluginTag* existingtag = mPlugins; existingtag != nsnull; existingtag = existingtag->mNext)
|
|
||||||
{
|
|
||||||
if(tag->Equals(existingtag))
|
|
||||||
{
|
|
||||||
bAddIt = PR_FALSE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!bAddIt)
|
// skip it if we already have it
|
||||||
{
|
if (HaveSamePlugin(tag))
|
||||||
|
bAddIt = PR_FALSE;
|
||||||
|
|
||||||
|
if(!bAddIt) {
|
||||||
if(tag)
|
if(tag)
|
||||||
delete tag;
|
delete tag;
|
||||||
continue;
|
continue;
|
||||||
|
@ -5330,7 +5353,7 @@ nsPluginHostImpl::CachePluginsInfo(nsIRegistry* registry)
|
||||||
if (! registry)
|
if (! registry)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// We dont want any old plugins that dont exist anymore hanging around
|
// We don't want any old plugins that don't exist anymore hanging around
|
||||||
// So remove and re-add the root of the plugins info
|
// So remove and re-add the root of the plugins info
|
||||||
nsresult rv = registry->RemoveSubtree(nsIRegistry::Common, kPluginsRootKey);
|
nsresult rv = registry->RemoveSubtree(nsIRegistry::Common, kPluginsRootKey);
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ public:
|
||||||
void TryUnloadPlugin(PRBool aForceShutdown = PR_FALSE);
|
void TryUnloadPlugin(PRBool aForceShutdown = PR_FALSE);
|
||||||
void Mark(PRUint32 mask) { mFlags |= mask; }
|
void Mark(PRUint32 mask) { mFlags |= mask; }
|
||||||
PRBool Equals(nsPluginTag* aPluginTag);
|
PRBool Equals(nsPluginTag* aPluginTag);
|
||||||
|
|
||||||
|
|
||||||
nsPluginTag *mNext;
|
nsPluginTag *mNext;
|
||||||
char *mName;
|
char *mName;
|
||||||
|
@ -171,7 +170,7 @@ public:
|
||||||
#define NS_PLUGIN_FLAG_ENABLED 0x0001 //is this plugin enabled?
|
#define NS_PLUGIN_FLAG_ENABLED 0x0001 //is this plugin enabled?
|
||||||
#define NS_PLUGIN_FLAG_OLDSCHOOL 0x0002 //is this a pre-xpcom plugin?
|
#define NS_PLUGIN_FLAG_OLDSCHOOL 0x0002 //is this a pre-xpcom plugin?
|
||||||
#define NS_PLUGIN_FLAG_FROMCACHE 0x0004 // this plugintag info was loaded from cache
|
#define NS_PLUGIN_FLAG_FROMCACHE 0x0004 // this plugintag info was loaded from cache
|
||||||
#define NS_PLUGIN_FLAG_UNWANTED 0x0008 // this is an unwanted plugins
|
#define NS_PLUGIN_FLAG_UNWANTED 0x0008 // this is an unwanted plugin
|
||||||
|
|
||||||
class nsPluginHostImpl : public nsIPluginManager2,
|
class nsPluginHostImpl : public nsIPluginManager2,
|
||||||
public nsIPluginHost,
|
public nsIPluginHost,
|
||||||
|
@ -447,12 +446,22 @@ private:
|
||||||
|
|
||||||
// Loads all cached plugins info into mCachedPlugins
|
// Loads all cached plugins info into mCachedPlugins
|
||||||
nsresult LoadCachedPluginsInfo(nsIRegistry* registry);
|
nsresult LoadCachedPluginsInfo(nsIRegistry* registry);
|
||||||
|
|
||||||
// Stores all plugins info into the registry
|
// Stores all plugins info into the registry
|
||||||
nsresult CachePluginsInfo(nsIRegistry* registry);
|
nsresult CachePluginsInfo(nsIRegistry* registry);
|
||||||
// Given a filename, returns the plugins info from our cache and removes
|
|
||||||
// it from the cache.
|
// Given a filename, returns the plugins info from our cache
|
||||||
|
// and removes it from the cache.
|
||||||
nsPluginTag* RemoveCachedPluginsInfo(const char *filename);
|
nsPluginTag* RemoveCachedPluginsInfo(const char *filename);
|
||||||
|
|
||||||
|
//checks if the list already have the same plugin as given
|
||||||
|
nsPluginTag* HaveSamePlugin(nsPluginTag * aPluginTag);
|
||||||
|
|
||||||
|
// checks if given plugin is a duplicate of what we already have
|
||||||
|
// in the plugin list but found in some different place
|
||||||
|
PRBool IsDuplicatePlugin(nsPluginTag * aPluginTag);
|
||||||
|
|
||||||
|
// destroys plugin info list
|
||||||
void ClearCachedPluginInfoList();
|
void ClearCachedPluginInfoList();
|
||||||
|
|
||||||
nsresult EnsurePrivateDirServiceProvider();
|
nsresult EnsurePrivateDirServiceProvider();
|
||||||
|
|
Загрузка…
Ссылка в новой задаче