author | Wolfgang Rosenauer <wr@rosenauer.org> |
Tue, 09 Oct 2012 13:40:39 +0200 | |
branch | firefox16 |
changeset 555 | a8c0d77272f6 |
parent 505 | edb0bc96e43b |
child 541 | 830e50bbfc79 |
permissions | -rw-r--r-- |
8 | 1 |
From: Ubuntu |
491 | 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 |
505 | 7 |
@@ -1561,17 +1561,45 @@ 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 |
||
491 | 16 |
+ char *preferredPluginPath = NULL; |
17 |
+ nsCAutoString mimetypePrefString ("modules.plugins.mimetype."); |
|
18 |
+ mimetypePrefString.Append(aMimeType); |
|
19 |
+ const char *mimetypePrefChar = mimetypePrefString.get(); |
|
505 | 20 |
+ nsAdoptingCString pluginPath = Preferences::GetCString(mimetypePrefChar); |
21 |
+ preferredPluginPath = (char*) pluginPath.get(); |
|
491 | 22 |
+ |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
23 |
nsPluginTag *plugin = mPlugins; |
1 | 24 |
+ |
491 | 25 |
+ if(preferredPluginPath) { |
26 |
+ while (nsnull != plugin) { |
|
27 |
+ if (0 == PL_strcasecmp(plugin->mFileName.get(), preferredPluginPath) || |
|
28 |
+ 0 == PL_strcasecmp(plugin->mFullPath.get(), preferredPluginPath)) { |
|
505 | 29 |
+ return plugin; |
491 | 30 |
+ } |
31 |
+ plugin = plugin->mNext; |
|
32 |
+ } |
|
33 |
+ |
|
34 |
+ // now lets search for substrings |
|
35 |
+ plugin = mPlugins; |
|
36 |
+ while (nsnull != plugin) { |
|
37 |
+ if (nsnull != PL_strstr(plugin->mFileName.get(), preferredPluginPath) || |
|
38 |
+ nsnull != PL_strstr(plugin->mFullPath.get(), preferredPluginPath)) { |
|
505 | 39 |
+ return plugin; |
1 | 40 |
+ } |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
41 |
+ plugin = plugin->mNext; |
1 | 42 |
+ } |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
43 |
+ } |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
44 |
+ |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
45 |
while (plugin) { |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
46 |
if (!aCheckEnabled || plugin->IsEnabled()) { |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
47 |
PRInt32 mimeCount = plugin->mMimeTypes.Length(); |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
48 |
for (PRInt32 i = 0; i < mimeCount; i++) { |
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
49 |
if (0 == PL_strcasecmp(plugin->mMimeTypes[i].get(), aMimeType)) { |
505 | 50 |
return plugin; |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
51 |
} |
505 | 52 |
} |