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

Unified Diff: url/third_party/mozilla/url_parse.cc

Issue 2159203002: Fix inconsistent values of anchor element IDL attributes compare to other vendors Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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.h ('k') | url/url_canon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/third_party/mozilla/url_parse.cc
diff --git a/url/third_party/mozilla/url_parse.cc b/url/third_party/mozilla/url_parse.cc
index ba842b87b5db347ccc3bc5f5dccf7472ffc1aa40..ce1a604b9faece7f946fba6adacece855b98d70f 100644
--- a/url/third_party/mozilla/url_parse.cc
+++ b/url/third_party/mozilla/url_parse.cc
@@ -564,6 +564,41 @@ void DoParseMailtoURL(const CHAR* spec, int spec_len, Parsed* parsed) {
}
}
+template <typename CHAR>
+void DoParseNonStandardURL(const CHAR* spec, int spec_len, Parsed* parsed) {
+ // Get the non-scheme parts of the URL out of the way, we don't know how to
+ // interpret them.
+ parsed->username.reset();
+ parsed->password.reset();
+ parsed->host.reset();
+ parsed->port.reset();
+ parsed->path.reset();
+ parsed->query.reset();
+ parsed->ref.reset();
+
+ // Strip leading & trailing spaces and control characters.
+ int scheme_begin = 0;
+ TrimURL(spec, &scheme_begin, &spec_len);
+
+ // Handle empty specs or ones that contain only whitespace or control chars.
+ if (scheme_begin == spec_len) {
+ parsed->scheme.reset();
+ parsed->path.reset();
+ return;
+ }
+
+ // Extract the scheme. We also
+ // handle the case where there is no scheme.
+ if (ExtractScheme(&spec[scheme_begin], spec_len - scheme_begin,
+ &parsed->scheme)) {
+ // Offset the results since we gave ExtractScheme a substring.
+ parsed->scheme.begin += scheme_begin;
+ } else {
+ // No scheme case.
+ parsed->scheme.reset();
+ }
+}
+
// Converts a port number in a string to an integer. We'd like to just call
// sscanf but our input is not NULL-terminated, which sscanf requires. Instead,
// we copy the digits to a small stack buffer (since we know the maximum number
@@ -901,6 +936,14 @@ void ParseMailtoURL(const base::char16* url, int url_len, Parsed* parsed) {
DoParseMailtoURL(url, url_len, parsed);
}
+void ParseNonStandardURL(const char* url, int url_len, Parsed* parsed) {
+ DoParseNonStandardURL(url, url_len, parsed);
+}
+
+void ParseNonStandardURL(const base::char16* url, int url_len, Parsed* parsed) {
+ DoParseNonStandardURL(url, url_len, parsed);
+}
+
void ParsePathInternal(const char* spec,
const Component& path,
Component* filepath,
« no previous file with comments | « url/third_party/mozilla/url_parse.h ('k') | url/url_canon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698