Commit add34e96 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios/web] Don't dcheck when rewriting placeholder URLs.

about:blank?query URLs are expected after fixup.

Change-Id: I155245731e7f3623e7f27ad8ba76ddb4cc55fc53
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1582960
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Auto-Submit: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658731}
parent 2b55d74d
...@@ -36,7 +36,10 @@ bool WillHandleWebBrowserAboutURL(GURL* url, web::BrowserState* browser_state) { ...@@ -36,7 +36,10 @@ bool WillHandleWebBrowserAboutURL(GURL* url, web::BrowserState* browser_state) {
*url = url_formatter::FixupURL(url->possibly_invalid_spec(), std::string()); *url = url_formatter::FixupURL(url->possibly_invalid_spec(), std::string());
// Check that about: URLs are fixed up to chrome: by url_formatter::FixupURL. // Check that about: URLs are fixed up to chrome: by url_formatter::FixupURL.
DCHECK((*url == url::kAboutBlankURL) || !url->SchemeIs(url::kAboutScheme)); // 'about:blank' is special-cased in various places in the code so it
// shouldn't be transformed.
DCHECK(!url->SchemeIs(url::kAboutScheme) ||
(url->path() == url::kAboutBlankPath));
// url_formatter::FixupURL translates about:foo into chrome://foo/. // url_formatter::FixupURL translates about:foo into chrome://foo/.
if (!url->SchemeIs(kChromeUIScheme)) if (!url->SchemeIs(kChromeUIScheme))
......
...@@ -20,7 +20,8 @@ TEST_F(BrowserAboutRewriterTest, NtpTest) { ...@@ -20,7 +20,8 @@ TEST_F(BrowserAboutRewriterTest, NtpTest) {
EXPECT_FALSE(WillHandleWebBrowserAboutURL(&url, nil)); EXPECT_FALSE(WillHandleWebBrowserAboutURL(&url, nil));
} }
// Test that about|chrome://about is rewritten to chrome-urls. // Test that about|chrome://about is rewritten to chrome-urls and about:blank
// is not.
TEST_F(BrowserAboutRewriterTest, AboutTest) { TEST_F(BrowserAboutRewriterTest, AboutTest) {
GURL url = GURL("about:about"); GURL url = GURL("about:about");
EXPECT_FALSE(WillHandleWebBrowserAboutURL(&url, /*browser_state=*/nullptr)); EXPECT_FALSE(WillHandleWebBrowserAboutURL(&url, /*browser_state=*/nullptr));
...@@ -29,6 +30,10 @@ TEST_F(BrowserAboutRewriterTest, AboutTest) { ...@@ -29,6 +30,10 @@ TEST_F(BrowserAboutRewriterTest, AboutTest) {
url = GURL("chrome://about/"); url = GURL("chrome://about/");
EXPECT_FALSE(WillHandleWebBrowserAboutURL(&url, /*browser_state=*/nullptr)); EXPECT_FALSE(WillHandleWebBrowserAboutURL(&url, /*browser_state=*/nullptr));
EXPECT_EQ(url, GURL("chrome://chrome-urls/")); EXPECT_EQ(url, GURL("chrome://chrome-urls/"));
url = GURL("about:blank?for=");
EXPECT_FALSE(WillHandleWebBrowserAboutURL(&url, /*browser_state=*/nullptr));
EXPECT_EQ(url, GURL("about:blank?for="));
} }
// Test that about|chrome://sync is rewritten to sync-internals. // Test that about|chrome://sync is rewritten to sync-internals.
......
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