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

Unified Diff: url/url_canon_relative.cc

Issue 23460053: Allow tail to not be trimmed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « url/third_party/mozilla/url_parse.cc ('k') | url/url_canon_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_canon_relative.cc
diff --git a/url/url_canon_relative.cc b/url/url_canon_relative.cc
index a61eaa0651de89ff01024f58431d7472778d0ca8..0abef40ff860b285b6a36d73b988e02db3e709b8 100644
--- a/url/url_canon_relative.cc
+++ b/url/url_canon_relative.cc
@@ -105,12 +105,11 @@ bool DoIsRelativeURL(const char* base,
const url_parse::Component& scheme = url_parsed.scheme;
const bool scheme_is_empty = !scheme.is_nonempty();
if (scheme_is_empty) {
- // No scheme. See if is a bare fragment.
- if (url_parsed.ref.is_valid() &&
+ // |url| has no scheme. Check the other extreme: is it a bare fragment.
+ bool url_is_ref_only = url_parsed.ref.is_valid() &&
url_parsed.CountCharactersBefore(url_parse::Parsed::REF, true) ==
- url_parsed.CountCharactersBefore(url_parse::Parsed::SCHEME, false)) {
- // |url| is a bare fragement. This can be resolved against any base.
- } else if (!is_base_hierarchical) {
+ url_parsed.CountCharactersBefore(url_parse::Parsed::SCHEME, false);
+ if (!url_is_ref_only && !is_base_hierarchical) {
// Don't allow relative URLs if the base scheme doesn't support it.
return false;
}
« no previous file with comments | « url/third_party/mozilla/url_parse.cc ('k') | url/url_canon_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698