From 846800e2e14fbd379c20be83c2ab6311da242c9f Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Thu, 17 Feb 2011 03:45:20 -0500 Subject: [PATCH] Bug 633463: Never scan old XPCOM/OJI Java plugin directory. r=jmathies a=blocking2.0betaN+ --- .../base/src/nsPluginDirServiceProvider.cpp | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp index ceec159ecb07..19ea47f42a51 100644 --- a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp +++ b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp @@ -307,7 +307,6 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant, // \new_plugin) #define JAVA_PATH_SIZE _MAX_PATH + 15 WCHAR newestPath[JAVA_PATH_SIZE]; - const WCHAR mozPath[_MAX_PATH] = L"Software\\mozilla.org\\Mozilla"; WCHAR browserJavaVersion[_MAX_PATH]; newestPath[0] = 0; @@ -371,48 +370,31 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, PRBool *persistant, ::RegCloseKey(baseloc); - static const WCHAR kMozillaVersion[] = NS_L(MOZILLA_VERSION); + if (newestPath[0] == 0) { + return NS_ERROR_FAILURE; + } - // If nothing is found, then don't add \bin dir and don't set - // CurrentVersion for Mozilla - if (newestPath[0] != 0) { + // We require the newer NPAPI Java plugin. + wcscat(newestPath, L"\\bin\\new_plugin"); + + rv = NS_NewLocalFile(nsDependentString(newestPath), + PR_TRUE, getter_AddRefs(localFile)); + + if (NS_SUCCEEDED(rv)) { + const WCHAR mozPath[_MAX_PATH] = L"Software\\mozilla.org\\Mozilla"; if (ERROR_SUCCESS == ::RegCreateKeyExW(HKEY_LOCAL_MACHINE, mozPath, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE|KEY_QUERY_VALUE, NULL, &entryloc, NULL)) { if (ERROR_SUCCESS != ::RegQueryValueExW(entryloc, L"CurrentVersion", 0, - NULL, NULL, NULL)) { + NULL, NULL, NULL)) { + static const WCHAR kMozillaVersion[] = NS_L(MOZILLA_VERSION); ::RegSetValueExW(entryloc, L"CurrentVersion", 0, REG_SZ, (const BYTE*) kMozillaVersion, NS_ARRAY_LENGTH(kMozillaVersion)); } ::RegCloseKey(entryloc); } - - wcscat(newestPath, L"\\bin"); - - // See whether the "new_plugin" directory exists - WCHAR tmpPath[JAVA_PATH_SIZE]; - nsCOMPtr tmpFile; - - wcscpy(tmpPath, newestPath); - wcscat(tmpPath, L"\\new_plugin"); - rv = NS_NewLocalFile(nsDependentString(tmpPath), - PR_TRUE, getter_AddRefs(tmpFile)); - if (NS_SUCCEEDED(rv) && tmpFile) { - PRBool exists = PR_FALSE; - PRBool isDir = PR_FALSE; - if (NS_SUCCEEDED(tmpFile->Exists(&exists)) && exists && - NS_SUCCEEDED(tmpFile->IsDirectory(&isDir)) && isDir) { - // Assume we're supposed to use this as the search - // directory for the Java Plug-In instead of the normal - // one - wcscpy(newestPath, tmpPath); - } - } - - rv = NS_NewLocalFile(nsDependentString(newestPath), - PR_TRUE, getter_AddRefs(localFile)); } } else if (nsCRT::strcmp(charProp, NS_WIN_QUICKTIME_SCAN_KEY) == 0) { nsXPIDLCString strVer;