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

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

Issue 2687173002: [Prerender] Ignores resources with unsupported schemes for Offline reqs (Closed)
Patch Set: Created 3 years, 10 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_browsertest.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 df57aa36620930cec613afaab18205b7a9c4355b..5b35b697df8aa6afb45357291f42cc607f422fcf 100644
--- a/chrome/browser/prerender/prerender_resource_throttle.cc
+++ b/chrome/browser/prerender/prerender_resource_throttle.cc
@@ -179,13 +179,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 ORIGIN_OFFLINE, 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_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698