| Index: content/browser/loader/resource_loader.cc
|
| diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
|
| index 0b3833a655ec3c9a6f44b7826de333f460f26f68..d944ea9a5e59175cca7ae78646f93242eabba6b8 100644
|
| --- a/content/browser/loader/resource_loader.cc
|
| +++ b/content/browser/loader/resource_loader.cc
|
| @@ -350,13 +350,13 @@ void ResourceLoader::OnResponseStarted(net::URLRequest* unused) {
|
|
|
| CompleteResponseStarted();
|
|
|
| - if (is_deferred())
|
| + // If the handler deferred the request, it will resume the request later. If
|
| + // the request was cancelled, the request will call back into |this| with a
|
| + // bogus read completed error.
|
| + if (is_deferred() || !request_->status().is_success())
|
| return;
|
|
|
| - if (request_->status().is_success())
|
| - StartReading(false); // Read the first chunk.
|
| - else
|
| - ResponseCompleted();
|
| + StartReading(false); // Read the first chunk.
|
| }
|
|
|
| void ResourceLoader::OnReadCompleted(net::URLRequest* unused, int bytes_read) {
|
| @@ -375,12 +375,9 @@ void ResourceLoader::OnReadCompleted(net::URLRequest* unused, int bytes_read) {
|
| CompleteRead(bytes_read);
|
|
|
| // If the handler cancelled or deferred the request, do not continue
|
| - // processing the read. If cancelled, the URLRequest has already been
|
| - // cancelled and will schedule an erroring OnReadCompleted later. If deferred,
|
| - // do nothing until resumed.
|
| - //
|
| - // Note: if bytes_read is 0 (EOF) and the handler defers, resumption will call
|
| - // ResponseCompleted().
|
| + // processing the read. If canceled, either the request will call into |this|
|
| + // with a bogus read error, or, if the request was completed, a task posted
|
| + // from ResourceLoader::CancelREquestInternal will run OnResponseCompleted.
|
| if (is_deferred() || !request_->status().is_success())
|
| return;
|
|
|
| @@ -562,7 +559,8 @@ void ResourceLoader::StartReading(bool is_continuation) {
|
| ReadMore(&bytes_read);
|
|
|
| // If IO is pending, wait for the URLRequest to call OnReadCompleted.
|
| - if (request_->status().is_io_pending())
|
| + // On error or cancellation, wait for notification of failure.
|
| + if (request_->status().is_io_pending() || !request_->status().is_success())
|
| return;
|
|
|
| if (!is_continuation || bytes_read <= 0) {
|
|
|