Index: content/browser/loader/cross_site_resource_handler_browsertest.cc |
diff --git a/content/browser/loader/cross_site_resource_handler_browsertest.cc b/content/browser/loader/cross_site_resource_handler_browsertest.cc |
index a6df689d032693e6930450e01ee57d234f1fb782..dd26035eb83727dc44989f3b04d8eb92d6387b30 100644 |
--- a/content/browser/loader/cross_site_resource_handler_browsertest.cc |
+++ b/content/browser/loader/cross_site_resource_handler_browsertest.cc |
@@ -97,7 +97,8 @@ class TestResourceDispatcherHostDelegate |
CallbackRunningResourceThrottle(net::URLRequest* request, |
TestResourceDispatcherHostDelegate* tracker, |
const RequestDeferredHook& run_on_start) |
- : request_(request), |
+ : resumed_(false), |
+ request_(request), |
tracker_(tracker), |
run_on_start_(run_on_start), |
weak_factory_(this) {} |
@@ -116,9 +117,12 @@ class TestResourceDispatcherHostDelegate |
~CallbackRunningResourceThrottle() override { |
// If the request is deleted without being cancelled, its status will |
// indicate it succeeded, so have to check if the request is still pending |
- // as well. |
+ // as well. If the request never even started, the throttle will never |
+ // resume it. Check this condition as well to allow for early |
+ // cancellation. |
tracker_->OnTrackedRequestDestroyed(!request_->is_pending() && |
- request_->status().is_success()); |
+ request_->status().is_success() && |
+ resumed_); |
} |
// ResourceThrottle implementation: |
@@ -127,7 +131,12 @@ class TestResourceDispatcherHostDelegate |
} |
private: |
- void Resume() { controller()->Resume(); } |
+ void Resume() { |
+ resumed_ = true; |
+ controller()->Resume(); |
+ } |
+ |
+ bool resumed_; |
net::URLRequest* request_; |
TestResourceDispatcherHostDelegate* tracker_; |
RequestDeferredHook run_on_start_; |