Merge backout of 7cd22106e8d9

This commit is contained in:
Josh Aas 2009-05-16 21:10:10 -04:00
commit 280391f4ad
7 changed files with 60 additions and 71 deletions

View File

@ -7,7 +7,7 @@ installedplugins_label=Installed plugins
nopluginsareinstalled_label=No plugins are installed
findmore_label=Find more information about browser plugins at
installhelp_label=Help for installing plugins is available from
file_label=File:
filename_label=File name:
version_label=Version:
mimetype_label=MIME Type
description_label=Description

View File

@ -3702,11 +3702,11 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
return NS_ERROR_FAILURE;
}
}
else {
else
mimetype = aMimeType;
}
NS_ASSERTION(pluginTag, "Must have plugin tag here!");
PRBool isJavaPlugin = pluginTag->mIsJavaPlugin;
nsCAutoString contractID(
NS_LITERAL_CSTRING(NS_INLINE_PLUGIN_CONTRACTID_PREFIX) +
@ -3724,7 +3724,7 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
static BOOL firstJavaPlugin = FALSE;
BOOL restoreOrigDir = FALSE;
char origDir[_MAX_PATH];
if (pluginTag->mIsJavaPlugin && !firstJavaPlugin) {
if (isJavaPlugin && !firstJavaPlugin) {
DWORD dw = ::GetCurrentDirectory(_MAX_PATH, origDir);
NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding");
nsCOMPtr<nsIFile> binDirectory;
@ -3995,14 +3995,33 @@ public:
PRBool bShowPath;
nsCOMPtr<nsIPrefBranch> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (prefService &&
NS_SUCCEEDED(prefService->GetBoolPref("plugin.expose_full_path", &bShowPath)) &&
NS_SUCCEEDED(prefService->GetBoolPref("plugin.expose_full_path",&bShowPath)) &&
bShowPath) {
// only show the full path if people have set the pref,
// the default should not reveal path information (bug 88183)
#if defined(XP_MACOSX)
CopyUTF8toUTF16(mPluginTag.mFullPath, aFilename);
} else {
#else
CopyUTF8toUTF16(mPluginTag.mFileName, aFilename);
#endif
return NS_OK;
}
return NS_OK;
nsAutoString spec;
if (!mPluginTag.mFullPath.IsEmpty()) {
#if !defined(XP_MACOSX)
NS_ERROR("Only MAC should be using nsPluginTag::mFullPath!");
#endif
CopyUTF8toUTF16(mPluginTag.mFullPath, spec);
} else {
CopyUTF8toUTF16(mPluginTag.mFileName, spec);
}
nsCString leafName;
nsCOMPtr<nsILocalFile> pluginPath;
NS_NewLocalFile(spec, PR_TRUE, getter_AddRefs(pluginPath));
return pluginPath->GetLeafName(aFilename);
}
NS_METHOD GetVersion(nsAString& aVersion)
@ -4352,10 +4371,14 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi
#endif
if (!pluginTag->mLibrary) { // if we haven't done this yet
nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
#if !defined(XP_MACOSX)
file->InitWithPath(NS_ConvertUTF8toUTF16(pluginTag->mFileName));
#else
if (pluginTag->mFullPath.IsEmpty())
return NS_ERROR_FAILURE;
nsCOMPtr<nsILocalFile> file = do_CreateInstance("@mozilla.org/file/local;1");
file->InitWithPath(NS_ConvertUTF8toUTF16(pluginTag->mFullPath));
#endif
nsPluginFile pluginFile(file);
PRLibrary* pluginLibrary = NULL;

View File

@ -164,16 +164,12 @@ typedef char* (*BeOS_Plugin_GetMIMEDescription)();
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
{
info.fVersion = nsnull;
nsCAutoString fullPath;
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
nsCAutoString fpath;
nsresult rv = mPlugin->GetNativePath(fpath);
if (NS_OK != rv) {
return rv;
nsCAutoString fileName;
if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
return rv;
const char *path = fullPath.get();
}
const char *path = fpath.get();
int i;
#ifdef NS_PLUGIN_BEOS_DEBUG
@ -247,8 +243,8 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
}
info.fVariantCount = types_num;
info.fFullPath = PL_strdup(fullPath.get());
info.fFileName = PL_strdup(fileName.get());
info.fFileName = PL_strdup(path);
#ifdef NS_PLUGIN_BEOS_DEBUG
printf("info.fFileName = %s\n", info.fFileName);
@ -282,9 +278,6 @@ nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
PR_FREEIF(info.fMimeDescriptionArray);
PR_FREEIF(info.fExtensionArray);
if (info.fFullPath)
PL_strfree(info.fFullPath);
if (info.fFileName)
PL_strfree(info.fFileName);

View File

@ -219,15 +219,11 @@ nsresult nsPluginFile::GetPluginInfo( nsPluginInfo &info)
char failure[ CCHMAXPATH] = "";
APIRET ret;
nsCAutoString path;
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
return rv;
nsCAutoString fileName;
if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
return rv;
ret = DosLoadModule( failure, CCHMAXPATH, path.get(), &hPlug);
const char* path;
nsCAutoString temp;
mPlugin->GetNativePath(temp);
path = temp.get();
ret = DosLoadModule( failure, CCHMAXPATH, path, &hPlug);
info.fVersion = nsnull;
while( ret == NO_ERROR)
@ -259,8 +255,7 @@ nsresult nsPluginFile::GetPluginInfo( nsPluginInfo &info)
info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
if( nsnull == info.fExtensionArray) break;
info.fFullPath = PL_strdup(path.get());
info.fFileName = PL_strdup(fileName.get());
info.fFileName = PL_strdup(path);
rc = NS_OK;
break;
@ -276,10 +271,7 @@ nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
{
if(info.fName != nsnull)
PL_strfree(info.fName);
if(info.fFullPath != nsnull)
PL_strfree(info.fFullPath);
if(info.fFileName != nsnull)
PL_strfree(info.fFileName);

View File

@ -434,7 +434,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
{
nsresult rv;
const char *mimedescr = NULL, *name = NULL, *description = NULL;
const char* mimedescr = 0, *name = 0, *description = 0;
// No, this doesn't leak. GetGlobalServiceManager() doesn't addref
// it's out pointer. Maybe it should.
@ -488,20 +488,13 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
#endif
if (NS_FAILED(rv = ParsePluginMimeDescription(mimedescr, info)))
return rv;
nsCAutoString path;
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
nsCAutoString filename;
if (NS_FAILED(rv = mPlugin->GetNativePath(filename)))
return rv;
info.fFullPath = PL_strdup(path.get());
nsCAutoString fileName;
if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
return rv;
info.fFileName = PL_strdup(fileName.get());
info.fFileName = PL_strdup(filename.get());
plugin->GetValue(nsPluginVariable_NameString, &name);
if (!name)
name = "";
name = PL_strrchr(info.fFileName, '/') + 1;
info.fName = PL_strdup(name);
plugin->GetValue(nsPluginVariable_DescriptionString, &description);
@ -536,9 +529,6 @@ nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
PR_FREEIF(info.fMimeDescriptionArray);
PR_FREEIF(info.fExtensionArray);
if (info.fFullPath != nsnull)
PL_strfree(info.fFullPath);
if (info.fFileName != nsnull)
PL_strfree(info.fFileName);

View File

@ -259,7 +259,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
*/
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
{
nsresult rv = NS_OK;
nsresult res = NS_OK;
DWORD zerome, versionsize;
TCHAR* verbuf = nsnull;
@ -268,20 +268,15 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
if (!mPlugin)
return NS_ERROR_NULL_POINTER;
nsCAutoString fullPath;
if (NS_FAILED(rv = mPlugin->GetNativePath(fullPath)))
return rv;
nsCAutoString fileName;
if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
return rv;
nsCAutoString temp;
mPlugin->GetNativePath(temp);
#ifdef UNICODE
NS_ConvertASCIItoUTF16 utf16Path(fullPath);
path = utf16Path.get();
NS_ConvertASCIItoUTF16 temp2(temp);
path = temp2.get();
versionsize = ::GetFileVersionInfoSizeW((TCHAR*)path, &zerome);
#else
path = fullPath.get();
path = temp.get();
versionsize = ::GetFileVersionInfoSize((TCHAR*)path, &zerome);
#endif
@ -307,8 +302,7 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
info.fFullPath = PL_strdup(fullPath.get());
info.fFileName = PL_strdup(fileName.get());
info.fFileName = PL_strdup(temp.get());
info.fVersion = GetVersion(verbuf);
PL_strfree(mimeType);
@ -316,12 +310,12 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
PL_strfree(extensions);
}
else {
rv = NS_ERROR_FAILURE;
res = NS_ERROR_FAILURE;
}
PR_Free(verbuf);
return rv;
return res;
}
nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
@ -341,9 +335,6 @@ nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
if (info.fExtensionArray)
FreeStringArray(info.fVariantCount, info.fExtensionArray);
if (info.fFullPath)
PL_strfree(info.fFullPath);
if (info.fFileName)
PL_strfree(info.fFileName);

View File

@ -116,7 +116,7 @@
document.write(plugin.name);
document.writeln("<\/h2>");
document.writeln("<dl><dd><span class=\"label\">" + pluginsbundle.GetStringFromName("file_label") + "<\/span> ");
document.writeln("<dl><dd><span class=\"label\">" + pluginsbundle.GetStringFromName("filename_label") + "<\/span> ");
document.write(plugin.filename);
document.writeln("<\/dd><dd><span class=\"label\">" + pluginsbundle.GetStringFromName("version_label") + "<\/span> ");
document.write(plugin.version);