mozilla-prefer_plugin_pref.patch
changeset 123 1d88ea95ad20
parent 8 19a8c8d53349
child 289 3c0dff7ca9c4
--- a/mozilla-prefer_plugin_pref.patch	Mon Aug 02 08:49:38 2010 +0200
+++ b/mozilla-prefer_plugin_pref.patch	Wed Aug 04 23:59:00 2010 +0200
@@ -4,10 +4,15 @@
 diff --git a/modules/plugin/base/src/nsPluginHost.cpp b/modules/plugin/base/src/nsPluginHost.cpp
 --- a/modules/plugin/base/src/nsPluginHost.cpp
 +++ b/modules/plugin/base/src/nsPluginHost.cpp
-@@ -3929,8 +3929,41 @@ nsPluginHost::FindPluginForType(const ch
+@@ -1620,17 +1620,47 @@ nsPluginHost::FindPluginForType(const ch
+   nsPluginTag *plugins = nsnull;
+   PRInt32     variants, cnt;
+ 
+   LoadPlugins();
+ 
    // if we have a mimetype passed in, search the mPlugins
    // linked list for a match
-   if (nsnull != aMimeType) {
+   if (aMimeType) {
 +    nsresult res;
 +    nsCOMPtr<nsIPrefBranch> prefB (do_QueryInterface(mPrefService));
 +
@@ -20,7 +25,6 @@
 +    if(!NS_SUCCEEDED(res)) preferredPluginPath = NULL;
 +
      plugins = mPlugins;
--
 +    if(preferredPluginPath) {
 +      while (nsnull != plugins) {
 +        if (0 == PL_strcasecmp(plugins->mFileName.get(), preferredPluginPath) ||
@@ -40,10 +44,11 @@
 +        plugins = plugins->mNext;
 +      }
 +    }
-+
-+    // if there is no pref for this mime-type, or if the plugin named in pref
-+    // isn't found, we pick the first that matches for this mime-type
-+    plugins = mPlugins;
-     while (nsnull != plugins) {
+ 
+     while (plugins) {
        variants = plugins->mVariants;
        for (cnt = 0; cnt < variants; cnt++) {
+         if ((!aCheckEnabled || plugins->IsEnabled()) &&
+             plugins->mMimeTypeArray[cnt] &&
+             (0 == PL_strcasecmp(plugins->mMimeTypeArray[cnt], aMimeType))) {
+           return plugins;