Bug 583566 - Remove old Java plugin scanning pref and related code. r=bsmedberg

This commit is contained in:
Cykesiopka 2013-02-17 07:07:50 -05:00
parent 01d19ad5af
commit 651fa5b168
4 changed files with 2 additions and 100 deletions

View File

@ -200,100 +200,7 @@ nsPluginDirServiceProvider::GetFile(const char *charProp, bool *persistant,
do_CreateInstance("@mozilla.org/windows-registry-key;1");
NS_ENSURE_TRUE(regKey, NS_ERROR_FAILURE);
if (nsCRT::strcmp(charProp, NS_WIN_JRE_SCAN_KEY) == 0) {
nsAdoptingCString strVer = Preferences::GetCString(charProp);
if (!strVer) {
return NS_ERROR_FAILURE;
}
verBlock minVer;
TranslateVersionStr(NS_ConvertASCIItoUTF16(strVer).get(), &minVer);
rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE,
NS_LITERAL_STRING("Software\\JavaSoft\\Java Runtime Environment"),
nsIWindowsRegKey::ACCESS_READ);
NS_ENSURE_SUCCESS(rv, rv);
verBlock maxVer;
ClearVersion(&maxVer);
nsAutoString newestPath;
nsAutoString browserJavaVersion;
regKey->ReadStringValue(NS_LITERAL_STRING("BrowserJavaVersion"),
browserJavaVersion);
uint32_t childCount = 0;
regKey->GetChildCount(&childCount);
// We must enumerate through the keys because what if there is
// more than one version?
for (uint32_t index = 0; index < childCount; ++index) {
nsAutoString childName;
rv = regKey->GetChildName(index, childName);
if (NS_SUCCEEDED(rv)) {
// Skip major.minor as it always points to latest in its family
uint32_t numChars = 0;
int32_t offset = 0;
while ((offset = childName.FindChar(L'.', offset + 1)) >= 0) {
++numChars;
}
if (numChars < 2)
continue;
nsCOMPtr<nsIWindowsRegKey> childKey;
rv = regKey->OpenChild(childName, nsIWindowsRegKey::ACCESS_QUERY_VALUE,
getter_AddRefs(childKey));
if (NS_SUCCEEDED(rv) && childKey) {
nsAutoString path;
rv = childKey->ReadStringValue(NS_LITERAL_STRING("JavaHome"), path);
if (NS_SUCCEEDED(rv)) {
verBlock curVer;
TranslateVersionStr(childName.get(), &curVer);
if (CompareVersion(curVer, minVer) >= 0) {
if (browserJavaVersion == childName) {
newestPath = path;
break;
}
if (CompareVersion(curVer, maxVer) >= 0) {
newestPath = path;
CopyVersion(&maxVer, &curVer);
}
}
}
}
}
}
if (newestPath.IsEmpty()) {
return NS_ERROR_FAILURE;
}
// We require the newer NPAPI Java plugin.
newestPath += NS_LITERAL_STRING("\\bin\\new_plugin");
rv = NS_NewLocalFile(newestPath,
true, getter_AddRefs(localFile));
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIWindowsRegKey> newKey =
do_CreateInstance("@mozilla.org/windows-registry-key;1");
NS_ENSURE_TRUE(newKey, NS_ERROR_FAILURE);
rv = newKey->Create(nsIWindowsRegKey::ROOT_KEY_LOCAL_MACHINE,
NS_LITERAL_STRING("Software\\mozilla.org\\Mozilla"),
nsIWindowsRegKey::ACCESS_QUERY_VALUE |
nsIWindowsRegKey::ACCESS_SET_VALUE);
if (NS_SUCCEEDED(rv)) {
bool currentVersionExists = false;
newKey->HasValue(NS_LITERAL_STRING("CurrentVersion"),
&currentVersionExists);
if (!currentVersionExists) {
newKey->WriteStringValue(NS_LITERAL_STRING("CurrentVersion"),
NS_LITERAL_STRING(MOZILLA_VERSION));
}
}
}
} else if (nsCRT::strcmp(charProp, NS_WIN_QUICKTIME_SCAN_KEY) == 0) {
if (nsCRT::strcmp(charProp, NS_WIN_QUICKTIME_SCAN_KEY) == 0) {
nsAdoptingCString strVer = Preferences::GetCString(charProp);
if (!strVer) {
return NS_ERROR_FAILURE;

View File

@ -16,7 +16,6 @@ class nsISimpleEnumerator;
// Note: Our directory service provider scan keys are prefs which are check
// for minimum versions compatibility
#define NS_WIN_JRE_SCAN_KEY "plugin.scan.SunJRE"
#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"

View File

@ -2281,8 +2281,7 @@ nsresult nsPluginHost::FindPlugins(bool aCreatePluginList, bool * aPluginsChange
// 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,
NS_WIN_ACROBAT_SCAN_KEY,
const char* const prefs[] = {NS_WIN_ACROBAT_SCAN_KEY,
NS_WIN_QUICKTIME_SCAN_KEY,
NS_WIN_WMP_SCAN_KEY};

View File

@ -2397,9 +2397,6 @@ pref("print.print_extra_margin", 90); // twips (90 twips is an eigth of an inch)
// Whether to extend the native dialog with information on printing frames.
pref("print.extend_native_print_dialog", true);
// Locate Java by scanning the Sun JRE installation directory with a minimum version
pref("plugin.scan.SunJRE", "1.6");
// Locate plugins by scanning the Adobe Acrobat installation directory with a minimum version
pref("plugin.scan.Acrobat", "5.0");