summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 22:47:00 +0000
committerpastarmovj@chromium.org <pastarmovj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-25 22:47:00 +0000
commitcd91aff2f0ced8ac9027e35f5ee82400d7fa5298 (patch)
tree8ee57a177235920cd4f5ffca4eeec0a7428a451b /webkit
parentf264e8f23079e13126ee24b568bef9a0af6e096b (diff)
downloadchromium_src-cd91aff2f0ced8ac9027e35f5ee82400d7fa5298.zip
chromium_src-cd91aff2f0ced8ac9027e35f5ee82400d7fa5298.tar.gz
chromium_src-cd91aff2f0ced8ac9027e35f5ee82400d7fa5298.tar.bz2
Fixed grave bug in Plugin Loading code that lead to a crash with some plugins.
When plugins are not properly written they don't supply any identificatrion info through their api which used to kill the plugin loading code. BUG=70775 TEST=test_shell_tests-PluginListTest.BadPluginDescription Review URL: http://codereview.chromium.org/6324014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72557 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/npapi/plugin_list.cc14
-rw-r--r--webkit/plugins/npapi/plugin_list_unittest.cc14
2 files changed, 21 insertions, 7 deletions
diff --git a/webkit/plugins/npapi/plugin_list.cc b/webkit/plugins/npapi/plugin_list.cc
index ab1b9dc..a4da48d 100644
--- a/webkit/plugins/npapi/plugin_list.cc
+++ b/webkit/plugins/npapi/plugin_list.cc
@@ -711,13 +711,6 @@ PluginGroup* PluginList::AddToPluginGroups(
}
if (!group) {
group = PluginGroup::FromWebPluginInfo(web_plugin_info);
- // If group is scheduled for disabling do that now and remove it from the
- // list.
- if (groups_to_disable_.find(group->GetGroupName()) !=
- groups_to_disable_.end()) {
- group->EnableGroup(false);
- groups_to_disable_.erase(group->GetGroupName());
- }
std::string identifier = group->identifier();
// If the identifier is not unique, use the full path. This means that we
// probably won't be able to search for this group by identifier, but at
@@ -734,6 +727,13 @@ PluginGroup* PluginList::AddToPluginGroups(
plugin_groups->push_back(group);
}
group->AddPlugin(web_plugin_info);
+ // If group is scheduled for disabling do that now and remove it from the
+ // list.
+ if (groups_to_disable_.find(group->GetGroupName()) !=
+ groups_to_disable_.end()) {
+ group->EnableGroup(false);
+ groups_to_disable_.erase(group->GetGroupName());
+ }
return group;
}
diff --git a/webkit/plugins/npapi/plugin_list_unittest.cc b/webkit/plugins/npapi/plugin_list_unittest.cc
index 3e0fb47..1c5e99a 100644
--- a/webkit/plugins/npapi/plugin_list_unittest.cc
+++ b/webkit/plugins/npapi/plugin_list_unittest.cc
@@ -182,6 +182,20 @@ TEST_F(PluginListTest, DisableOutdated) {
EXPECT_FALSE(group_3043->IsVulnerable());
}
+TEST_F(PluginListTest, BadPluginDescription) {
+ WebPluginInfo plugin_3043(ASCIIToUTF16(""),
+ FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")),
+ ASCIIToUTF16(""),
+ ASCIIToUTF16(""));
+ // Simulate loading of the plugins.
+ plugin_list_.plugins_to_load_.clear();
+ plugin_list_.plugins_to_load_.push_back(plugin_3043);
+ // Now we should have them in the state we specified above.
+ std::vector<WebPluginInfo> plugins;
+ plugin_list_.GetPlugins(true, &plugins);
+ ASSERT_TRUE(Contains(plugins, plugin_3043, true));
+}
+
TEST_F(PluginListTest, DisableAndEnableBeforeLoad) {
WebPluginInfo plugin_3043(ASCIIToUTF16("MyPlugin"),
FilePath(FILE_PATH_LITERAL("/myplugin.3.0.43")),