diff options
author | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-04 16:38:30 +0000 |
---|---|---|
committer | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-04 16:38:30 +0000 |
commit | 980641651d4c082177b135fae3d1f718eaa10310 (patch) | |
tree | e54753d697e53ae0badaabbcdfdd539fe5afaf0d /chrome/renderer/resources | |
parent | c2b1122fe332847e3fcaab2e1383c1ccb32b6e05 (diff) | |
download | chromium_src-980641651d4c082177b135fae3d1f718eaa10310.zip chromium_src-980641651d4c082177b135fae3d1f718eaa10310.tar.gz chromium_src-980641651d4c082177b135fae3d1f718eaa10310.tar.bz2 |
Fix extension context menu API onclick handlers.
I believe the following CL had accidentally broken them:
http://src.chromium.org/viewvc/chrome?view=rev&revision=47972
I haven't yet added end-to-end tests for the context menu API that would catch
problems like this, but I just created a bug for that (crbug.com/45811) and
made the bug for bringing the API out of experimental blocked on it.
I also fixed a small >80 chars style nit in this CL.
BUG=45741
TEST=The onclick handler for an extension-added context menu item should now
be called. See the bug for a minimal code snippet to put into a background page
for this.
Review URL: http://codereview.chromium.org/2626001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48936 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/resources')
-rw-r--r-- | chrome/renderer/resources/extension_process_bindings.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js index 8955daf..0bf0591 100644 --- a/chrome/renderer/resources/extension_process_bindings.js +++ b/chrome/renderer/resources/extension_process_bindings.js @@ -570,7 +570,8 @@ var chrome = chrome || {}; delete details.path; details.imageData = canvas_context.getImageData(0, 0, canvas.width, canvas.height); - sendCustomRequest(SetExtensionActionIcon, name, [details], parameters); + sendCustomRequest(SetExtensionActionIcon, name, [details], + parameters); } img.src = details.path; } else { @@ -596,9 +597,10 @@ var chrome = chrome || {}; } // Set up the onclick handler if we were passed one in the request. - if (request.args.onclick) { + var onclick = request.args.length ? request.args[0].onclick : null; + if (onclick) { var menuItemId = chromeHidden.JSON.parse(response); - chromeHidden.contextMenuHandlers[menuItemId] = request.args.onclick; + chromeHidden.contextMenuHandlers[menuItemId] = onclick; } }; |