Bug 633463: Never scan old XPCOM/OJI Java plugin directory. r=jmathies a=blocking2.0betaN+
--- a/modules/plugin/base/src/nsPluginDirServiceProvider.cpp
+++ b/modules/plugin/base/src/nsPluginDirServiceProvider.cpp
@@ -302,17 +302,16 @@ nsPluginDirServiceProvider::GetFile(cons
verBlock maxVer;
ClearVersion(&maxVer);
WCHAR curKey[_MAX_PATH] = L"Software\\JavaSoft\\Java Runtime Environment";
WCHAR path[_MAX_PATH];
// Add + 15 to prevent buffer overrun when adding \bin (+ optionally
// \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;
LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
&baseloc);
if (ERROR_SUCCESS != result)
return NS_ERROR_FAILURE;
@@ -366,58 +365,41 @@ nsPluginDirServiceProvider::GetFile(cons
}
::RegCloseKey(keyloc);
}
}
} while (ERROR_SUCCESS == result);
::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;
if (NS_FAILED(prefs->GetCharPref(charProp, getter_Copies(strVer))))
return NS_ERROR_FAILURE;
verBlock minVer;
TranslateVersionStr(NS_ConvertASCIItoUTF16(strVer).get(), &minVer);