summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/tab_contents/render_view_context_menu.cc3
-rw-r--r--chrome/renderer/render_view.cc8
2 files changed, 9 insertions, 2 deletions
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 1a8f2d5..70f19b0 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -832,7 +832,8 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
// in a new tab as they should. Disabling this context menu option for
// now, as a quick hack, before we resolve this issue (Issue = 2608).
// TODO(sidchat): Enable this option once this issue is resolved.
- if (params_.src_url.scheme() == chrome::kChromeUIScheme)
+ if (params_.src_url.scheme() == chrome::kChromeUIScheme ||
+ !params_.src_url.is_valid())
return false;
return true;
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));
}