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

Unified Diff: content/browser/renderer_host/resource_dispatcher_host.cc

Issue 6901128: Cancel prerenders that spawn post requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 8 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/test/data/prerender/prerender_xhr_trace.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/resource_dispatcher_host.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
index c32d8b907695b8f02805d9dcebd470ebdca10201..4b30e972daabf7e3ea17fd134362d4ca62237e00 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host.cc
@@ -411,9 +411,10 @@ void ResourceDispatcherHost::BeginRequest(
if (prerender::PrerenderManager::IsPrerenderingPossible()) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(prerender::HandlePrefetchTagOnUIThread,
+ NewRunnableFunction(prerender::HandlePrefetchTag,
resource_context.prerender_manager(),
- std::make_pair(child_id, route_id),
+ child_id,
+ route_id,
request_data.url,
referrer,
is_prerendering));
@@ -423,6 +424,20 @@ void ResourceDispatcherHost::BeginRequest(
// Otherwise, treat like a normal request, and fall-through.
}
+ // Abort any prerenders that spawn requests that use invalid HTTP methods.
+ if (is_prerendering &&
+ !prerender::PrerenderManager::IsValidHttpMethod(request_data.method)) {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(
+ prerender::DestroyPreloadForRenderView,
+ resource_context.prerender_manager(),
+ child_id,
+ route_id,
+ prerender::FINAL_STATUS_INVALID_HTTP_METHOD));
+ AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
+ return;
+ }
// Construct the event handler.
scoped_refptr<ResourceHandler> handler;
« no previous file with comments | « chrome/test/data/prerender/prerender_xhr_trace.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698