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

Unified Diff: url/url_util_unittest.cc

Issue 23835019: Support URL fragment resolution againt non-hierarchical schemes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: actually restore PS4 this time Created 7 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_parse_internal.h ('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 dfbdb40927e55aeebae171a530e2f32d8b766f60..e6b688236b6ed6a9572ea3ba3c806b73c7504d34 100644
--- a/url/url_util_unittest.cc
+++ b/url/url_util_unittest.cc
@@ -93,7 +93,7 @@ static std::string CheckReplaceScheme(const char* base_url,
// Make sure the input is canonicalized.
url_canon::RawCanonOutput<32> original;
url_parse::Parsed original_parsed;
- url_util::Canonicalize(base_url, strlen(base_url), NULL,
+ url_util::Canonicalize(base_url, strlen(base_url), true, NULL,
&original, &original_parsed);
url_canon::Replacements<char> replacements;
@@ -270,12 +270,19 @@ TEST(URLUtilTest, TestResolveRelativeWithNonStandardBase) {
// Resolving should fail if the base URL is authority-based but is
// missing a path component (the '/' at the end).
{"scheme://Authority", "path", false, ""},
+ // Test resolving a fragment (only) against any kind of base-URL.
+ {"about:blank", "#id42", true, "about:blank#id42" },
+ {"about:blank#oldfrag", "#newfrag", true, "about:blank#newfrag" },
+ // A surprising side effect of allowing fragments to resolve against
+ // any URL scheme is we might break javascript: URLs by doing so...
+ {"javascript:alert('foo#bar')", "#badfrag", true,
+ "javascript:alert('foo#badfrag" },
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(resolve_non_standard_cases); i++) {
const ResolveRelativeCase& test_data = resolve_non_standard_cases[i];
url_parse::Parsed base_parsed;
- url_parse::ParsePathURL(test_data.base, strlen(test_data.base),
+ url_parse::ParsePathURL(test_data.base, strlen(test_data.base), false,
&base_parsed);
std::string resolved;
« url/url_parse_internal.h ('K') | « url/url_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698