Bug 633463: Never scan old XPCOM/OJI Java plugin directory. r=jmathies a=blocking2.0betaN+

This commit is contained in:
Josh Aas 2011-02-17 03:45:20 -05:00
Родитель e264259cb5
Коммит c5ad43da48
1 изменённых файлов: 13 добавлений и 31 удалений

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

@ -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<nsILocalFile> 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;