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

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

Issue 2421423002: Sanitize middle-click paste on New Tab button (Closed)
Patch Set: Created 4 years, 2 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 8ebceb6bfc69d8656ea477f7a47c8dbe840fa8c2..d8bc58a65570187ba56048fb8684f6d3354f32e1 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -34,6 +34,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
+#include "components/omnibox/browser/omnibox_view.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/common/content_switches.h"
#include "third_party/skia/include/core/SkColorFilter.h"
@@ -2668,6 +2669,9 @@ void TabStrip::ButtonPressed(views::Button* sender, const ui::Event& event) {
CHECK(clipboard);
base::string16 clipboard_text;
clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &clipboard_text);
+
+ // Remove any JavaScript: protocol specifiers
+ clipboard_text = OmniboxView::SanitizeTextForPaste(clipboard_text);
if (!clipboard_text.empty())
controller_->CreateNewTabWithLocation(clipboard_text);
}
« 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