summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prerender
diff options
context:
space:
mode:
authorcbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-13 12:33:31 +0000
committercbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-13 12:33:31 +0000
commit88de7c35c421ad1e3cd13492960255309504afe2 (patch)
treee4d551d7b1572f5b67c6b5043091b9d2caeea8e4 /chrome/browser/prerender
parente4f864978d24e79ed3a47142c3a146d09627d0d4 (diff)
downloadchromium_src-88de7c35c421ad1e3cd13492960255309504afe2.zip
chromium_src-88de7c35c421ad1e3cd13492960255309504afe2.tar.gz
chromium_src-88de7c35c421ad1e3cd13492960255309504afe2.tar.bz2
PrerenderContents uses RESOURCE_RECEIVED_REDIRECT notification.
This removes the dependency on OnDidRedirectProvisionalLoad. I also added a number of redirect-oriented browser tests. BUG=78512 TEST=browser_tests --gtest_filter=PrerenderBrowserTest.* Review URL: http://codereview.chromium.org/6824054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81397 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prerender')
-rw-r--r--chrome/browser/prerender/prerender_browsertest.cc285
-rw-r--r--chrome/browser/prerender/prerender_contents.cc32
-rw-r--r--chrome/browser/prerender/prerender_contents.h3
3 files changed, 242 insertions, 78 deletions
diff --git a/chrome/browser/prerender/prerender_browsertest.cc b/chrome/browser/prerender/prerender_browsertest.cc
index ddc35aa..f7ed3d0 100644
--- a/chrome/browser/prerender/prerender_browsertest.cc
+++ b/chrome/browser/prerender/prerender_browsertest.cc
@@ -37,13 +37,14 @@ namespace prerender {
namespace {
-bool CreateRedirect(const std::string& dest_url, std::string* redirect_path) {
- std::vector<net::TestServer::StringPair> replacement_text;
- replacement_text.push_back(make_pair("REPLACE_WITH_URL", dest_url));
- return net::TestServer::GetFilePathWithReplacements(
- "prerender_redirect.html",
- replacement_text,
- redirect_path);
+std::string CreateClientRedirect(const std::string& dest_url) {
+ const char* const kClientRedirectBase = "client-redirect?";
+ return kClientRedirectBase + dest_url;
+}
+
+std::string CreateServerRedirect(const std::string& dest_url) {
+ const char* const kServerRedirectBase = "server-redirect?";
+ return kServerRedirectBase + dest_url;
}
// PrerenderContents that stops the UI message loop on DidStopLoading().
@@ -180,14 +181,16 @@ class PrerenderBrowserTest : public InProcessBrowserTest {
}
bool UrlIsInPrerenderManager(const std::string& html_file) {
- GURL dest_url = UrlForHtmlFile(html_file);
-
+ GURL dest_url = test_server()->GetURL(html_file);
return (prerender_manager()->FindEntry(dest_url) != NULL);
}
- bool UrlIsPendingInPrerenderManager(const std::string& html_file) {
- GURL dest_url = UrlForHtmlFile(html_file);
+ bool UrlIsInPrerenderManager(const GURL& url) {
+ return (prerender_manager()->FindEntry(url) != NULL);
+ }
+ bool UrlIsPendingInPrerenderManager(const std::string& html_file) {
+ GURL dest_url = test_server()->GetURL(html_file);
return (prerender_manager()->FindPendingEntry(dest_url) != NULL);
}
@@ -199,13 +202,15 @@ class PrerenderBrowserTest : public InProcessBrowserTest {
return TaskManager::GetInstance()->model();
}
+ void set_dest_url(const GURL& dest_url) { dest_url_ = dest_url; }
+
private:
void PrerenderTestURLImpl(
const std::string& html_file,
const std::deque<FinalStatus>& expected_final_status_queue,
int total_navigations) {
ASSERT_TRUE(test_server()->Start());
- dest_url_ = UrlForHtmlFile(html_file);
+ dest_url_ = test_server()->GetURL(html_file);
std::vector<net::TestServer::StringPair> replacement_text;
replacement_text.push_back(
@@ -278,13 +283,6 @@ class PrerenderBrowserTest : public InProcessBrowserTest {
return prerender_manager;
}
- // Non-const as test_server()->GetURL() is not const
- GURL UrlForHtmlFile(const std::string& html_file) {
- std::string dest_path = "files/prerender/";
- dest_path.append(html_file);
- return test_server()->GetURL(dest_path);
- }
-
WaitForLoadPrerenderContentsFactory* prc_factory_;
GURL dest_url_;
bool use_https_src_server_;
@@ -294,36 +292,41 @@ class PrerenderBrowserTest : public InProcessBrowserTest {
// <link rel=prefetch> tag and then loaded into a tab in response to a
// navigation.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPage) {
- PrerenderTestURL("prerender_page.html", FINAL_STATUS_USED, 1);
+ PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
NavigateToDestURL();
}
// Checks that the prerendering of a page is canceled correctly when a
// Javascript alert is called.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertBeforeOnload) {
- PrerenderTestURL("prerender_alert_before_onload.html",
- FINAL_STATUS_JAVASCRIPT_ALERT, 1);
+ PrerenderTestURL("files/prerender/prerender_alert_before_onload.html",
+ FINAL_STATUS_JAVASCRIPT_ALERT,
+ 1);
}
// Checks that the prerendering of a page is canceled correctly when a
// Javascript alert is called.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderAlertAfterOnload) {
- PrerenderTestURL("prerender_alert_after_onload.html",
- FINAL_STATUS_JAVASCRIPT_ALERT, 1);
+ PrerenderTestURL("files/prerender/prerender_alert_after_onload.html",
+ FINAL_STATUS_JAVASCRIPT_ALERT,
+ 1);
}
// Checks that plugins are not loaded while a page is being preloaded, but
// are loaded when the page is displayed.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDelayLoadPlugin) {
- PrerenderTestURL("plugin_delay_load.html", FINAL_STATUS_USED, 1);
+ PrerenderTestURL("files/prerender/plugin_delay_load.html",
+ FINAL_STATUS_USED,
+ 1);
NavigateToDestURL();
}
// Checks that plugins in an iframe are not loaded while a page is
// being preloaded, but are loaded when the page is displayed.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderIframeDelayLoadPlugin) {
- PrerenderTestURL("prerender_iframe_plugin_delay_load.html",
- FINAL_STATUS_USED, 1);
+ PrerenderTestURL("files/prerender/prerender_iframe_plugin_delay_load.html",
+ FINAL_STATUS_USED,
+ 1);
NavigateToDestURL();
}
@@ -331,43 +334,189 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderIframeDelayLoadPlugin) {
// iframe with a source that requires http authentication. This should not
// prerender successfully.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHttpAuthentication) {
- PrerenderTestURL("prerender_http_auth_container.html",
- FINAL_STATUS_AUTH_NEEDED, 1);
+ PrerenderTestURL("files/prerender/prerender_http_auth_container.html",
+ FINAL_STATUS_AUTH_NEEDED,
+ 1);
+}
+
+// Checks that client-issued redirects work with prerendering.
+// This version navigates to the page which issues the redirection, rather
+// than the final destination page.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ PrerenderClientRedirectNavigateToFirst) {
+ PrerenderTestURL(
+ CreateClientRedirect("files/prerender/prerender_page.html"),
+ FINAL_STATUS_USED,
+ 2);
+ NavigateToDestURL();
+}
+
+// Checks that client-issued redirects work with prerendering.
+// This version navigates to the final destination page, rather than the
+// page which does the redirection.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ PrerenderClientRedirectNavigateToSecond) {
+ PrerenderTestURL(
+ CreateClientRedirect("files/prerender/prerender_page.html"),
+ FINAL_STATUS_USED,
+ 2);
+ set_dest_url(test_server()->GetURL("files/prerender/prerender_page.html"));
+ NavigateToDestURL();
+}
+
+// Checks that client-issued redirects to an https page will cancel prerenders.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectToHttps) {
+ net::TestServer https_server(net::TestServer::TYPE_HTTPS,
+ FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ ASSERT_TRUE(https_server.Start());
+ GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
+ PrerenderTestURL(CreateClientRedirect(https_url.spec()),
+ FINAL_STATUS_HTTPS,
+ 1);
+}
+
+// Checks that client-issued redirects within an iframe in a prerendered
+// page will not count as an "alias" for the prerendered page.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderClientRedirectInIframe) {
+ std::string redirect_path = CreateClientRedirect(
+ "/files/prerender/prerender_embedded_content.html");
+ std::vector<net::TestServer::StringPair> replacement_text;
+ replacement_text.push_back(
+ std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
+ std::string replacement_path;
+ ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements(
+ "files/prerender/prerender_with_iframe.html",
+ replacement_text,
+ &replacement_path));
+ PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
+ EXPECT_FALSE(UrlIsInPrerenderManager(
+ "files/prerender/prerender_embedded_content.html"));
+ NavigateToDestURL();
+}
+
+// Checks that client-issued redirects within an iframe in a prerendered
+// page to an https page will not cancel the prerender, nor will it
+// count as an "alias" for the prerendered page.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ PrerenderClientRedirectToHttpsInIframe) {
+ net::TestServer https_server(net::TestServer::TYPE_HTTPS,
+ FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ ASSERT_TRUE(https_server.Start());
+ GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
+ std::string redirect_path = CreateClientRedirect(https_url.spec());
+ std::vector<net::TestServer::StringPair> replacement_text;
+ replacement_text.push_back(
+ std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
+ std::string replacement_path;
+ ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements(
+ "files/prerender/prerender_with_iframe.html",
+ replacement_text,
+ &replacement_path));
+ PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
+ EXPECT_FALSE(UrlIsInPrerenderManager(https_url));
+ NavigateToDestURL();
+}
+
+// Checks that server-issued redirects work with prerendering.
+// This version navigates to the page which issues the redirection, rather
+// than the final destination page.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ PrerenderServerRedirectNavigateToFirst) {
+ PrerenderTestURL(
+ CreateServerRedirect("files/prerender/prerender_page.html"),
+ FINAL_STATUS_USED,
+ 1);
+ NavigateToDestURL();
}
-// Checks that HTML redirects work with prerendering - specifically, checks the
-// page is used and plugins aren't loaded.
-IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRedirect) {
+// Checks that server-issued redirects work with prerendering.
+// This version navigates to the final destination page, rather than the
+// page which does the redirection.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ PrerenderServerRedirectNavigateToSecond) {
std::string redirect_path;
- ASSERT_TRUE(CreateRedirect("prerender_page.html", &redirect_path));
- PrerenderTestURL(redirect_path, FINAL_STATUS_USED, 2);
+ PrerenderTestURL(
+ CreateServerRedirect("files/prerender/prerender_page.html"),
+ FINAL_STATUS_USED,
+ 1);
+ set_dest_url(test_server()->GetURL("files/prerender/prerender_page.html"));
+ NavigateToDestURL();
+}
+
+// TODO(cbentzel): Add server-redirect-to-https test. http://crbug.com/79182
+
+// Checks that server-issued redirects within an iframe in a prerendered
+// page will not count as an "alias" for the prerendered page.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderServerRedirectInIframe) {
+ std::string redirect_path = CreateServerRedirect(
+ "/files/prerender/prerender_embedded_content.html");
+ std::vector<net::TestServer::StringPair> replacement_text;
+ replacement_text.push_back(
+ std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
+ std::string replacement_path;
+ ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements(
+ "files/prerender/prerender_with_iframe.html",
+ replacement_text,
+ &replacement_path));
+ PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
+ EXPECT_FALSE(UrlIsInPrerenderManager(
+ "files/prerender/prerender_embedded_content.html"));
+ NavigateToDestURL();
+}
+
+// Checks that server-issued redirects within an iframe in a prerendered
+// page to an https page will not cancel the prerender, nor will it
+// count as an "alias" for the prerendered page.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ PrerenderServerRedirectToHttpsInIframe) {
+ net::TestServer https_server(net::TestServer::TYPE_HTTPS,
+ FilePath(FILE_PATH_LITERAL("chrome/test/data")));
+ ASSERT_TRUE(https_server.Start());
+ GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
+ std::string redirect_path = CreateServerRedirect(https_url.spec());
+ std::vector<net::TestServer::StringPair> replacement_text;
+ replacement_text.push_back(
+ std::make_pair("REPLACE_WITH_URL", "/" + redirect_path));
+ std::string replacement_path;
+ ASSERT_TRUE(net::TestServer::GetFilePathWithReplacements(
+ "files/prerender/prerender_with_iframe.html",
+ replacement_text,
+ &replacement_path));
+ PrerenderTestURL(replacement_path, FINAL_STATUS_USED, 1);
+ EXPECT_FALSE(UrlIsInPrerenderManager(https_url));
NavigateToDestURL();
}
// Prerenders a page that contains an automatic download triggered through an
// iframe. This should not prerender successfully.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDownloadIFrame) {
- PrerenderTestURL("prerender_download_iframe.html", FINAL_STATUS_DOWNLOAD, 1);
+ PrerenderTestURL("files/prerender/prerender_download_iframe.html",
+ FINAL_STATUS_DOWNLOAD,
+ 1);
}
// Prerenders a page that contains an automatic download triggered through
// Javascript changing the window.location. This should not prerender
// successfully.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDownloadLocation) {
- std::string redirect_path;
- ASSERT_TRUE(CreateRedirect("../download-test1.lib", &redirect_path));
- PrerenderTestURL(redirect_path, FINAL_STATUS_DOWNLOAD, 1);
+ PrerenderTestURL(CreateClientRedirect("files/download-test1.lib"),
+ FINAL_STATUS_DOWNLOAD,
+ 1);
}
// Prerenders a page that contains an automatic download triggered through a
-// <meta http-equiv="refresh"> tag. This should not prerender successfully.
-IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDownloadRefresh) {
- PrerenderTestURL("prerender_download_refresh.html", FINAL_STATUS_DOWNLOAD, 1);
+// client-issued redirect. This should not prerender successfully.
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderDownloadClientRedirect) {
+ PrerenderTestURL("files/prerender/prerender_download_refresh.html",
+ FINAL_STATUS_DOWNLOAD,
+ 1);
}
// Checks that the referrer is set when prerendering.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReferrer) {
- PrerenderTestURL("prerender_referrer.html", FINAL_STATUS_USED, 1);
+ PrerenderTestURL("files/prerender/prerender_referrer.html",
+ FINAL_STATUS_USED,
+ 1);
NavigateToDestURL();
}
@@ -375,33 +524,28 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderReferrer) {
// HTTPS.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderNoSSLReferrer) {
set_use_https_src(true);
- PrerenderTestURL("prerender_no_referrer.html", FINAL_STATUS_USED, 1);
+ PrerenderTestURL("files/prerender/prerender_no_referrer.html",
+ FINAL_STATUS_USED,
+ 1);
NavigateToDestURL();
}
// Checks that popups on a prerendered page cause cancellation.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderPopup) {
- PrerenderTestURL("prerender_popup.html", FINAL_STATUS_CREATE_NEW_WINDOW, 1);
+ PrerenderTestURL("files/prerender/prerender_popup.html",
+ FINAL_STATUS_CREATE_NEW_WINDOW,
+ 1);
}
-// Test that page-based redirects to https will cancel prerenders.
-// Disabled, http://crbug.com/73580
-IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderRedirectToHttps) {
- net::TestServer https_server(net::TestServer::TYPE_HTTPS,
- FilePath(FILE_PATH_LITERAL("chrome/test/data")));
- ASSERT_TRUE(https_server.Start());
- GURL https_url = https_server.GetURL("files/prerender/prerender_page.html");
- std::string redirect_path;
- ASSERT_TRUE(CreateRedirect(https_url.spec(), &redirect_path));
- PrerenderTestURL(redirect_path, FINAL_STATUS_HTTPS, 1);
-}
+
// Checks that renderers using excessive memory will be terminated.
// Disabled, http://crbug.com/77870.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
DISABLED_PrerenderExcessiveMemory) {
- PrerenderTestURL("prerender_excessive_memory.html",
- FINAL_STATUS_MEMORY_LIMIT_EXCEEDED, 1);
+ PrerenderTestURL("files/prerender/prerender_excessive_memory.html",
+ FINAL_STATUS_MEMORY_LIMIT_EXCEEDED,
+ 1);
}
// Checks that we don't prerender in an infinite loop.
@@ -430,10 +574,14 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, DISABLED_PrerenderInfiniteLoop) {
// Checks that we don't prerender in an infinite loop and multiple links are
// handled correctly.
-IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, FLAKY_PrerenderInfiniteLoopMultiple) {
- const char* const kHtmlFileA = "prerender_infinite_a_multiple.html";
- const char* const kHtmlFileB = "prerender_infinite_b_multiple.html";
- const char* const kHtmlFileC = "prerender_infinite_c_multiple.html";
+IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
+ FLAKY_PrerenderInfiniteLoopMultiple) {
+ const char* const kHtmlFileA =
+ "files/prerender/prerender_infinite_a_multiple.html";
+ const char* const kHtmlFileB =
+ "files/prerender/prerender_infinite_b_multiple.html";
+ const char* const kHtmlFileC =
+ "files/prerender/prerender_infinite_c_multiple.html";
// We need to set the final status to expect here before starting any
// prerenders. We set them on a queue so whichever we see first is expected to
@@ -470,7 +618,7 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, TaskManager) {
// Start with two resources.
EXPECT_EQ(2, model()->ResourceCount());
- PrerenderTestURL("prerender_page.html", FINAL_STATUS_USED, 1);
+ PrerenderTestURL("files/prerender/prerender_page.html", FINAL_STATUS_USED, 1);
// The prerender makes three.
EXPECT_EQ(3, model()->ResourceCount());
@@ -492,19 +640,24 @@ IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, TaskManager) {
// Checks that prerenderers will terminate when an audio tag is encountered.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5Audio) {
- PrerenderTestURL("prerender_html5_audio.html", FINAL_STATUS_HTML5_MEDIA, 1);
+ PrerenderTestURL("files/prerender/prerender_html5_audio.html",
+ FINAL_STATUS_HTML5_MEDIA,
+ 1);
}
// Checks that prerenderers will terminate when a video tag is encountered.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5Video) {
- PrerenderTestURL("prerender_html5_video.html", FINAL_STATUS_HTML5_MEDIA, 1);
+ PrerenderTestURL("files/prerender/prerender_html5_video.html",
+ FINAL_STATUS_HTML5_MEDIA,
+ 1);
}
// Checks that prerenderers will terminate when a video tag is inserted via
// javascript.
IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderHTML5VideoJs) {
- PrerenderTestURL("prerender_html5_video_script.html",
- FINAL_STATUS_HTML5_MEDIA, 1);
+ PrerenderTestURL("files/prerender/prerender_html5_video_script.html",
+ FINAL_STATUS_HTML5_MEDIA,
+ 1);
}
} // namespace prerender
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 6051d07..8da2970 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -22,6 +22,7 @@
#include "content/browser/browsing_instance.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/resource_dispatcher_host.h"
+#include "content/browser/renderer_host/resource_request_details.h"
#include "content/browser/site_instance.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
@@ -138,6 +139,10 @@ void PrerenderContents::StartPrerendering() {
registrar_.Add(this, NotificationType::DOWNLOAD_INITIATED,
NotificationService::AllSources());
+ // Register for redirect notifications sourced from |this|.
+ registrar_.Add(this, NotificationType::RESOURCE_RECEIVED_REDIRECT,
+ Source<RenderViewHostDelegate>(this));
+
DCHECK(load_start_time_.is_null());
load_start_time_ = base::TimeTicks::Now();
@@ -322,6 +327,24 @@ void PrerenderContents::Observe(NotificationType type,
break;
}
+ case NotificationType::RESOURCE_RECEIVED_REDIRECT: {
+ // RESOURCE_RECEIVED_REDIRECT can come for any resource on a page.
+ // If it's a redirect on the top-level resource, the name needs
+ // to be remembered for future matching, and if it redirects to
+ // an https resource, it needs to be canceled. If a subresource
+ // is redirected, nothing changes.
+ DCHECK(Source<RenderViewHostDelegate>(source).ptr() == this);
+ ResourceRedirectDetails* resource_redirect_details =
+ Details<ResourceRedirectDetails>(details).ptr();
+ CHECK(resource_redirect_details);
+ if (resource_redirect_details->resource_type() ==
+ ResourceType::MAIN_FRAME) {
+ if (!AddAliasURL(resource_redirect_details->new_url()))
+ Destroy(FINAL_STATUS_HTTPS);
+ }
+ break;
+ }
+
default:
NOTREACHED() << "Unexpected notification sent.";
break;
@@ -412,8 +435,6 @@ bool PrerenderContents::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP_EX(PrerenderContents, message, message_is_ok)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame,
OnDidStartProvisionalLoadForFrame)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad,
- OnDidRedirectProvisionalLoad)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
IPC_MESSAGE_HANDLER(ViewHostMsg_MaybeCancelPrerender,
OnMaybeCancelPrerender)
@@ -441,13 +462,6 @@ void PrerenderContents::OnDidStartProvisionalLoadForFrame(int64 frame_id,
}
}
-void PrerenderContents::OnDidRedirectProvisionalLoad(int32 page_id,
- const GURL& source_url,
- const GURL& target_url) {
- if (!AddAliasURL(target_url))
- Destroy(FINAL_STATUS_HTTPS);
-}
-
void PrerenderContents::OnUpdateFaviconURL(
int32 page_id,
const std::vector<FaviconURL>& urls) {
diff --git a/chrome/browser/prerender/prerender_contents.h b/chrome/browser/prerender/prerender_contents.h
index ad94e14..541006a 100644
--- a/chrome/browser/prerender/prerender_contents.h
+++ b/chrome/browser/prerender/prerender_contents.h
@@ -208,9 +208,6 @@ class PrerenderContents : public RenderViewHostDelegate,
void OnDidStartProvisionalLoadForFrame(int64 frame_id,
bool main_frame,
const GURL& url);
- void OnDidRedirectProvisionalLoad(int32 page_id,
- const GURL& source_url,
- const GURL& target_url);
void OnUpdateFaviconURL(int32 page_id, const std::vector<FaviconURL>& urls);