mozilla-prefer_plugin_pref.patch
changeset 541 830e50bbfc79
parent 505 edb0bc96e43b
child 568 2c74c5927ea2
--- a/mozilla-prefer_plugin_pref.patch	Tue Sep 11 19:27:36 2012 +0200
+++ b/mozilla-prefer_plugin_pref.patch	Thu Sep 13 21:36:45 2012 +0200
@@ -4,15 +4,15 @@
 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)
- {
+@@ -1588,17 +1588,51 @@ nsPluginHost::FindPluginForType(const ch
    if (!aMimeType) {
-     return nsnull;
+     return nullptr;
    }
  
    LoadPlugins();
  
+   InfallibleTArray<nsPluginTag*> matchingPlugins;
+ 
 +  char *preferredPluginPath = NULL;
 +  nsCAutoString mimetypePrefString ("modules.plugins.mimetype.");
 +  mimetypePrefString.Append(aMimeType);
@@ -23,30 +23,36 @@
    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;
++    while (plugin) {
++      if (!aCheckEnabled || plugin->IsEnabled()) {
++        if (0 == PL_strcasecmp(plugin->mFileName.get(), preferredPluginPath) ||
++            0 == PL_strcasecmp(plugin->mFullPath.get(), preferredPluginPath)) {
++          matchingPlugins.AppendElement(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;
++    while (plugin) {
++      if (!aCheckEnabled || plugin->IsEnabled()) {
++        if (nullptr != PL_strstr(plugin->mFileName.get(), preferredPluginPath) ||
++            nullptr != PL_strstr(plugin->mFullPath.get(), preferredPluginPath)) {
++          matchingPlugins.AppendElement(plugin);
++        }
 +      }
 +      plugin = plugin->mNext;
 +    }
++
++    return FindPreferredPlugin(matchingPlugins);
 +  }
 +
    while (plugin) {
      if (!aCheckEnabled || plugin->IsEnabled()) {
-       PRInt32 mimeCount = plugin->mMimeTypes.Length();
-       for (PRInt32 i = 0; i < mimeCount; i++) {
+       int32_t mimeCount = plugin->mMimeTypes.Length();
+       for (int32_t i = 0; i < mimeCount; i++) {
          if (0 == PL_strcasecmp(plugin->mMimeTypes[i].get(), aMimeType)) {
-           return plugin;
+           matchingPlugins.AppendElement(plugin);
+           break;
          }
-       }