diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index de5ec631826..26402c0fb23 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -1770,12 +1770,6 @@ pref("plugin.scan.WindowsMediaPlayer", "7.0"); // Which is currently HKLM\Software\MozillaPlugins\xxxPLIDxxx\Path pref("plugin.scan.plid.all", true); -// Controls the scanning of the Navigator 4.x directory for plugins -// When pref is missing, the default is to pickup popular plugins such as -// Flash, Shockwave, Acrobat, and Quicktime. If set to true, ALL plugins -// will be picked up and if set to false the scan will not happen at all -//pref("plugin.scan.4xPluginFolder", false); - // Help Windows NT, 2000, and XP dialup a RAS connection // when a network address is unreachable. pref("network.autodial-helper.enabled", true); diff --git a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp index f7a1a5b31ec..00c76754300 100644 --- a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp +++ b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp @@ -244,44 +244,7 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant, do_CreateInstance("@mozilla.org/windows-registry-key;1"); NS_ENSURE_TRUE(regKey, NS_ERROR_FAILURE); - if (nsCRT::strcmp(charProp, NS_WIN_4DOTX_SCAN_KEY) == 0) { - // Check our prefs to see if scanning the 4.x folder has been - // explictly overriden failure to get the pref is okay, we'll do - // what we've been doing -- a filtered scan - PRBool bScan4x; - if (NS_SUCCEEDED(prefs->GetBoolPref(NS_WIN_4DOTX_SCAN_KEY, &bScan4x)) && - !bScan4x) { - return NS_ERROR_FAILURE; - } - - // Look for the plugin folder that the user has in their - // Communicator 4x install - rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE, - NS_LITERAL_STRING("Software\\Netscape\\Netscape Navigator"), - nsIWindowsRegKey::ACCESS_READ); - if (NS_SUCCEEDED(rv)) { - nsAutoString currentVersion; - rv = regKey->ReadStringValue(NS_LITERAL_STRING("CurrentVersion"), - currentVersion); - if (NS_SUCCEEDED(rv)) { - nsAutoString childName = currentVersion; - childName.Append(NS_LITERAL_STRING("\\Main")); - nsCOMPtr childKey; - - rv = regKey->OpenChild(childName, nsIWindowsRegKey::ACCESS_READ, - getter_AddRefs(childKey)); - if (NS_SUCCEEDED(rv) && childKey) { - nsAutoString pluginsDirectory; - rv = childKey->ReadStringValue(NS_LITERAL_STRING("Plugins Directory"), - pluginsDirectory); - if (NS_SUCCEEDED(rv)) { - rv = NS_NewLocalFile(pluginsDirectory, PR_TRUE, - getter_AddRefs(localFile)); - } - } - } - } - } else if (nsCRT::strcmp(charProp, NS_WIN_JRE_SCAN_KEY) == 0) { + if (nsCRT::strcmp(charProp, NS_WIN_JRE_SCAN_KEY) == 0) { nsXPIDLCString strVer; if (NS_FAILED(prefs->GetCharPref(charProp, getter_Copies(strVer)))) return NS_ERROR_FAILURE; diff --git a/modules/plugin/base/src/nsPluginDirServiceProvider.h b/modules/plugin/base/src/nsPluginDirServiceProvider.h index b1097683db6..29f30e0568e 100644 --- a/modules/plugin/base/src/nsPluginDirServiceProvider.h +++ b/modules/plugin/base/src/nsPluginDirServiceProvider.h @@ -53,7 +53,6 @@ class nsISimpleEnumerator; #define NS_WIN_ACROBAT_SCAN_KEY "plugin.scan.Acrobat" #define NS_WIN_QUICKTIME_SCAN_KEY "plugin.scan.Quicktime" #define NS_WIN_WMP_SCAN_KEY "plugin.scan.WindowsMediaPlayer" -#define NS_WIN_4DOTX_SCAN_KEY "plugin.scan.4xPluginFolder" //***************************************************************************** // class nsPluginDirServiceProvider diff --git a/modules/plugin/base/src/nsPluginHost.cpp b/modules/plugin/base/src/nsPluginHost.cpp index ae101fb138e..4e8eee308a8 100644 --- a/modules/plugin/base/src/nsPluginHost.cpp +++ b/modules/plugin/base/src/nsPluginHost.cpp @@ -2059,33 +2059,6 @@ nsPluginHost::SiteHasData(nsIPluginTag* plugin, const nsACString& domain, return NS_OK; } -// XXX called from ScanPluginsDirectory only when told to filter -// currently 'unwanted' plugins are Java, and all other plugins except -// Acrobat, Flash, Quicktime and Shockwave -static PRBool isUnwantedPlugin(nsPluginTag * tag) -{ - if (tag->mFileName.IsEmpty()) - return PR_TRUE; - - for (PRInt32 i = 0; i < tag->mVariants; ++i) { - if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/pdf")) - return PR_FALSE; - - if (tag->mIsFlashPlugin) - return PR_FALSE; - - if (!PL_strcasecmp(tag->mMimeTypeArray[i], "application/x-director")) - return PR_FALSE; - } - - // On Windows, we also want to include the Quicktime plugin from the 4.x directory - // But because it spans several DLL's, the best check for now is by filename - if (tag->mFileName.Find("npqtplugin", PR_TRUE, 0, -1) != kNotFound) - return PR_FALSE; - - return PR_TRUE; -} - PRBool nsPluginHost::IsJavaMIMEType(const char* aType) { return aType && @@ -2183,11 +2156,9 @@ class nsDefaultComparator typedef NS_NPAPIPLUGIN_CALLBACK(char *, NP_GETMIMEDESCRIPTION)(void); -nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir, - nsIComponentManager * compManager, +nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir, PRBool aCreatePluginList, - PRBool * aPluginsChanged, - PRBool checkForUnwantedPlugins) + PRBool *aPluginsChanged) { NS_ENSURE_ARG_POINTER(aPluginsChanged); nsresult rv; @@ -2278,8 +2249,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir, else { // if it is unwanted plugin we are checking for, get it back to the cache info list // if this is a duplicate plugin, too place it back in the cache info list marking unwantedness - if ((checkForUnwantedPlugins && isUnwantedPlugin(pluginTag)) || - IsDuplicatePlugin(pluginTag)) { + if (IsDuplicatePlugin(pluginTag)) { if (!pluginTag->HasFlag(NS_PLUGIN_FLAG_UNWANTED)) { // Plugin switched from wanted to unwanted *aPluginsChanged = PR_TRUE; @@ -2384,8 +2354,7 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir, // when we sync cached plugins to registry NS_ASSERTION(!pluginTag->HasFlag(NS_PLUGIN_FLAG_UNWANTED), "Brand-new tags should not be unwanted"); - if ((checkForUnwantedPlugins && isUnwantedPlugin(pluginTag)) || - IsDuplicatePlugin(pluginTag)) { + if (IsDuplicatePlugin(pluginTag)) { pluginTag->Mark(NS_PLUGIN_FLAG_UNWANTED); pluginTag->mNext = mCachedPlugins; mCachedPlugins = pluginTag; @@ -2402,20 +2371,12 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir, // set the flag that we want to add this plugin to the list for now // and see if it remains after we check several reasons not to do so PRBool bAddIt = PR_TRUE; - - // check if this is a specific plugin we don't want - if (checkForUnwantedPlugins && isUnwantedPlugin(pluginTag)) + + if (HaveSamePlugin(pluginTag)) { + // we cannot get here if the plugin has just been added + // and thus |pluginTag| is not from cache, because otherwise + // it would not be present in the list; bAddIt = PR_FALSE; - - // check if we already have this plugin in the list which - // is possible if we do refresh - if (bAddIt) { - if (HaveSamePlugin(pluginTag)) { - // we cannot get here if the plugin has just been added - // and thus |pluginTag| is not from cache, because otherwise - // it would not be present in the list; - bAddIt = PR_FALSE; - } } // do it if we still want it @@ -2446,11 +2407,9 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile * pluginsDir, return NS_OK; } -nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator * dirEnum, - nsIComponentManager * compManager, +nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum, PRBool aCreatePluginList, - PRBool * aPluginsChanged, - PRBool checkForUnwantedPlugins) + PRBool *aPluginsChanged) { PRBool hasMore; while (NS_SUCCEEDED(dirEnum->HasMoreElements(&hasMore)) && hasMore) { @@ -2464,7 +2423,7 @@ nsresult nsPluginHost::ScanPluginsDirectoryList(nsISimpleEnumerator * dirEnum, // don't pass aPluginsChanged directly to prevent it from been reset PRBool pluginschanged = PR_FALSE; - ScanPluginsDirectory(nextDir, compManager, aCreatePluginList, &pluginschanged, checkForUnwantedPlugins); + ScanPluginsDirectory(nextDir, aCreatePluginList, &pluginschanged); if (pluginschanged) *aPluginsChanged = PR_TRUE; @@ -2529,9 +2488,6 @@ nsresult nsPluginHost::FindPlugins(PRBool aCreatePluginList, PRBool * aPluginsCh if (ReadPluginInfo() == NS_ERROR_NOT_AVAILABLE) return NS_OK; - nsCOMPtr compManager; - NS_GetComponentManager(getter_AddRefs(compManager)); - #ifdef XP_WIN // Failure here is not a show-stopper so just warn. rv = EnsurePrivateDirServiceProvider(); @@ -2552,7 +2508,7 @@ nsresult nsPluginHost::FindPlugins(PRBool aCreatePluginList, PRBool * aPluginsCh // Scan the app-defined list of plugin dirs. rv = dirService->Get(NS_APP_PLUGINS_DIR_LIST, NS_GET_IID(nsISimpleEnumerator), getter_AddRefs(dirList)); if (NS_SUCCEEDED(rv)) { - ScanPluginsDirectoryList(dirList, compManager, aCreatePluginList, &pluginschanged); + ScanPluginsDirectoryList(dirList, aCreatePluginList, &pluginschanged); if (pluginschanged) *aPluginsChanged = PR_TRUE; @@ -2579,7 +2535,7 @@ nsresult nsPluginHost::FindPlugins(PRBool aCreatePluginList, PRBool * aPluginsCh if (bScanPLIDs && mPrivateDirServiceProvider) { rv = mPrivateDirServiceProvider->GetPLIDDirectories(getter_AddRefs(dirList)); if (NS_SUCCEEDED(rv)) { - ScanPluginsDirectoryList(dirList, compManager, aCreatePluginList, &pluginschanged); + ScanPluginsDirectoryList(dirList, aCreatePluginList, &pluginschanged); if (pluginschanged) *aPluginsChanged = PR_TRUE; @@ -2598,37 +2554,22 @@ nsresult nsPluginHost::FindPlugins(PRBool aCreatePluginList, PRBool * aPluginsCh // Scan the installation paths of our popular plugins if the prefs are enabled // This table controls the order of scanning - const char* const prefs[] = {NS_WIN_JRE_SCAN_KEY, nsnull, - NS_WIN_ACROBAT_SCAN_KEY, nsnull, - NS_WIN_QUICKTIME_SCAN_KEY, nsnull, - NS_WIN_WMP_SCAN_KEY, nsnull, - NS_WIN_4DOTX_SCAN_KEY, "1" /* second column is flag for 4.x folder */ }; + const char* const prefs[] = {NS_WIN_JRE_SCAN_KEY, + NS_WIN_ACROBAT_SCAN_KEY, + NS_WIN_QUICKTIME_SCAN_KEY, + NS_WIN_WMP_SCAN_KEY}; PRUint32 size = sizeof(prefs) / sizeof(prefs[0]); - for (PRUint32 i = 0; i < size; i+=2) { + for (PRUint32 i = 0; i < size; i+=1) { nsCOMPtr dirToScan; PRBool bExists; if (NS_SUCCEEDED(dirService->Get(prefs[i], NS_GET_IID(nsIFile), getter_AddRefs(dirToScan))) && dirToScan && NS_SUCCEEDED(dirToScan->Exists(&bExists)) && bExists) { - - PRBool bFilterUnwanted = PR_FALSE; - - // 4.x plugins folder stuff: - // Normally we "filter" the 4.x folder through |IsUnwantedPlugin| - // Check for a pref to see if we want to scan the entire 4.x plugins folder - if (prefs[i+1]) { - PRBool bScanEverything; - bFilterUnwanted = PR_TRUE; // default to filter 4.x folder - if (mPrefService && - NS_SUCCEEDED(mPrefService->GetBoolPref(prefs[i], &bScanEverything)) && - bScanEverything) - bFilterUnwanted = PR_FALSE; - - } - ScanPluginsDirectory(dirToScan, compManager, aCreatePluginList, &pluginschanged, bFilterUnwanted); + + ScanPluginsDirectory(dirToScan, aCreatePluginList, &pluginschanged); if (pluginschanged) *aPluginsChanged = PR_TRUE; diff --git a/modules/plugin/base/src/nsPluginHost.h b/modules/plugin/base/src/nsPluginHost.h index e9505d860f0..780bd9c65a6 100644 --- a/modules/plugin/base/src/nsPluginHost.h +++ b/modules/plugin/base/src/nsPluginHost.h @@ -236,18 +236,14 @@ private: FindPlugins(PRBool aCreatePluginList, PRBool * aPluginsChanged); nsresult - ScanPluginsDirectory(nsIFile * pluginsDir, - nsIComponentManager * compManager, + ScanPluginsDirectory(nsIFile *pluginsDir, PRBool aCreatePluginList, - PRBool * aPluginsChanged, - PRBool checkForUnwantedPlugins = PR_FALSE); - + PRBool *aPluginsChanged); + nsresult - ScanPluginsDirectoryList(nsISimpleEnumerator * dirEnum, - nsIComponentManager * compManager, + ScanPluginsDirectoryList(nsISimpleEnumerator *dirEnum, PRBool aCreatePluginList, - PRBool * aPluginsChanged, - PRBool checkForUnwantedPlugins = PR_FALSE); + PRBool *aPluginsChanged); nsresult EnsurePluginLoaded(nsPluginTag* plugin);