summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 23:53:06 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 23:53:06 +0000
commit476bc6463e535d00b5bf5287b994b3c8bba2d063 (patch)
tree0aa2fb8f2bc707104a729a9d558ba19d47b79788 /webkit
parent9806fe736f0f614862e79e2e83a1768c0a286346 (diff)
downloadchromium_src-476bc6463e535d00b5bf5287b994b3c8bba2d063.zip
chromium_src-476bc6463e535d00b5bf5287b994b3c8bba2d063.tar.gz
chromium_src-476bc6463e535d00b5bf5287b994b3c8bba2d063.tar.bz2
Blacklist PDF Browser Plugin on Mac for now.
Add more comprehensive whitelist/blacklist logic so that we can easily switch defaults. BUG=24918,26110 TEST=Install plugin, follow a link to a PDF; you should not get a page with nothing but a crash notification for the plugin. Review URL: http://codereview.chromium.org/342029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/plugin_list_mac.mm63
1 files changed, 56 insertions, 7 deletions
diff --git a/webkit/glue/plugins/plugin_list_mac.mm b/webkit/glue/plugins/plugin_list_mac.mm
index b6c4a60..3bb23f1 100644
--- a/webkit/glue/plugins/plugin_list_mac.mm
+++ b/webkit/glue/plugins/plugin_list_mac.mm
@@ -67,21 +67,70 @@ void PluginList::LoadPluginsFromDir(const FilePath &path,
}
}
+// Returns true if |array| contains a string matching |test_string|.
+static bool ArrayContainsString(const char** array, unsigned int array_size,
+ const std::string& test_string) {
+ // We're dealing with very small lists, so just walk in order; if we someday
+ // end up with very big blacklists or whitelists we can revisit the approach.
+ for (unsigned int i = 0; i < array_size; ++i) {
+ if (test_string == array[i])
+ return true;
+ }
+ return false;
+}
+
bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info,
std::vector<WebPluginInfo>* plugins) {
- // Screen out some plugins that we know don't work at all.
+ // Plugins that we know don't work at all.
+ const char* blacklisted_plugin_mimes[] = {
+ "application/x-director", // Crashes during initialization.
+ "application/x-googlegears", // Safari-specific.
+ "application/x-vnd.movenetworks.qm", // Crashes during initialization.
+ };
+ // In the case of plugins that share MIME types, we have to blacklist by name.
+ const char* blacklisted_plugin_names[] = {
+ // Blacklisted for now since having it non-functional but trying to handle
+ // PDFs is worse than not having it (PDF content would otherwise be
+ // downloaded or handled by QuickTime).
+ "PDF Browser Plugin",
+ };
+
+ // Plugins that we know are working reasonably well.
+ const char* whitelisted_plugin_mimes[] = {
+ "application/googletalk",
+ "application/x-picasa-detect",
+ "application/x-shockwave-flash",
+ "application/x-webkit-test-netscape",
+ };
+
+ // Start with names.
+ std::string plugin_name = WideToUTF8(info.name);
+ if (ArrayContainsString(blacklisted_plugin_names,
+ arraysize(blacklisted_plugin_names), plugin_name)) {
+ return false;
+ }
+ // Then check mime types.
+ bool whitelisted = false;
for (std::vector<WebPluginMimeType>::const_iterator i =
info.mime_types.begin(); i != info.mime_types.end(); ++i) {
- // The Gears plugin is Safari-specific. MoveNetworks Quantum Media Player
- // and Shockwave for Director crash during initialization, and don't work in
- // Safari on 10.6 either.
- if (i->mime_type == "application/x-googlegears" ||
- i->mime_type == "application/x-vnd.movenetworks.qm" ||
- i->mime_type == "application/x-director") {
+ if (ArrayContainsString(blacklisted_plugin_mimes,
+ arraysize(blacklisted_plugin_mimes),
+ i->mime_type)) {
return false;
}
+ if (ArrayContainsString(whitelisted_plugin_mimes,
+ arraysize(whitelisted_plugin_mimes),
+ i->mime_type)) {
+ whitelisted = true;
+ break;
+ }
}
+#if OS_MACOSX_BLACKLIST_PLUGINS_BY_DEFAULT
+ if (!whitelisted)
+ return false;
+#endif
+
// Hierarchy check
// (we're loading plugins hierarchically from Library folders, so plugins we
// encounter earlier must override plugins we encounter later)