Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: webkit/plugins/npapi/plugin_list.cc

Issue 6324014: Fixed grave bug in Plugin Loading code that lead to a crash with some plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/npapi/plugin_list.h" 5 #include "webkit/plugins/npapi/plugin_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 ScopedVector<PluginGroup>* plugin_groups) { 704 ScopedVector<PluginGroup>* plugin_groups) {
705 PluginGroup* group = NULL; 705 PluginGroup* group = NULL;
706 for (size_t i = 0; i < plugin_groups->size(); ++i) { 706 for (size_t i = 0; i < plugin_groups->size(); ++i) {
707 if ((*plugin_groups)[i]->Match(web_plugin_info)) { 707 if ((*plugin_groups)[i]->Match(web_plugin_info)) {
708 group = (*plugin_groups)[i]; 708 group = (*plugin_groups)[i];
709 break; 709 break;
710 } 710 }
711 } 711 }
712 if (!group) { 712 if (!group) {
713 group = PluginGroup::FromWebPluginInfo(web_plugin_info); 713 group = PluginGroup::FromWebPluginInfo(web_plugin_info);
714 // If group is scheduled for disabling do that now and remove it from the
715 // list.
716 if (groups_to_disable_.find(group->GetGroupName()) !=
717 groups_to_disable_.end()) {
718 group->EnableGroup(false);
719 groups_to_disable_.erase(group->GetGroupName());
720 }
721 std::string identifier = group->identifier(); 714 std::string identifier = group->identifier();
722 // If the identifier is not unique, use the full path. This means that we 715 // If the identifier is not unique, use the full path. This means that we
723 // probably won't be able to search for this group by identifier, but at 716 // probably won't be able to search for this group by identifier, but at
724 // least it's going to be in the set of plugin groups, and if there 717 // least it's going to be in the set of plugin groups, and if there
725 // is already a plug-in with the same filename, it's probably going to 718 // is already a plug-in with the same filename, it's probably going to
726 // handle the same MIME types (and it has a higher priority), so this one 719 // handle the same MIME types (and it has a higher priority), so this one
727 // is not going to run anyway. 720 // is not going to run anyway.
728 for (size_t i = 0; i < plugin_groups->size(); ++i) { 721 for (size_t i = 0; i < plugin_groups->size(); ++i) {
729 if ((*plugin_groups)[i]->identifier() == identifier) { 722 if ((*plugin_groups)[i]->identifier() == identifier) {
730 group->set_identifier(PluginGroup::GetLongIdentifier(web_plugin_info)); 723 group->set_identifier(PluginGroup::GetLongIdentifier(web_plugin_info));
731 break; 724 break;
732 } 725 }
733 } 726 }
734 plugin_groups->push_back(group); 727 plugin_groups->push_back(group);
735 } 728 }
736 group->AddPlugin(web_plugin_info); 729 group->AddPlugin(web_plugin_info);
730 // If group is scheduled for disabling do that now and remove it from the
731 // list.
732 if (groups_to_disable_.find(group->GetGroupName()) !=
733 groups_to_disable_.end()) {
734 group->EnableGroup(false);
735 groups_to_disable_.erase(group->GetGroupName());
736 }
737 return group; 737 return group;
738 } 738 }
739 739
740 bool PluginList::EnablePlugin(const FilePath& filename) { 740 bool PluginList::EnablePlugin(const FilePath& filename) {
741 base::AutoLock lock(lock_); 741 base::AutoLock lock(lock_);
742 for (size_t i = 0; i < plugin_groups_.size(); ++i) { 742 for (size_t i = 0; i < plugin_groups_.size(); ++i) {
743 if (plugin_groups_[i]->ContainsPlugin(filename)) 743 if (plugin_groups_[i]->ContainsPlugin(filename))
744 return plugin_groups_[i]->EnablePlugin(filename); 744 return plugin_groups_[i]->EnablePlugin(filename);
745 } 745 }
746 // Non existing plugin is being enabled. Check if it has been disabled before 746 // Non existing plugin is being enabled. Check if it has been disabled before
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 void PluginList::DisableOutdatedPluginGroups() { 821 void PluginList::DisableOutdatedPluginGroups() {
822 disable_outdated_plugins_ = true; 822 disable_outdated_plugins_ = true;
823 } 823 }
824 824
825 PluginList::~PluginList() { 825 PluginList::~PluginList() {
826 } 826 }
827 827
828 828
829 } // namespace npapi 829 } // namespace npapi
830 } // namespace webkit 830 } // namespace webkit
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gview_request_interceptor_unittest.cc ('k') | webkit/plugins/npapi/plugin_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698