1
0
MozillaFirefox/mozilla-prefer_plugin_pref.patch
Wolfgang Rosenauer ec5d636a3c - update to 14.0.1 (bnc#)
- license change from tri license to MPL-2.0
- fix crashreporter restart option (bmo#762780)
- reenabled mozilla-yarr-pcre.patch to fix build for PPC
- require NSS 3.13.5
- remove mozjs pacrunner obsoletes again for now
- adopted mozilla-prefer_plugin_pref.patch

OBS-URL: https://build.opensuse.org/package/show/mozilla:Factory/MozillaFirefox?expand=0&rev=284
2012-07-16 08:13:51 +00:00

53 lines
1.7 KiB
Diff

From: Ubuntu
Subject: introduce a pref to prefer certain plugins for mime-types
diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -1561,17 +1561,45 @@ nsPluginHost::FindPluginForType(const ch
bool aCheckEnabled)
{
if (!aMimeType) {
return nsnull;
}
LoadPlugins();
+ char *preferredPluginPath = NULL;
+ nsCAutoString mimetypePrefString ("modules.plugins.mimetype.");
+ mimetypePrefString.Append(aMimeType);
+ const char *mimetypePrefChar = mimetypePrefString.get();
+ nsAdoptingCString pluginPath = Preferences::GetCString(mimetypePrefChar);
+ preferredPluginPath = (char*) pluginPath.get();
+
nsPluginTag *plugin = mPlugins;
+
+ if(preferredPluginPath) {
+ while (nsnull != plugin) {
+ if (0 == PL_strcasecmp(plugin->mFileName.get(), preferredPluginPath) ||
+ 0 == PL_strcasecmp(plugin->mFullPath.get(), preferredPluginPath)) {
+ return plugin;
+ }
+ plugin = plugin->mNext;
+ }
+
+ // now lets search for substrings
+ plugin = mPlugins;
+ while (nsnull != plugin) {
+ if (nsnull != PL_strstr(plugin->mFileName.get(), preferredPluginPath) ||
+ nsnull != PL_strstr(plugin->mFullPath.get(), preferredPluginPath)) {
+ return plugin;
+ }
+ plugin = plugin->mNext;
+ }
+ }
+
while (plugin) {
if (!aCheckEnabled || plugin->IsEnabled()) {
PRInt32 mimeCount = plugin->mMimeTypes.Length();
for (PRInt32 i = 0; i < mimeCount; i++) {
if (0 == PL_strcasecmp(plugin->mMimeTypes[i].get(), aMimeType)) {
return plugin;
}
}