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 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 // about: URLs should be exempted since they are reserved for other purposes | 940 // about: URLs should be exempted since they are reserved for other purposes |
941 // and cannot be the source of infinite recursion. See | 941 // and cannot be the source of infinite recursion. See |
942 // https://crbug.com/341858 . | 942 // https://crbug.com/341858 . |
943 if (url_.SchemeIs("about")) | 943 if (url_.SchemeIs("about")) |
944 return false; | 944 return false; |
945 | 945 |
946 // Browser-triggered navigations should be exempted. | 946 // Browser-triggered navigations should be exempted. |
947 if (!is_renderer_initiated_) | 947 if (!is_renderer_initiated_) |
948 return false; | 948 return false; |
949 | 949 |
| 950 // Some sites rely on constructing frame hierarchies where frames are loaded |
| 951 // via POSTs with the same URLs, so exempt POST requests. See |
| 952 // https://crbug.com/710008. |
| 953 if (method_ == "POST") |
| 954 return false; |
| 955 |
950 // We allow one level of self-reference because some sites depend on that, | 956 // We allow one level of self-reference because some sites depend on that, |
951 // but we don't allow more than one. | 957 // but we don't allow more than one. |
952 bool found_self_reference = false; | 958 bool found_self_reference = false; |
953 for (const FrameTreeNode* node = frame_tree_node_->parent(); node; | 959 for (const FrameTreeNode* node = frame_tree_node_->parent(); node; |
954 node = node->parent()) { | 960 node = node->parent()) { |
955 if (node->current_url().EqualsIgnoringRef(url_)) { | 961 if (node->current_url().EqualsIgnoringRef(url_)) { |
956 if (found_self_reference) | 962 if (found_self_reference) |
957 return true; | 963 return true; |
958 found_self_reference = true; | 964 found_self_reference = true; |
959 } | 965 } |
960 } | 966 } |
961 return false; | 967 return false; |
962 } | 968 } |
963 | 969 |
964 } // namespace content | 970 } // namespace content |
OLD | NEW |