Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: content/browser/frame_host/navigation_request.cc

Issue 2812743002: Revert of Keep track in the browser of which frames have onunload and onbeforeunload handlers. (Closed)
Patch Set: manual merge Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6c343e60154f80e5b98e4d919150d79f18940337..ab3135bbc74f9df44173788376c21f34941c9e05 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"
@@ -315,8 +314,7 @@ NavigationRequest::NavigationRequest(
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.
@@ -668,19 +666,17 @@ void NavigationRequest::OnStartChecksComplete(
// 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.
« no previous file with comments | « content/browser/frame_host/navigation_request.h ('k') | content/browser/frame_host/navigator_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698