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

Unified Diff: content/browser/loader/navigation_resource_throttle.cc

Issue 2321503002: (Re-)introduce AncestorThrottle to handle 'X-Frame-Options'. (Closed)
Patch Set: Rebase after a month... Created 4 years, 2 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/loader/navigation_resource_throttle.cc
diff --git a/content/browser/loader/navigation_resource_throttle.cc b/content/browser/loader/navigation_resource_throttle.cc
index e9c8e269d89405ca9380261f521ff1c5ebf18797..2a6aa9f3764ff6820f17b1a40aac3dfd04b144c6 100644
--- a/content/browser/loader/navigation_resource_throttle.cc
+++ b/content/browser/loader/navigation_resource_throttle.cc
@@ -343,6 +343,16 @@ void NavigationResourceThrottle::OnUIChecksPerformed(
controller()->Cancel();
} else if (result == NavigationThrottle::BLOCK_REQUEST) {
controller()->CancelWithError(net::ERR_BLOCKED_BY_CLIENT);
+ } else if (result == NavigationThrottle::BLOCK_RESPONSE) {
+ // TODO(mkwst): If we cancel the main frame request with anything other than
+ // 'net::ERR_ABORTED', we'll trigger some special behavior that might not be
+ // desirable here (non-POSTs will reload the page, while POST has some logic
+ // around reloading to avoid duplicating actions server-side). For the
+ // moment, only child frame navigations should be blocked. If we need to
+ // block main frame navigations in the future, we'll need to carefully
+ // consider the right thing to do here.
+ DCHECK(!ResourceRequestInfo::ForRequest(request_)->IsMainFrame());
+ controller()->CancelWithError(net::ERR_BLOCKED_BY_RESPONSE);
} else {
controller()->Resume();
}
« no previous file with comments | « content/browser/frame_host/navigation_handle_impl_unittest.cc ('k') | content/browser/site_per_process_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698