author | Wolfgang Rosenauer <wr@rosenauer.org> |
Tue, 26 Jun 2012 23:24:29 +0200 | |
branch | firefox14 |
changeset 492 | c0088c242dab |
parent 490 | be017dcbd7af |
child 494 | 21aea6bec3cb |
permissions | -rw-r--r-- |
8 | 1 |
From: Ubuntu |
490 | 2 |
Subject: introduce a pref to prefer certain plugins for mime-types |
8 | 3 |
|
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
4 |
diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
5 |
--- a/dom/plugins/base/nsPluginHost.cpp |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
6 |
+++ b/dom/plugins/base/nsPluginHost.cpp |
492
c0088c242dab
fixed build by using new Preferences interface
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
490
diff
changeset
|
7 |
@@ -1581,19 +1581,47 @@ nsPluginHost::FindPluginForType(const ch |
367
3fabd9f66322
begin Firefox 10 cycle
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
289
diff
changeset
|
8 |
bool aCheckEnabled) |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
9 |
{ |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
10 |
if (!aMimeType) { |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
11 |
return nsnull; |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
12 |
} |
123 | 13 |
|
14 |
LoadPlugins(); |
|
15 |
||
490 | 16 |
+ char *preferredPluginPath = NULL; |
17 |
+ nsCAutoString mimetypePrefString ("modules.plugins.mimetype."); |
|
18 |
+ mimetypePrefString.Append(aMimeType); |
|
19 |
+ const char *mimetypePrefChar = mimetypePrefString.get(); |
|
492
c0088c242dab
fixed build by using new Preferences interface
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
490
diff
changeset
|
20 |
+ nsAdoptingCString pluginPath = Preferences::GetCString(mimetypePrefChar); |
c0088c242dab
fixed build by using new Preferences interface
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
490
diff
changeset
|
21 |
+ preferredPluginPath = (char*) pluginPath.get(); |
490 | 22 |
+ |
23 |
InfallibleTArray<nsPluginTag*> matchingPlugins; |
|
24 |
||
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
25 |
nsPluginTag *plugin = mPlugins; |
1 | 26 |
+ |
490 | 27 |
+ if(preferredPluginPath) { |
28 |
+ while (nsnull != plugin) { |
|
29 |
+ if (0 == PL_strcasecmp(plugin->mFileName.get(), preferredPluginPath) || |
|
30 |
+ 0 == PL_strcasecmp(plugin->mFullPath.get(), preferredPluginPath)) { |
|
31 |
+ matchingPlugins.AppendElement(plugin); |
|
32 |
+ } |
|
33 |
+ plugin = plugin->mNext; |
|
34 |
+ } |
|
35 |
+ |
|
36 |
+ // now lets search for substrings |
|
37 |
+ plugin = mPlugins; |
|
38 |
+ while (nsnull != plugin) { |
|
39 |
+ if (nsnull != PL_strstr(plugin->mFileName.get(), preferredPluginPath) || |
|
40 |
+ nsnull != PL_strstr(plugin->mFullPath.get(), preferredPluginPath)) { |
|
41 |
+ matchingPlugins.AppendElement(plugin); |
|
1 | 42 |
+ } |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
43 |
+ plugin = plugin->mNext; |
1 | 44 |
+ } |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
45 |
+ } |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
46 |
+ |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
47 |
while (plugin) { |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
48 |
if (!aCheckEnabled || plugin->IsEnabled()) { |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
49 |
PRInt32 mimeCount = plugin->mMimeTypes.Length(); |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
50 |
for (PRInt32 i = 0; i < mimeCount; i++) { |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
51 |
if (0 == PL_strcasecmp(plugin->mMimeTypes[i].get(), aMimeType)) { |
490 | 52 |
matchingPlugins.AppendElement(plugin); |
53 |
break; |
|
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
54 |
} |