2011-06-01 08:05:09 +02:00
|
|
|
From: Ubuntu
|
|
|
|
Subject: introduce a pref to prefer certain plugins for mime-types
|
|
|
|
|
2011-07-23 16:46:28 +02:00
|
|
|
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
|
2012-07-16 10:13:51 +02:00
|
|
|
@@ -1561,17 +1561,45 @@ nsPluginHost::FindPluginForType(const ch
|
2012-02-01 14:37:15 +01:00
|
|
|
bool aCheckEnabled)
|
2011-07-23 16:46:28 +02:00
|
|
|
{
|
|
|
|
if (!aMimeType) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
2011-06-01 08:05:09 +02:00
|
|
|
|
|
|
|
LoadPlugins();
|
|
|
|
|
2011-07-23 16:46:28 +02:00
|
|
|
+ char *preferredPluginPath = NULL;
|
|
|
|
+ nsCAutoString mimetypePrefString ("modules.plugins.mimetype.");
|
|
|
|
+ mimetypePrefString.Append(aMimeType);
|
|
|
|
+ const char *mimetypePrefChar = mimetypePrefString.get();
|
2012-07-16 10:13:51 +02:00
|
|
|
+ nsAdoptingCString pluginPath = Preferences::GetCString(mimetypePrefChar);
|
|
|
|
+ preferredPluginPath = (char*) pluginPath.get();
|
2011-06-01 08:05:09 +02:00
|
|
|
+
|
2011-07-23 16:46:28 +02:00
|
|
|
nsPluginTag *plugin = mPlugins;
|
2012-07-16 10:13:51 +02:00
|
|
|
+
|
2011-07-23 16:46:28 +02:00
|
|
|
+ if(preferredPluginPath) {
|
|
|
|
+ while (nsnull != plugin) {
|
|
|
|
+ if (0 == PL_strcasecmp(plugin->mFileName.get(), preferredPluginPath) ||
|
|
|
|
+ 0 == PL_strcasecmp(plugin->mFullPath.get(), preferredPluginPath)) {
|
|
|
|
+ return plugin;
|
2011-06-01 08:05:09 +02:00
|
|
|
+ }
|
2011-07-23 16:46:28 +02:00
|
|
|
+ plugin = plugin->mNext;
|
|
|
|
+ }
|
2011-06-01 08:05:09 +02:00
|
|
|
+
|
2011-07-23 16:46:28 +02:00
|
|
|
+ // 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;
|
2011-06-01 08:05:09 +02:00
|
|
|
+ }
|
2011-07-23 16:46:28 +02:00
|
|
|
+ plugin = plugin->mNext;
|
2011-06-01 08:05:09 +02:00
|
|
|
+ }
|
2011-07-23 16:46:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|