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

Unified Diff: url/url_util_unittest.cc

Issue 767713002: DoResolveRelative must not parse mailto schemes as path URLs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« url/url_util.cc ('K') | « url/url_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_util_unittest.cc
diff --git a/url/url_util_unittest.cc b/url/url_util_unittest.cc
index aba44e469157733236927072cdf2888443e5e8e7..da8fdc5d64eb24a69f5345fb6dae8aa81a8d4ad4 100644
--- a/url/url_util_unittest.cc
+++ b/url/url_util_unittest.cc
@@ -295,4 +295,25 @@ TEST(URLUtilTest, TestResolveRelativeWithNonStandardBase) {
}
}
+TEST(URLUtilTest, TestNoRefComponent) {
+ // The following address has base_parsed_authority.host, but
brettw 2014/12/01 20:15:09 base_parsed_authority has no meaning in this conte
+ // it is still a mailto: scheme, and cannot be parsed as a path.
+ const char* base = "mailto://to/";
+ const char* rel = "any#body";
+
+ Parsed base_parsed;
+ ParsePathURL(base, strlen(base), false, &base_parsed);
+
+ std::string resolved;
+ StdStringCanonOutput output(&resolved);
+ Parsed resolved_parsed;
+
+ bool valid = ResolveRelative(base, strlen(base),
+ base_parsed, rel,
+ strlen(rel), NULL, &output,
+ &resolved_parsed);
+ EXPECT_TRUE(valid);
+ EXPECT_FALSE(resolved_parsed.ref.is_valid());
+}
+
} // namespace url
« url/url_util.cc ('K') | « url/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698