PlzNavigate: fix issue with cross-site redirects to pdf
This CL prevents the MimeHandlerStreamManager from deleting its stream
if a speculative RenderFrameHost is deleted in the FrameTreeNode it is
tracking. This can happen when a navigation encounters a cross-site
redirect to a pdf document, and it had the side effect of cancelling the
URLRequest.
BUG=765780
Change-Id: Ia372bc55fa08d63bf4bb309490b0bcd8c64f7f5a
Reviewed-on: https://chromium-review.googlesource.com/675403
Reviewed-by: John Abd-El-Malek <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Commit-Queue: Camille Lamy <[email protected]>
Cr-Commit-Position: refs/heads/master@{#503463}
diff --git a/chrome/browser/chrome_navigation_browsertest.cc b/chrome/browser/chrome_navigation_browsertest.cc
index 2e2daca0..812f795 100644
--- a/chrome/browser/chrome_navigation_browsertest.cc
+++ b/chrome/browser/chrome_navigation_browsertest.cc
@@ -937,3 +937,23 @@
// commit in PlzNavigate mode.
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIVersionURL));
}
+
+// Check that a browser-initiated navigation to a cross-site URL that then
+// redirects to a pdf hosted on another site works.
+IN_PROC_BROWSER_TEST_F(ChromeNavigationBrowserTest, CrossSiteRedirectionToPDF) {
+ net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
+ https_server.AddDefaultHandlers(
+ base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ ASSERT_TRUE(https_server.Start());
+
+ GURL initial_url = embedded_test_server()->GetURL("/title1.html");
+ GURL pdf_url = embedded_test_server()->GetURL("/pdf/test.pdf");
+ GURL cross_site_redirecting_url =
+ https_server.GetURL("/server-redirect?" + pdf_url.spec());
+ ui_test_utils::NavigateToURL(browser(), initial_url);
+ ui_test_utils::NavigateToURL(browser(), cross_site_redirecting_url);
+ EXPECT_EQ(pdf_url, browser()
+ ->tab_strip_model()
+ ->GetActiveWebContents()
+ ->GetLastCommittedURL());
+}