Index: content/browser/download/download_resource_handler.cc |
diff --git a/content/browser/download/download_resource_handler.cc b/content/browser/download/download_resource_handler.cc |
index e06b3095e993c1939e86f1a2826efab93fb775c8..078602e2e59111f20a5de5853668f93072df5fba 100644 |
--- a/content/browser/download/download_resource_handler.cc |
+++ b/content/browser/download/download_resource_handler.cc |
@@ -129,7 +129,16 @@ bool DownloadResourceHandler::OnRequestRedirected( |
const net::RedirectInfo& redirect_info, |
ResourceResponse* response, |
bool* defer) { |
- return true; |
+ DownloadInterruptReason result = core_.OnRequestRedirected(redirect_info); |
+ if (result == DOWNLOAD_INTERRUPT_REASON_NONE) |
+ return true; |
+ |
+ // Allow the interrupt reason to propagate up the stack before we receive the |
+ // OnResponseCompleted() call. The ResourceLoader will treat this as an ABORT, |
+ // hence OnResponseCompleted() may conclude a more generic interrupt reason. |
+ // We want the specific interrupt reason to be dispatched instead. |
+ CallStartedCB(result); |
+ return false; |
} |
// Send the download creation information to the download thread. |
@@ -139,7 +148,12 @@ bool DownloadResourceHandler::OnResponseStarted( |
scoped_ptr<DownloadCreateInfo> create_info; |
scoped_ptr<ByteStreamReader> stream_reader; |
- core_.OnResponseStarted(&create_info, &stream_reader); |
+ DownloadInterruptReason result = |
+ core_.OnResponseStarted(&create_info, &stream_reader); |
+ if (result != DOWNLOAD_INTERRUPT_REASON_NONE) { |
+ CallStartedCB(result); |
+ return false; |
+ } |
const ResourceRequestInfoImpl* request_info = GetRequestInfo(); |
create_info->download_id = download_id_; |