Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Unified Diff: chrome/browser/prerender/prerender_resource_throttle.cc

Issue 2656653002: Suppress NEW_NAVIGATION_ENTRY prerenderer failures for ORIGIN_OFFLINE (Closed)
Patch Set: Simple cancel any subresources with unsupported schemes and continue for Offline requests Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prerender/prerender_contents.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_resource_throttle.cc
diff --git a/chrome/browser/prerender/prerender_resource_throttle.cc b/chrome/browser/prerender/prerender_resource_throttle.cc
index 8d8511e22e2fc16a1612f39e862089171ecc2afa..95bbbbd4a20970d40a925b2ae259055801823770 100644
--- a/chrome/browser/prerender/prerender_resource_throttle.cc
+++ b/chrome/browser/prerender/prerender_resource_throttle.cc
@@ -184,13 +184,18 @@ void PrerenderResourceThrottle::WillStartRequestOnUI(
cancel = true;
} else if (!PrerenderManager::DoesSubresourceURLHaveValidScheme(url) &&
resource_type != content::RESOURCE_TYPE_MAIN_FRAME) {
- // Destroying the prerender for unsupported scheme only for non-main
- // resource to allow chrome://crash to actually crash in the
- // *RendererCrash tests instead of being intercepted here. The unsupported
- // scheme for the main resource is checked in WillRedirectRequestOnUI()
- // and PrerenderContents::CheckURL(). See http://crbug.com/673771.
- prerender_contents->Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME);
- ReportUnsupportedPrerenderScheme(url);
+ // For OFFLINE_ORIGIN, simply cancel this invalid request and continue.
+ // For other origins, fail the prerender here.
+ if (prerender_contents->origin() != ORIGIN_OFFLINE) {
+ // Destroying the prerender for unsupported scheme only for non-main
+ // resource to allow chrome://crash to actually crash in the
+ // *RendererCrash tests instead of being intercepted here. The
+ // unsupported
+ // scheme for the main resource is checked in WillRedirectRequestOnUI()
+ // and PrerenderContents::CheckURL(). See http://crbug.com/673771.
+ prerender_contents->Destroy(FINAL_STATUS_UNSUPPORTED_SCHEME);
+ ReportUnsupportedPrerenderScheme(url);
+ }
cancel = true;
#if defined(OS_ANDROID)
} else if (resource_type == content::RESOURCE_TYPE_FAVICON) {
« no previous file with comments | « chrome/browser/prerender/prerender_contents.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698