Index: content/browser/loader/resource_dispatcher_host_impl.cc |
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc |
index 847f0fd5f9d82e6dd5d54a4e4db3d75360c35fde..84c79752fba4c3982399688c5565ee399077b282 100644 |
--- a/content/browser/loader/resource_dispatcher_host_impl.cc |
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
@@ -1638,12 +1638,17 @@ ResourceDispatcherHostImpl::CreateResourceHandler( |
} |
} |
+ // In prefetch mode, only let the main resource go through. |
+ bool start_detached = request_data.is_prefetch_only && |
mmenke
2016/08/23 15:11:41
|is_prefetch_only| seems confusing, given that we
|
+ request_data.resource_type != RESOURCE_TYPE_MAIN_FRAME; |
mmenke
2016/08/23 15:11:42
I'm not a fan of this MAIN_FRAME logic here. Perh
|
+ |
// Prefetches and <a ping> requests outlive their child process. |
- if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { |
+ if (!sync_result && (start_detached || |
+ IsDetachableResourceType(request_data.resource_type))) { |
handler.reset(new DetachableResourceHandler( |
request, |
base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
- std::move(handler))); |
+ start_detached ? nullptr : std::move(handler))); |
mmenke
2016/08/23 15:11:41
We need to tell the renderer the request was abort
mmenke
2016/08/23 15:11:42
Could you update the DetachableResourceHandler doc
|
} |
// PlzNavigate: If using --enable-browser-side-navigation, the |
@@ -2640,6 +2645,9 @@ int ResourceDispatcherHostImpl::BuildLoadFlagsForRequest( |
if (is_sync_load) |
load_flags |= net::LOAD_IGNORE_LIMITS; |
+ if (request_data.is_prefetch_only) |
+ load_flags |= net::LOAD_PREFETCH; |
+ |
return load_flags; |
} |