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

Unified Diff: url/url_util.cc

Issue 2895953002: Update dangling markup mitigations. (Closed)
Patch Set: Test. Created 3 years, 7 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
Index: url/url_util.cc
diff --git a/url/url_util.cc b/url/url_util.cc
index a17ec4d86d4c1269af1858fe695bfc064310a4b4..c026453b40981a9229fccd912264c155fe033b4c 100644
--- a/url/url_util.cc
+++ b/url/url_util.cc
@@ -185,8 +185,8 @@ bool DoFindAndCompareScheme(const CHAR* str,
// This matches the canonicalization done in DoCanonicalize function.
RawCanonOutputT<CHAR> whitespace_buffer;
int spec_len;
- const CHAR* spec = RemoveURLWhitespace(str, str_len,
- &whitespace_buffer, &spec_len);
+ const CHAR* spec =
+ RemoveURLWhitespace(str, str_len, &whitespace_buffer, &spec_len, nullptr);
Component our_scheme;
if (!ExtractScheme(spec, spec_len, &our_scheme)) {
@@ -214,11 +214,8 @@ bool DoCanonicalize(const CHAR* spec,
// Possibly this will result in copying to the new buffer.
RawCanonOutputT<CHAR> whitespace_buffer;
if (whitespace_policy == REMOVE_WHITESPACE) {
- int original_len = spec_len;
- spec =
- RemoveURLWhitespace(spec, original_len, &whitespace_buffer, &spec_len);
- if (spec_len != original_len)
- output_parsed->whitespace_removed = true;
+ spec = RemoveURLWhitespace(spec, spec_len, &whitespace_buffer, &spec_len,
+ &output_parsed->potentially_dangling_markup);
}
Parsed parsed_input;
@@ -296,11 +293,9 @@ bool DoResolveRelative(const char* base_spec,
// copying to the new buffer.
RawCanonOutputT<CHAR> whitespace_buffer;
int relative_length;
- const CHAR* relative = RemoveURLWhitespace(in_relative, in_relative_length,
- &whitespace_buffer,
- &relative_length);
- if (in_relative_length != relative_length)
- output_parsed->whitespace_removed = true;
+ const CHAR* relative = RemoveURLWhitespace(
+ in_relative, in_relative_length, &whitespace_buffer, &relative_length,
+ &output_parsed->potentially_dangling_markup);
bool base_is_authority_based = false;
bool base_is_hierarchical = false;

Powered by Google App Engine
This is Rietveld 408576698