| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 contents()->GetPendingMainFrame()->GetRenderViewHost()); | 1186 contents()->GetPendingMainFrame()->GetRenderViewHost()); |
| 1187 | 1187 |
| 1188 // Before that RFH has committed, the evil page reloads itself. | 1188 // Before that RFH has committed, the evil page reloads itself. |
| 1189 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 1189 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 1190 params.nav_entry_id = 0; | 1190 params.nav_entry_id = 0; |
| 1191 params.did_create_new_entry = false; | 1191 params.did_create_new_entry = false; |
| 1192 params.url = kUrl2; | 1192 params.url = kUrl2; |
| 1193 params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; | 1193 params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; |
| 1194 params.should_update_history = false; | 1194 params.should_update_history = false; |
| 1195 params.gesture = NavigationGestureAuto; | 1195 params.gesture = NavigationGestureAuto; |
| 1196 params.was_within_same_page = false; | 1196 params.was_within_same_document = false; |
| 1197 params.method = "GET"; | 1197 params.method = "GET"; |
| 1198 params.page_state = PageState::CreateFromURL(kUrl2); | 1198 params.page_state = PageState::CreateFromURL(kUrl2); |
| 1199 | 1199 |
| 1200 evil_rfh->SimulateNavigationStart(kUrl2); | 1200 evil_rfh->SimulateNavigationStart(kUrl2); |
| 1201 evil_rfh->SendNavigateWithParams(¶ms); | 1201 evil_rfh->SendNavigateWithParams(¶ms); |
| 1202 evil_rfh->SimulateNavigationStop(); | 1202 evil_rfh->SimulateNavigationStop(); |
| 1203 | 1203 |
| 1204 // That should NOT have cancelled the pending RFH, because the reload did | 1204 // That should NOT have cancelled the pending RFH, because the reload did |
| 1205 // not have a user gesture. Thus, the pending back navigation will still | 1205 // not have a user gesture. Thus, the pending back navigation will still |
| 1206 // eventually commit. | 1206 // eventually commit. |
| (...skipping 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2760 controller().LoadURL( | 2760 controller().LoadURL( |
| 2761 kUrlBar, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 2761 kUrlBar, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 2762 main_test_rfh()->PrepareForCommit(); | 2762 main_test_rfh()->PrepareForCommit(); |
| 2763 | 2763 |
| 2764 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2764 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 2765 params.nav_entry_id = 0; | 2765 params.nav_entry_id = 0; |
| 2766 params.did_create_new_entry = false; | 2766 params.did_create_new_entry = false; |
| 2767 params.transition = ui::PAGE_TRANSITION_LINK; | 2767 params.transition = ui::PAGE_TRANSITION_LINK; |
| 2768 params.should_update_history = false; | 2768 params.should_update_history = false; |
| 2769 params.gesture = NavigationGestureAuto; | 2769 params.gesture = NavigationGestureAuto; |
| 2770 params.was_within_same_page = false; | 2770 params.was_within_same_document = false; |
| 2771 params.method = "GET"; | 2771 params.method = "GET"; |
| 2772 params.page_state = PageState::CreateFromURL(kUrlBar); | 2772 params.page_state = PageState::CreateFromURL(kUrlBar); |
| 2773 | 2773 |
| 2774 struct TestCase { | 2774 struct TestCase { |
| 2775 const char* const url; | 2775 const char* const url; |
| 2776 const char* const origin; | 2776 const char* const origin; |
| 2777 bool mismatch; | 2777 bool mismatch; |
| 2778 } cases[] = { | 2778 } cases[] = { |
| 2779 // Positive case where the two match. | 2779 // Positive case where the two match. |
| 2780 { "http://a.com/foo.html", "http://a.com", false }, | 2780 { "http://a.com/foo.html", "http://a.com", false }, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3070 // Check that the flag for the parent's proxy to the child is reset | 3070 // Check that the flag for the parent's proxy to the child is reset |
| 3071 // when the child navigates. | 3071 // when the child navigates. |
| 3072 main_test_rfh()->GetProcess()->sink().ClearMessages(); | 3072 main_test_rfh()->GetProcess()->sink().ClearMessages(); |
| 3073 FrameHostMsg_DidCommitProvisionalLoad_Params commit_params; | 3073 FrameHostMsg_DidCommitProvisionalLoad_Params commit_params; |
| 3074 commit_params.nav_entry_id = 0; | 3074 commit_params.nav_entry_id = 0; |
| 3075 commit_params.did_create_new_entry = false; | 3075 commit_params.did_create_new_entry = false; |
| 3076 commit_params.url = kUrl3; | 3076 commit_params.url = kUrl3; |
| 3077 commit_params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 3077 commit_params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
| 3078 commit_params.should_update_history = false; | 3078 commit_params.should_update_history = false; |
| 3079 commit_params.gesture = NavigationGestureAuto; | 3079 commit_params.gesture = NavigationGestureAuto; |
| 3080 commit_params.was_within_same_page = false; | 3080 commit_params.was_within_same_document = false; |
| 3081 commit_params.method = "GET"; | 3081 commit_params.method = "GET"; |
| 3082 commit_params.page_state = PageState::CreateFromURL(kUrl3); | 3082 commit_params.page_state = PageState::CreateFromURL(kUrl3); |
| 3083 commit_params.insecure_request_policy = blink::kLeaveInsecureRequestsAlone; | 3083 commit_params.insecure_request_policy = blink::kLeaveInsecureRequestsAlone; |
| 3084 child_host->SendNavigateWithParams(&commit_params); | 3084 child_host->SendNavigateWithParams(&commit_params); |
| 3085 EXPECT_NO_FATAL_FAILURE(CheckInsecureRequestPolicyIPC( | 3085 EXPECT_NO_FATAL_FAILURE(CheckInsecureRequestPolicyIPC( |
| 3086 main_test_rfh(), blink::kLeaveInsecureRequestsAlone, | 3086 main_test_rfh(), blink::kLeaveInsecureRequestsAlone, |
| 3087 proxy_to_parent->GetRoutingID())); | 3087 proxy_to_parent->GetRoutingID())); |
| 3088 EXPECT_EQ( | 3088 EXPECT_EQ( |
| 3089 blink::kLeaveInsecureRequestsAlone, | 3089 blink::kLeaveInsecureRequestsAlone, |
| 3090 root->child_at(0)->current_replication_state().insecure_request_policy); | 3090 root->child_at(0)->current_replication_state().insecure_request_policy); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3152 ASSERT_FALSE(delete_observer.deleted()); | 3152 ASSERT_FALSE(delete_observer.deleted()); |
| 3153 EXPECT_FALSE(initial_rfh->is_active()); | 3153 EXPECT_FALSE(initial_rfh->is_active()); |
| 3154 | 3154 |
| 3155 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not | 3155 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not |
| 3156 // create a NavigationHandle. | 3156 // create a NavigationHandle. |
| 3157 initial_rfh->SimulateNavigationStart(kUrl3); | 3157 initial_rfh->SimulateNavigationStart(kUrl3); |
| 3158 EXPECT_FALSE(initial_rfh->navigation_handle()); | 3158 EXPECT_FALSE(initial_rfh->navigation_handle()); |
| 3159 } | 3159 } |
| 3160 | 3160 |
| 3161 } // namespace content | 3161 } // namespace content |
| OLD | NEW |