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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2814413003: Skip self-referential frame checks for POST requests. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <iterator> 7 #include <iterator>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "content/browser/appcache/appcache_navigation_handle.h" 10 #include "content/browser/appcache/appcache_navigation_handle.h"
(...skipping 957 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 // about: URLs should be exempted since they are reserved for other purposes 968 // about: URLs should be exempted since they are reserved for other purposes
969 // and cannot be the source of infinite recursion. See 969 // and cannot be the source of infinite recursion. See
970 // https://crbug.com/341858 . 970 // https://crbug.com/341858 .
971 if (url_.SchemeIs("about")) 971 if (url_.SchemeIs("about"))
972 return false; 972 return false;
973 973
974 // Browser-triggered navigations should be exempted. 974 // Browser-triggered navigations should be exempted.
975 if (!is_renderer_initiated_) 975 if (!is_renderer_initiated_)
976 return false; 976 return false;
977 977
978 // Some sites rely on constructing frame hierarchies where frames are loaded
979 // via POSTs with the same URLs, so exempt POST requests. See
980 // https://crbug.com/710008.
981 if (method_ == "POST")
982 return false;
983
978 // We allow one level of self-reference because some sites depend on that, 984 // We allow one level of self-reference because some sites depend on that,
979 // but we don't allow more than one. 985 // but we don't allow more than one.
980 bool found_self_reference = false; 986 bool found_self_reference = false;
981 for (const FrameTreeNode* node = frame_tree_node_->parent(); node; 987 for (const FrameTreeNode* node = frame_tree_node_->parent(); node;
982 node = node->parent()) { 988 node = node->parent()) {
983 if (node->current_url().EqualsIgnoringRef(url_)) { 989 if (node->current_url().EqualsIgnoringRef(url_)) {
984 if (found_self_reference) 990 if (found_self_reference)
985 return true; 991 return true;
986 found_self_reference = true; 992 found_self_reference = true;
987 } 993 }
988 } 994 }
989 return false; 995 return false;
990 } 996 }
991 997
992 } // namespace content 998 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698