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

Unified Diff: url/url_util.cc

Issue 2644133002: Do not sanitize about:blank/#foo & about:blank?foo (Closed)
Patch Set: Addressed comments Created 3 years, 11 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
« url/url_util.h ('K') | « url/url_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: url/url_util.cc
diff --git a/url/url_util.cc b/url/url_util.cc
index 2c8d6978cb72c5c7665135bcd9d7a36e7941be77..deb54143f4b4265dcf915ac065a01648287113a8 100644
--- a/url/url_util.cc
+++ b/url/url_util.cc
@@ -608,6 +608,21 @@ bool IsReferrerScheme(const char* spec, const Component& scheme) {
return DoIsInSchemes(spec, scheme, &unused_scheme_type, *referrer_schemes);
}
+bool IsAboutBlankURL(const GURL& url) {
+ if (!url.SchemeIs(url::kAboutScheme))
+ return false;
+
+ if (url.has_host() || url.has_username() || url.has_password() ||
+ url.has_port()) {
+ return false;
+ }
+
+ if (url.path() != kAboutBlankPath && url.path() != kAboutBlankWithHashPath)
+ return false;
+
+ return true;
Mike West 2017/01/20 12:57:56 There's enough logic here that adding tests seems
clamy 2017/01/20 13:19:28 Done. Let me know if you think I should add anothe
+}
+
bool FindAndCompareScheme(const char* str,
int str_len,
const char* compare,
« url/url_util.h ('K') | « url/url_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698