Commit cba7c6ed authored by avi's avatar avi Committed by Commit bot

Do not clear the favicon for an in-page navigation.

BUG=642302,28515
TEST=as in bug 642302
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation

Review-Url: https://codereview.chromium.org/2339673002
Cr-Commit-Position: refs/heads/master@{#418775}
parent 87d09290
......@@ -1212,7 +1212,7 @@ void NavigationControllerImpl::RendererDidNavigateToExistingPage(
// The redirected to page should not inherit the favicon from the previous
// page.
if (ui::PageTransitionIsRedirect(params.transition))
if (ui::PageTransitionIsRedirect(params.transition) && !is_in_page)
entry->GetFavicon() = FaviconStatus();
// The entry we found in the list might be pending if the user hit
......
......@@ -6016,4 +6016,26 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
"Referer: http://a.com:.*/form_that_posts_cross_site.html"));
}
// Check that the favicon is not cleared for navigating in-page.
IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest,
InPageNavigationDoesNotClearFavicon) {
// Load a page and fake a favicon for it.
NavigationController& controller = shell()->web_contents()->GetController();
ASSERT_TRUE(NavigateToURL(shell(), GURL("data:text/html,page1")));
content::NavigationEntry* entry = controller.GetLastCommittedEntry();
ASSERT_TRUE(entry);
content::FaviconStatus& favicon_status = entry->GetFavicon();
favicon_status.valid = true;
ASSERT_TRUE(RendererLocationReplace(shell(), GURL("data:text/html,page1#")));
entry = controller.GetLastCommittedEntry();
content::FaviconStatus& favicon_status2 = entry->GetFavicon();
EXPECT_TRUE(favicon_status2.valid);
ASSERT_TRUE(RendererLocationReplace(shell(), GURL("data:text/html,page2")));
entry = controller.GetLastCommittedEntry();
content::FaviconStatus& favicon_status3 = entry->GetFavicon();
EXPECT_FALSE(favicon_status3.valid);
}
} // namespace content
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