diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 23:38:01 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 23:38:01 +0000 |
commit | d7749d0fe0aeaa68901948ca68db4bed531d0fee (patch) | |
tree | 67a4843ea08b53413027b7b98375578b75aec2ec | |
parent | 0a9a0fc0b5a219c5370c481f28797fe94418c564 (diff) | |
download | chromium_src-d7749d0fe0aeaa68901948ca68db4bed531d0fee.zip chromium_src-d7749d0fe0aeaa68901948ca68db4bed531d0fee.tar.gz chromium_src-d7749d0fe0aeaa68901948ca68db4bed531d0fee.tar.bz2 |
Prevent data read errors from crashing the browser.
In ResourceDispatcherHost::OnResponseStarted(), if Read() causes an error, it calls OnResponseCompleted(). For a download, this hits the NOTREACHED() in DownloadThrottlingResourceHandler::OnResponseCompleted().
This patch checks for the error status, and returns false, which causes the download to finish, which saves an empty file of size 0.
BUG=8170
Review URL: http://codereview.chromium.org/42573
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12410 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_host/download_throttling_resource_handler.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.cc b/chrome/browser/renderer_host/download_throttling_resource_handler.cc index 2e8042b..fb56384 100644 --- a/chrome/browser/renderer_host/download_throttling_resource_handler.cc +++ b/chrome/browser/renderer_host/download_throttling_resource_handler.cc @@ -104,6 +104,13 @@ bool DownloadThrottlingResourceHandler::OnResponseCompleted( if (download_handler_.get()) return download_handler_->OnResponseCompleted(request_id, status, security_info); + + // For a download, if ResourceDispatcher::Read() fails, + // ResourceDispatcher::OnresponseStarted() will call + // OnResponseCompleted(), and we will end up here with an error + // status. + if (!status.is_success()) + return false; NOTREACHED(); return true; } |