| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |