author | Wolfgang Rosenauer <wr@rosenauer.org> |
Mon, 16 Jul 2012 21:10:33 +0200 | |
branch | firefox14 |
changeset 495 | 8ed13b37e5fb |
parent 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 |
494
21aea6bec3cb
14.0.1 (build1) release
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
492
diff
changeset
|
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 |
||
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 |
+ |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
23 |
nsPluginTag *plugin = mPlugins; |
1 | 24 |
+ |
490 | 25 |
+ if(preferredPluginPath) { |
26 |
+ while (nsnull != plugin) { |
|
27 |
+ if (0 == PL_strcasecmp(plugin->mFileName.get(), preferredPluginPath) || |
|
28 |
+ 0 == PL_strcasecmp(plugin->mFullPath.get(), preferredPluginPath)) { |
|
494
21aea6bec3cb
14.0.1 (build1) release
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
492
diff
changeset
|
29 |
+ return plugin; |
490 | 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)) { |
|
494
21aea6bec3cb
14.0.1 (build1) release
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
492
diff
changeset
|
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)) { |
494
21aea6bec3cb
14.0.1 (build1) release
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
492
diff
changeset
|
50 |
return plugin; |
289
3c0dff7ca9c4
Update to version 6.0b1
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
123
diff
changeset
|
51 |
} |
494
21aea6bec3cb
14.0.1 (build1) release
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
492
diff
changeset
|
52 |
} |