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

Unified Diff: src/url_util_unittest.cc

Issue 1558030: Canonicalize URL before using Extractscheme in DoFindAndCompareScheme functio... (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 8 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 | « src/url_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/url_util_unittest.cc
===================================================================
--- src/url_util_unittest.cc (revision 127)
+++ src/url_util_unittest.cc (working copy)
@@ -64,6 +64,13 @@
// But when there is no scheme, it should fail.
EXPECT_FALSE(url_util::FindAndCompareScheme("", 0, "", &found_scheme));
EXPECT_TRUE(found_scheme == url_parse::Component());
+
+ // When there is a ctrl char in scheme, it should canonicalize the url before
+ // comparison.
+ const char ctrlStr[] = " \r\n\tjav\ra\nscri\tpt:alert(1)";
+ EXPECT_TRUE(url_util::FindAndCompareScheme(
+ ctrlStr, static_cast<int>(strlen(ctrlStr)), "javascript", &found_scheme));
+ EXPECT_TRUE(found_scheme == url_parse::Component(1, 10));
}
TEST(URLUtilTest, ReplaceComponents) {
« no previous file with comments | « src/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698