Index: content/browser/frame_host/navigation_request.cc |
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc |
index 778e2a5431b29a38b5db3218aa2dfdef3de42fa7..c4ce4b8242ceb50f2b3ec01ac65ab6402ae4a4fc 100644 |
--- a/content/browser/frame_host/navigation_request.cc |
+++ b/content/browser/frame_host/navigation_request.cc |
@@ -28,7 +28,6 @@ |
#include "content/common/appcache_interfaces.h" |
#include "content/common/resource_request_body_impl.h" |
#include "content/public/browser/browser_context.h" |
-#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/content_browser_client.h" |
#include "content/public/browser/global_request_id.h" |
#include "content/public/browser/navigation_controller.h" |
@@ -312,8 +311,7 @@ |
bindings_(NavigationEntryImpl::kInvalidBindings), |
response_should_be_rendered_(true), |
associated_site_instance_type_(AssociatedSiteInstanceType::NONE), |
- may_transfer_(may_transfer), |
- weak_factory_(this) { |
+ may_transfer_(may_transfer) { |
DCHECK(!browser_initiated || (entry != nullptr && frame_entry != nullptr)); |
// Sanitize the referrer. |
@@ -665,19 +663,17 @@ |
// Abort the request if needed. This will destroy the NavigationRequest. |
if (result == NavigationThrottle::CANCEL_AND_IGNORE || |
- result == NavigationThrottle::CANCEL || |
- result == NavigationThrottle::BLOCK_REQUEST) { |
+ result == NavigationThrottle::CANCEL) { |
// TODO(clamy): distinguish between CANCEL and CANCEL_AND_IGNORE. |
- int error_code = result == NavigationThrottle::BLOCK_REQUEST |
- ? net::ERR_BLOCKED_BY_CLIENT |
- : net::ERR_ABORTED; |
- // If the start checks completed synchronously, which could happen if there |
- // is no onbeforeunload handler, then this could cause reentrancy into |
- // NavigationController. So use a PostTask to avoid that. |
- BrowserThread::PostTask( |
- BrowserThread::UI, FROM_HERE, |
- base::Bind(&NavigationRequest::OnRequestFailed, |
- weak_factory_.GetWeakPtr(), false, error_code)); |
+ OnRequestFailed(false, net::ERR_ABORTED); |
+ |
+ // DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
+ // destroyed the NavigationRequest. |
+ return; |
+ } |
+ |
+ if (result == NavigationThrottle::BLOCK_REQUEST) { |
+ OnRequestFailed(false, net::ERR_BLOCKED_BY_CLIENT); |
// DO NOT ADD CODE after this. The previous call to OnRequestFailed has |
// destroyed the NavigationRequest. |