summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/location_bar_view_gtk.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 02:12:34 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 02:12:34 +0000
commit84954ce77558a87d6bd20d5691bbc4ce9bfb6887 (patch)
treee03a8bd4148aadf4d4880e73912c4f5398ad953c /chrome/browser/gtk/location_bar_view_gtk.cc
parent70853b00ae4f3a0b3c96978cfa4a5caeabacb60b (diff)
downloadchromium_src-84954ce77558a87d6bd20d5691bbc4ce9bfb6887.zip
chromium_src-84954ce77558a87d6bd20d5691bbc4ce9bfb6887.tar.gz
chromium_src-84954ce77558a87d6bd20d5691bbc4ce9bfb6887.tar.bz2
Page actions that don't specify an icon (ie.
have a spelling error in the manifest, such as icon instead of icons/default_icon) caused a crash when they try to display their icon. We now check when the extension tries to enable the page action whether there are any icons to display. If not, we don't proceed and log an error to the console. BUG=25562 TEST=Covered by browser test. Review URL: http://codereview.chromium.org/316018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29861 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/location_bar_view_gtk.cc')
-rw-r--r--chrome/browser/gtk/location_bar_view_gtk.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index 8648099..382563a 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -409,6 +409,15 @@ void LocationBarViewGtk::UpdatePageActions() {
if (profile_->GetExtensionsService())
page_actions = profile_->GetExtensionsService()->GetPageActions();
+ // Page actions can be created without an icon, so make sure we count only
+ // those that have been given an icon.
+ for (size_t i = 0; i < page_actions.size();) {
+ if (page_actions[i]->icon_paths().empty())
+ page_actions.erase(page_actions.begin() + i);
+ else
+ ++i;
+ }
+
// Initialize on the first call, or re-inialize if more extensions have been
// loaded or added after startup.
if (page_actions.size() != page_action_views_.size()) {