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

Unified Diff: url/gurl.cc

Issue 23526048: Support URL fragment resolution againt non-hierarchical schemes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clea 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/gurl.h ('k') | url/gurl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/gurl.cc
diff --git a/url/gurl.cc b/url/gurl.cc
index 229df5dca2dbd6d1ab3de26c96d4d3afca49b60b..b8a38888075ab9704cecf0add40ea8747c7758d7 100644
--- a/url/gurl.cc
+++ b/url/gurl.cc
@@ -25,14 +25,15 @@ namespace {
template<typename STR>
bool InitCanonical(const STR& input_spec,
std::string* canonical,
- url_parse::Parsed* parsed) {
+ url_parse::Parsed* parsed,
+ bool trim_tail = true) {
// Reserve enough room in the output for the input, plus some extra so that
// we have room if we have to escape a few things without reallocating.
canonical->reserve(input_spec.size() + 32);
url_canon::StdStringCanonOutput output(canonical);
bool success = url_util::Canonicalize(
input_spec.data(), static_cast<int>(input_spec.length()),
- NULL, &output, parsed);
+ NULL, &output, parsed, trim_tail);
output.Complete(); // Must be done before using string.
return success;
@@ -146,19 +147,22 @@ void GURL::InitializeFromCanonicalSpec() {
// We can't do this check on the inner_url of a filesystem URL, as
// canonical_spec actually points to the start of the outer URL, so we'd
// end up with infinite recursion in this constructor.
- GURL test_url(spec_);
-
- DCHECK(test_url.is_valid_ == is_valid_);
- DCHECK(test_url.spec_ == spec_);
-
- DCHECK(test_url.parsed_.scheme == parsed_.scheme);
- DCHECK(test_url.parsed_.username == parsed_.username);
- DCHECK(test_url.parsed_.password == parsed_.password);
- DCHECK(test_url.parsed_.host == parsed_.host);
- DCHECK(test_url.parsed_.port == parsed_.port);
- DCHECK(test_url.parsed_.path == parsed_.path);
- DCHECK(test_url.parsed_.query == parsed_.query);
- DCHECK(test_url.parsed_.ref == parsed_.ref);
+ std::string test_spec;
+ url_parse::Parsed test_parsed;
+ bool test_is_valid = InitCanonical(spec_, &test_spec,
+ &test_parsed, false);
+
+ DCHECK_EQ(test_is_valid, is_valid_);
+
+ DCHECK_EQ(test_spec, spec_);
+ DCHECK(test_parsed.scheme == parsed_.scheme);
+ DCHECK(test_parsed.username == parsed_.username);
+ DCHECK(test_parsed.password == parsed_.password);
+ DCHECK(test_parsed.host == parsed_.host);
+ DCHECK(test_parsed.port == parsed_.port);
+ DCHECK(test_parsed.path == parsed_.path);
+ DCHECK(test_parsed.query == parsed_.query);
+ DCHECK(test_parsed.ref == parsed_.ref);
}
}
#endif
« no previous file with comments | « url/gurl.h ('k') | url/gurl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698