Index: content/browser/web_contents/web_drag_dest_gtk.cc |
diff --git a/content/browser/web_contents/web_drag_dest_gtk.cc b/content/browser/web_contents/web_drag_dest_gtk.cc |
index d3b9ff89171518ec48c4d0249d9e3a20a02bfa5b..0594a2e2b0506416b8f87444639f8aeb769af980 100644 |
--- a/content/browser/web_contents/web_drag_dest_gtk.cc |
+++ b/content/browser/web_contents/web_drag_dest_gtk.cc |
@@ -121,7 +121,10 @@ gboolean WebDragDestGtk::OnDragMotion(GtkWidget* sender, |
// text/plain with file URLs when dragging files, we want to handle |
// text/uri-list after text/plain so that the plain text can be cleared if |
// it's a file drag. |
+ // Similarly, renderer taint must occur before anything else so we can |
+ // ignore potentially forged filenames when handling text/uri-list. |
static int supported_targets[] = { |
+ ui::RENDERER_TAINT, |
ui::TEXT_PLAIN, |
ui::TEXT_URI_LIST, |
ui::TEXT_HTML, |
@@ -182,7 +185,9 @@ void WebDragDestGtk::OnDragDataReceived( |
if (raw_data && data_length > 0) { |
// If the source can't provide us with valid data for a requested target, |
// raw_data will be NULL. |
- if (target == ui::GetAtomForTarget(ui::TEXT_PLAIN)) { |
+ if (target == ui::GetAtomForTarget(ui::RENDERER_TAINT)) { |
+ drop_data_->did_originate_from_renderer = true; |
+ } else if (target == ui::GetAtomForTarget(ui::TEXT_PLAIN)) { |
guchar* text = gtk_selection_data_get_text(data); |
if (text) { |
drop_data_->text = base::NullableString16( |