Commit 4b8d85c3 authored by raymes's avatar raymes Committed by Commit bot

Don't intercept Flash navigations when the current page is the Flash download page.

Currently, with HBD, if you navigate to https://get.adobe.com/flashplayer and
click "Download", it will trigger the Run Flash prompt. We should ignore
navigations if the source URL is the Flash download page itself.

BUG=656062

Review-Url: https://codereview.chromium.org/2435933002
Cr-Commit-Position: refs/heads/master@{#427005}
parent 8bcc01aa
...@@ -31,9 +31,13 @@ namespace { ...@@ -31,9 +31,13 @@ namespace {
const char kWwwPrefix[] = "www."; const char kWwwPrefix[] = "www.";
// URLs that will be intercepted with any www. prefix pruned. // The URL of the page where Flash can be downloaded.
const char kFlashDownloadURL[] = "get.adobe.com/flash";
// URLs that will be intercepted with any www. prefix pruned. These should all
// redirect to |kFlashDownloadURL|.
const char* kFlashDownloadURLs[] = { const char* kFlashDownloadURLs[] = {
"get.adobe.com/flash", "macromedia.com/go/getflashplayer", kFlashDownloadURL, "macromedia.com/go/getflashplayer",
"adobe.com/go/getflashplayer", "adobe.com/go/gntray_dl_getflashplayer"}; "adobe.com/go/getflashplayer", "adobe.com/go/gntray_dl_getflashplayer"};
void DoNothing(blink::mojom::PermissionStatus result) {} void DoNothing(blink::mojom::PermissionStatus result) {}
...@@ -89,6 +93,13 @@ bool FlashDownloadInterception::ShouldStopFlashDownloadAction( ...@@ -89,6 +93,13 @@ bool FlashDownloadInterception::ShouldStopFlashDownloadAction(
if (!has_user_gesture) if (!has_user_gesture)
return false; return false;
// If the navigation source is already the Flash download page, don't
// intercept the download. The user may be trying to download Flash.
if (base::StartsWith(source_url.GetContent(), kFlashDownloadURL,
base::CompareCase::INSENSITIVE_ASCII)) {
return false;
}
std::string target_url_str = target_url.GetContent(); std::string target_url_str = target_url.GetContent();
// Ignore www. if it's at the start of the URL. // Ignore www. if it's at the start of the URL.
if (base::StartsWith(target_url_str, kWwwPrefix, if (base::StartsWith(target_url_str, kWwwPrefix,
......
...@@ -73,6 +73,11 @@ TEST_F(FlashDownloadInterceptionTest, DownloadUrlVariations) { ...@@ -73,6 +73,11 @@ TEST_F(FlashDownloadInterceptionTest, DownloadUrlVariations) {
EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction( EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction(
host_content_settings_map(), GURL("http://source-page.com"), host_content_settings_map(), GURL("http://source-page.com"),
GURL("http://ww.macromedia.com/go/getflashplayer"), true)); GURL("http://ww.macromedia.com/go/getflashplayer"), true));
// Don't intercept navigations occurring on the flash download page.
EXPECT_FALSE(FlashDownloadInterception::ShouldStopFlashDownloadAction(
host_content_settings_map(), GURL("https://get.adobe.com/flashplayer/"),
GURL("https://get.adobe.com/flashplayer/"), true));
} }
TEST_F(FlashDownloadInterceptionTest, NavigationThrottleCancelsNavigation) { TEST_F(FlashDownloadInterceptionTest, NavigationThrottleCancelsNavigation) {
......
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