Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3935)

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 2323273003: Ignore Javascript urls dropped on tabs (Closed)
Patch Set: Address nits Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 7800dc987e5ae98dd56dfdc7a7189dc17e99408a..0e09237e2d72b9d9170734294d03b7f6c2a2c2a2 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -1626,7 +1626,8 @@ int TabStrip::OnDragUpdated(const DropTargetEvent& event) {
// dragging a file to the contents of another tab.
UpdateDropIndex(event);
- if (!drop_info_->file_supported)
+ if (!drop_info_->file_supported ||
+ drop_info_->url.SchemeIs(url::kJavaScriptScheme))
return ui::DragDropTypes::DRAG_NONE;
return GetDropEffect(event);
@@ -1647,14 +1648,16 @@ int TabStrip::OnPerformDrop(const DropTargetEvent& event) {
// Hide the drop indicator.
SetDropIndex(-1, false);
- // Do nothing if the file was unsupported or the URL is invalid. The URL may
- // have been changed after |drop_info_| was created.
+ // Do nothing if the file was unsupported, the URL is invalid, or this is a
+ // javascript: URL (prevent self-xss). The URL may have been changed after
+ // |drop_info_| was created.
GURL url;
base::string16 title;
if (!file_supported ||
!event.data().GetURLAndTitle(
ui::OSExchangeData::CONVERT_FILENAMES, &url, &title) ||
- !url.is_valid())
+ !url.is_valid() ||
+ url.SchemeIs(url::kJavaScriptScheme))
return ui::DragDropTypes::DRAG_NONE;
controller_->PerformDrop(drop_before, drop_index, url);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698