diff --git a/mozilla/modules/libpref/src/init/all.js b/mozilla/modules/libpref/src/init/all.js index bfc9c81bb88..b96aa7c2ddb 100644 --- a/mozilla/modules/libpref/src/init/all.js +++ b/mozilla/modules/libpref/src/init/all.js @@ -736,6 +736,7 @@ pref("browser.downloadmanager.behavior", 0); // if true, allow plug-ins to override internal imglib decoder mime types in full-page mode pref("plugin.override_internal_types", false); +pref("plugin.expose_full_path", false); // if true navigator.plugins reveals full path // See bug 136985. Gives embedders a pref to hook into to show // a popup blocker if they choose. diff --git a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp index 624cf675420..296772d5b18 100644 --- a/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp +++ b/mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp @@ -4338,11 +4338,39 @@ public: NS_METHOD GetFilename(nsAString& aFilename) { + PRBool bShowPath; + nsCOMPtr prefService = do_GetService(NS_PREF_CONTRACTID); + if (prefService && + 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) #ifdef XP_MAC - return DoCharsetConversion(mUnicodeDecoder, mPluginTag.mFullPath, aFilename); -#else - return DoCharsetConversion(mUnicodeDecoder, mPluginTag.mFileName, aFilename); + return DoCharsetConversion(mUnicodeDecoder, mPluginTag.mFullPath, aFilename); +#else + return DoCharsetConversion(mUnicodeDecoder, mPluginTag.mFileName, aFilename); #endif + } + + nsFileSpec spec; + if (mPluginTag.mFullPath) + { +#ifndef XP_MAC + NS_ERROR("Only MAC should be using nsPluginTag::mFullPath!"); +#endif + spec = mPluginTag.mFullPath; + } + else + { + spec = mPluginTag.mFileName; + } + + char* name = spec.GetLeafName(); + nsresult rv = DoCharsetConversion(mUnicodeDecoder, name, aFilename); + if (name) + nsCRT::free(name); + return rv; } NS_METHOD GetName(nsAString& aName)