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

Issue 1137733002: Fix an off-by-one error in checking # of action context menu items in (Closed)

Created:
5 years, 7 months ago by lazyboy
Modified:
5 years, 7 months ago
Reviewers:
Devlin
CC:
chromium-reviews, chromium-apps-reviews_chromium.org, extensions-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix an off-by-one error in checking # of action context menu items in chrome.contextMenus. We should not increment |num_items| if we're not adding the item to the menu model. We have a test for this already: ExtensionContextMenuModelTest::ExtensionItemTest, since that is looking at |num_items| to verify (by ExtensionContextMenuModelTest::CountExtensionItems()). BUG=463467 Test=Add 6 browser_action items from an extension that has "contextMenus" permission: for (var i = 0; i < chrome.contextMenus.ACTION_MENU_TOP_LEVEL_LIMIT; i++) { (function(idx) { chrome.contextMenus.create({ contexts: [ "browser_action" ], title: "entry " + idx }, function() { console.debug("created " + idx, chrome.runtime.lastError); }) })(i); } Expect all 6 (ACTION_MENU_TOP_LEVEL_LIMIT) items to show up when you right click the extension icon in browser toolbar. Committed: https://crrev.com/413226da7a9a50853005b83a440c8026f823163a Cr-Commit-Position: refs/heads/master@{#329948}

Patch Set 1 #

Patch Set 2 : add thorough test + git cl format #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+22 lines, -10 lines) Patch
M chrome/browser/extensions/context_menu_matcher.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_context_menu_model_unittest.cc View 1 4 chunks +19 lines, -8 lines 1 comment Download

Messages

Total messages: 9 (2 generated)
lazyboy
5 years, 7 months ago (2015-05-08 16:13:20 UTC) #2
Devlin
Can we modify the unittest to verify this particular case, so we don't regress?
5 years, 7 months ago (2015-05-08 16:34:04 UTC) #3
lazyboy
On 2015/05/08 16:34:04, Devlin wrote: > Can we modify the unittest to verify this particular ...
5 years, 7 months ago (2015-05-08 22:53:39 UTC) #4
Devlin
lgtm
5 years, 7 months ago (2015-05-14 20:59:31 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1137733002/20001
5 years, 7 months ago (2015-05-14 21:19:25 UTC) #7
commit-bot: I haz the power
Committed patchset #2 (id:20001)
5 years, 7 months ago (2015-05-14 22:18:28 UTC) #8
commit-bot: I haz the power
5 years, 7 months ago (2015-05-14 22:20:09 UTC) #9
Message was sent while issue was closed.
Patchset 2 (id:??) landed as
https://crrev.com/413226da7a9a50853005b83a440c8026f823163a
Cr-Commit-Position: refs/heads/master@{#329948}

Powered by Google App Engine
This is Rietveld 408576698