Commit 7009ded5 authored by Ehsan Karamad's avatar Ehsan Karamad Committed by Commit Bot

Fix a DCHECK in WillHandleBrowserAboutURL()

The code in FixupURL does not properly handle "about:blank" variants
where some letter in "blank" is uppercase. This CL fixes the issue by
returning "about:blank" when the lowercase of the input URL is
"about:blank".

Bug: 857201
Change-Id: Ia1ff719d142ae8f2a346cbca231e52a811e9b77c
Reviewed-on: https://chromium-review.googlesource.com/1117627Reviewed-by: default avatarEhsan Karamad <ekaramad@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Ehsan Karamad <ekaramad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571147}
parent 41fefb19
......@@ -551,10 +551,16 @@ GURL FixupURL(const std::string& text, const std::string& desired_tld) {
return GURL();
}
// Parse and rebuild about: and chrome: URLs, except about:blank.
// 'about:blank' is special-cased in various places in the code so it
// shouldn't be transformed into 'chrome://blank' as the code below will do.
// Instead, just make sure it's all lowercase, so direct string comparisons
// elsewhere will work.
if (base::LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL))
return GURL(url::kAboutBlankURL);
// Parse and rebuild about: and chrome: URLs.
bool chrome_url =
!base::LowerCaseEqualsASCII(trimmed, url::kAboutBlankURL) &&
((scheme == url::kAboutScheme) || (scheme == kChromeUIScheme));
(scheme == url::kAboutScheme) || (scheme == kChromeUIScheme);
// For some schemes whose layouts we understand, we rebuild it.
if (chrome_url ||
......
......@@ -306,6 +306,7 @@ struct FixupCase {
{"about:foo", "chrome://foo/"},
{"about:version", "chrome://version/"},
{"about:blank", "about:blank"},
{"About:blaNk", "about:blank"},
{"about:usr:pwd@hst:20/pth?qry#ref", "chrome://hst/pth?qry#ref"},
{"about://usr:pwd@hst/pth?qry#ref", "chrome://hst/pth?qry#ref"},
{"chrome:usr:pwd@hst/pth?qry#ref", "chrome://hst/pth?qry#ref"},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment