updated patch
authorWolfgang Rosenauer <wr@rosenauer.org>
Thu, 19 Jul 2012 20:44:20 +0200
changeset 505 edb0bc96e43b
parent 504 6044341b3987
child 506 f02147953485
updated patch
mozilla-prefer_plugin_pref.patch
--- a/mozilla-prefer_plugin_pref.patch	Thu Jul 19 20:40:27 2012 +0200
+++ b/mozilla-prefer_plugin_pref.patch	Thu Jul 19 20:44:20 2012 +0200
@@ -4,7 +4,7 @@
 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
-@@ -1513,19 +1513,51 @@ nsPluginHost::FindPluginForType(const ch
+@@ -1561,17 +1561,45 @@ nsPluginHost::FindPluginForType(const ch
                                  bool aCheckEnabled)
  {
    if (!aMimeType) {
@@ -13,26 +13,20 @@
  
    LoadPlugins();
  
-+  nsresult res;
-+  nsCOMPtr<nsIPrefBranch> prefB (do_QueryInterface(mPrefService));
-+
 +  char *preferredPluginPath = NULL;
 +  nsCAutoString mimetypePrefString ("modules.plugins.mimetype.");
 +  mimetypePrefString.Append(aMimeType);
 +  const char *mimetypePrefChar = mimetypePrefString.get();
-+  res = prefB->GetCharPref(mimetypePrefChar, &preferredPluginPath);
++  nsAdoptingCString pluginPath = Preferences::GetCString(mimetypePrefChar);
++  preferredPluginPath = (char*) pluginPath.get();
 +
-+  if(!NS_SUCCEEDED(res)) preferredPluginPath = NULL;
-+
-   InfallibleTArray<nsPluginTag*> matchingPlugins;
- 
    nsPluginTag *plugin = mPlugins;
 +
 +  if(preferredPluginPath) {
 +    while (nsnull != plugin) {
 +      if (0 == PL_strcasecmp(plugin->mFileName.get(), preferredPluginPath) ||
 +          0 == PL_strcasecmp(plugin->mFullPath.get(), preferredPluginPath)) {
-+        matchingPlugins.AppendElement(plugin);
++        return plugin;
 +      }
 +      plugin = plugin->mNext;
 +    }
@@ -42,7 +36,7 @@
 +    while (nsnull != plugin) {
 +      if (nsnull != PL_strstr(plugin->mFileName.get(), preferredPluginPath) ||
 +          nsnull != PL_strstr(plugin->mFullPath.get(), preferredPluginPath)) {
-+        matchingPlugins.AppendElement(plugin);
++        return plugin;
 +      }
 +      plugin = plugin->mNext;
 +    }
@@ -53,6 +47,6 @@
        PRInt32 mimeCount = plugin->mMimeTypes.Length();
        for (PRInt32 i = 0; i < mimeCount; i++) {
          if (0 == PL_strcasecmp(plugin->mMimeTypes[i].get(), aMimeType)) {
-           matchingPlugins.AppendElement(plugin);
-           break;
+           return plugin;
          }
+       }