| Index: content/browser/loader/async_resource_handler.cc
|
| diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc
|
| index b9729f3d9aabcd95e9c01613bd06cce41c8e72bf..2e7cca55b2e7fc7bf03089e69b1b17245dff7212 100644
|
| --- a/content/browser/loader/async_resource_handler.cc
|
| +++ b/content/browser/loader/async_resource_handler.cc
|
| @@ -135,10 +135,11 @@ void AsyncResourceHandler::OnDataReceivedACK(int request_id) {
|
| bool AsyncResourceHandler::OnUploadProgress(int request_id,
|
| uint64 position,
|
| uint64 size) {
|
| - ResourceMessageFilter* filter = GetFilter();
|
| - if (!filter)
|
| - return false;
|
| - return filter->Send(
|
| + const ResourceRequestInfoImpl* info = GetRequestInfo();
|
| + // Cancel the request if the renderer is gone unless it's detachable.
|
| + if (!info->filter())
|
| + return info->is_detached();
|
| + return info->filter()->Send(
|
| new ResourceMsg_UploadProgress(request_id, position, size));
|
| }
|
|
|
| @@ -147,8 +148,9 @@ bool AsyncResourceHandler::OnRequestRedirected(int request_id,
|
| ResourceResponse* response,
|
| bool* defer) {
|
| const ResourceRequestInfoImpl* info = GetRequestInfo();
|
| + // Cancel the request if the renderer is gone unless it's detached.
|
| if (!info->filter())
|
| - return false;
|
| + return info->is_detached();
|
|
|
| *defer = did_defer_ = true;
|
|
|
| @@ -172,10 +174,11 @@ bool AsyncResourceHandler::OnResponseStarted(int request_id,
|
| // renderer will be able to set these precisely at the time the
|
| // request commits, avoiding the possibility of e.g. zooming the old content
|
| // or of having to layout the new content twice.
|
| -
|
| const ResourceRequestInfoImpl* info = GetRequestInfo();
|
| +
|
| + // Cancel the request if the renderer is gone unless it's detachable.
|
| if (!info->filter())
|
| - return false;
|
| + return info->is_detached();
|
|
|
| if (rdh_->delegate()) {
|
| rdh_->delegate()->OnResponseStarted(
|
| @@ -248,9 +251,19 @@ bool AsyncResourceHandler::OnReadCompleted(int request_id, int bytes_read,
|
| if (!bytes_read)
|
| return true;
|
|
|
| + const ResourceRequestInfoImpl* info = GetRequestInfo();
|
| + // Don't send any data if the resource is detached from the renderer.
|
| + if (info->is_detached()) {
|
| + buffer_->RecycleLeastRecentlyAllocated();
|
| + return true;
|
| + }
|
| +
|
| ResourceMessageFilter* filter = GetFilter();
|
| - if (!filter)
|
| + // Cancel the request if the renderer is gone.
|
| + if (!filter) {
|
| + DCHECK(!info->is_detachable());
|
| return false;
|
| + }
|
|
|
| buffer_->ShrinkLastAllocation(bytes_read);
|
|
|
| @@ -309,8 +322,10 @@ bool AsyncResourceHandler::OnResponseCompleted(
|
| const net::URLRequestStatus& status,
|
| const std::string& security_info) {
|
| const ResourceRequestInfoImpl* info = GetRequestInfo();
|
| +
|
| + // Cancel the request if the renderer is gone unless it's detachable.
|
| if (!info->filter())
|
| - return false;
|
| + return info->is_detachable();
|
|
|
| // If we crash here, figure out what URL the renderer was requesting.
|
| // http://crbug.com/107692
|
|
|