Skip to content

Commit

Permalink
Marshal the URL parameter of the clipboard bookmark format as a string.
Browse files Browse the repository at this point in the history
This temporarily restores the original behavior. It'd be nice to use the
more specific type, but some components of Blink are generating long
data: URLs and passing them to WriteBookmark(), which causes the browser
to kill the renderer.

BUG=447094

Review URL: https://codereview.chromium.org/934373002

Cr-Commit-Position: refs/heads/master@{#316981}
  • Loading branch information
zetafunction authored and Commit bot committed Feb 19, 2015
1 parent f9dbeb2 commit 87e6d8a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions content/browser/renderer_host/clipboard_message_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,9 @@ void ClipboardMessageFilter::OnWriteCustomData(
}

void ClipboardMessageFilter::OnWriteBookmark(ui::ClipboardType clipboard_type,
const GURL& url,
const std::string& url,
const base::string16& title) {
clipboard_writer_->WriteBookmark(title, url.spec());
clipboard_writer_->WriteBookmark(title, url);
}

void ClipboardMessageFilter::OnWriteImage(ui::ClipboardType clipboard_type,
Expand Down
2 changes: 1 addition & 1 deletion content/browser/renderer_host/clipboard_message_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CONTENT_EXPORT ClipboardMessageFilter : public BrowserMessageFilter {
void OnWriteCustomData(ui::ClipboardType clipboard_type,
const std::map<base::string16, base::string16>& data);
void OnWriteBookmark(ui::ClipboardType clipboard_type,
const GURL& url,
const std::string& url,
const base::string16& title);
void OnWriteImage(ui::ClipboardType clipboard_type,
const gfx::Size& size,
Expand Down
6 changes: 5 additions & 1 deletion content/common/clipboard_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,13 @@ IPC_MESSAGE_CONTROL1(ClipboardHostMsg_WriteSmartPasteMarker,
IPC_MESSAGE_CONTROL2(ClipboardHostMsg_WriteCustomData,
ui::ClipboardType /* type */,
CustomDataMap /* custom data */)
// TODO(dcheng): The |url| parameter should really be a GURL, but <canvas>'s
// copy as image tries to set very long data: URLs on the clipboard. Using
// GURL causes the browser to kill the renderer for sending a bad IPC (GURLs
// bigger than 2 megabytes are considered to be bad). https://crbug.com/459822
IPC_MESSAGE_CONTROL3(ClipboardHostMsg_WriteBookmark,
ui::ClipboardType /* type */,
GURL /* url */,
std::string /* url */,
base::string16 /* title */)
IPC_SYNC_MESSAGE_CONTROL3_0(ClipboardHostMsg_WriteImage,
ui::ClipboardType /* type */,
Expand Down
2 changes: 1 addition & 1 deletion content/renderer/renderer_clipboard_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void RendererClipboardDelegate::WriteBookmark(ui::ClipboardType clipboard_type,
const GURL& url,
const base::string16& title) {
RenderThreadImpl::current()->Send(
new ClipboardHostMsg_WriteBookmark(clipboard_type, url, title));
new ClipboardHostMsg_WriteBookmark(clipboard_type, url.spec(), title));
}

bool RendererClipboardDelegate::WriteImage(ui::ClipboardType clipboard_type,
Expand Down

0 comments on commit 87e6d8a

Please sign in to comment.