diff options
author | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-26 21:44:27 +0000 |
---|---|---|
committer | jcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-26 21:44:27 +0000 |
commit | 216932c9ac94aab93a744d260892d1a752910ed1 (patch) | |
tree | 2abb3cf711e4f81834a8629cacbe9a50a9c75f67 /chrome/renderer | |
parent | 4641d3c34c84832bb7bc8ab4e5b52bf733e6bcb6 (diff) | |
download | chromium_src-216932c9ac94aab93a744d260892d1a752910ed1.zip chromium_src-216932c9ac94aab93a744d260892d1a752910ed1.tar.gz chromium_src-216932c9ac94aab93a744d260892d1a752910ed1.tar.bz2 |
Make context-menu show for large data encoded URLs.
The message sent by the renderer to the browser to show a context menu contains the image src URL.
For large images that use data URLs, this URL can be more than 2MB, which is the max limit for serializing a GURL for IPC.
So for these large images we fail to serialize the message and no context menu is shown.
By emptying the URL in that case we make sure the message is sent and the context menu is shown. (even though you cannot save/open the image from the menu).
Making sure you can save the image will be part of a different effort.
BUG=45160
TEST=See bug.
Review URL: http://codereview.chromium.org/3209006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 21608d3..b7496a2 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -2042,7 +2042,13 @@ void RenderView::showContextMenu( if (spelled_right) params.misspelled_word.clear(); } - + // Serializing a GURL longer than chrome::kMaxURLChars will fail, so don't do + // it. We replace it with an empty GURL so the appropriate items are disabled + // in the context menu. + // TODO(jcivelli): http://crbug.com/45160 This prevents us from saving large + // data encoded images. We should have a way to save them. + if (params.src_url.spec().size() > chrome::kMaxURLChars) + params.src_url = GURL(); Send(new ViewHostMsg_ContextMenu(routing_id_, params)); } |