|
1 diff --git a/modules/plugin/base/src/nsPluginHost.cpp b/modules/plugin/base/src/nsPluginHost.cpp |
|
2 --- a/modules/plugin/base/src/nsPluginHost.cpp |
|
3 +++ b/modules/plugin/base/src/nsPluginHost.cpp |
|
4 @@ -3929,8 +3929,41 @@ nsPluginHost::FindPluginForType(const ch |
|
5 // if we have a mimetype passed in, search the mPlugins |
|
6 // linked list for a match |
|
7 if (nsnull != aMimeType) { |
|
8 + nsresult res; |
|
9 + nsCOMPtr<nsIPrefBranch> prefB (do_QueryInterface(mPrefService)); |
|
10 + |
|
11 + char *preferredPluginPath = NULL; |
|
12 + nsCAutoString mimetypePrefString ("modules.plugins.mimetype."); |
|
13 + mimetypePrefString.Append(aMimeType); |
|
14 + const char *mimetypePrefChar = mimetypePrefString.get(); |
|
15 + res = prefB->GetCharPref(mimetypePrefChar, &preferredPluginPath); |
|
16 + |
|
17 + if(!NS_SUCCEEDED(res)) preferredPluginPath = NULL; |
|
18 + |
|
19 plugins = mPlugins; |
|
20 - |
|
21 + if(preferredPluginPath) { |
|
22 + while (nsnull != plugins) { |
|
23 + if (0 == PL_strcasecmp(plugins->mFileName.get(), preferredPluginPath) || |
|
24 + 0 == PL_strcasecmp(plugins->mFullPath.get(), preferredPluginPath)) { |
|
25 + return plugins; |
|
26 + } |
|
27 + plugins = plugins->mNext; |
|
28 + } |
|
29 + |
|
30 + // now lets search for substrings |
|
31 + plugins=mPlugins; |
|
32 + while (nsnull != plugins) { |
|
33 + if (nsnull != PL_strstr(plugins->mFileName.get(), preferredPluginPath) || |
|
34 + nsnull != PL_strstr(plugins->mFullPath.get(), preferredPluginPath)) { |
|
35 + return plugins; |
|
36 + } |
|
37 + plugins = plugins->mNext; |
|
38 + } |
|
39 + } |
|
40 + |
|
41 + // if there is no pref for this mime-type, or if the plugin named in pref |
|
42 + // isn't found, we pick the first that matches for this mime-type |
|
43 + plugins = mPlugins; |
|
44 while (nsnull != plugins) { |
|
45 variants = plugins->mVariants; |
|
46 for (cnt = 0; cnt < variants; cnt++) { |