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

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

Issue 2528813002: Fix Self-Referencing OOPIF Infinite Loop (Closed)
Patch Set: add fix to find and renderframe tests Created 4 years 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_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index 829ab711cf79ad10ed0b0030d9d537cae1c81b7d..193fec9cb890de8c55c9d7734e4b93af7412f8ae 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -434,6 +434,12 @@ void NavigationHandleImpl::WillStartRequest(
state_ = WILL_SEND_REQUEST;
complete_callback_ = callback;
+ LOG(INFO) << "Will start request";
alexmos 2016/12/28 00:25:59 Don't forget to remove the LOGs, here and below
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
+ if (isURLBlocked()) {
+ RunCompleteCallback(NavigationThrottle::CANCEL);
+ return;
+ }
+
RegisterNavigationThrottles();
if (IsBrowserSideNavigationEnabled())
@@ -447,6 +453,27 @@ void NavigationHandleImpl::WillStartRequest(
RunCompleteCallback(result);
}
+bool NavigationHandleImpl::isURLBlocked() {
+ // return false;
alexmos 2016/12/28 00:25:59 Not needed
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
+ if (url_.SchemeIs("about"))
alexmos 2016/12/28 00:25:59 Let's keep the comment about excluding about: from
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
+ return false;
+
+ // We allow one level of self-reference because some sites depend on that,
+ // but we don't allow more than one.
+ bool foundSelfReference = false;
alexmos 2016/12/28 00:25:59 nit: rename this according to Chromium style, i.e.
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
+ for (const FrameTreeNode* node = frame_tree_node_; node;
alexmos 2016/12/28 00:25:59 I think there might be a bug here, in that this sh
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
+ node = node->parent()) {
+ if (node->current_url() == url_) {
alexmos 2016/12/28 00:25:59 This also doesn't look the same as the old check.
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
+ if (foundSelfReference) {
+ LOG(INFO) << "Blocked URL: " << url_;
+ return true;
+ }
+ foundSelfReference = true;
+ }
+ }
+ return false;
+}
+
void NavigationHandleImpl::WillRedirectRequest(
const GURL& new_url,
const std::string& new_method,
@@ -471,6 +498,12 @@ void NavigationHandleImpl::WillRedirectRequest(
state_ = WILL_REDIRECT_REQUEST;
complete_callback_ = callback;
+ LOG(INFO) << "Will redirect request";
+ if (isURLBlocked()) {
+ RunCompleteCallback(NavigationThrottle::CANCEL);
alexmos 2016/12/28 00:25:59 Looking at how CheckWill(Start|Redirect)Request wo
davidsac (gone - try alexmos) 2017/01/06 00:44:57 Done.
+ return;
+ }
+
// Notify each throttle of the request.
NavigationThrottle::ThrottleCheckResult result = CheckWillRedirectRequest();

Powered by Google App Engine
This is Rietveld 408576698