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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1163 | 1163 |
1164 // Navigate to a safe site, then an evil site. | 1164 // Navigate to a safe site, then an evil site. |
1165 // This will switch RenderFrameHosts. We cannot assert that the first and | 1165 // This will switch RenderFrameHosts. We cannot assert that the first and |
1166 // second RFHs are different, though, because the first one may be promptly | 1166 // second RFHs are different, though, because the first one may be promptly |
1167 // deleted. | 1167 // deleted. |
1168 contents()->NavigateAndCommit(kUrl1); | 1168 contents()->NavigateAndCommit(kUrl1); |
1169 contents()->NavigateAndCommit(kUrl2); | 1169 contents()->NavigateAndCommit(kUrl2); |
1170 TestRenderFrameHost* evil_rfh = contents()->GetMainFrame(); | 1170 TestRenderFrameHost* evil_rfh = contents()->GetMainFrame(); |
1171 | 1171 |
1172 // Now let's simulate the evil page calling history.back(). | 1172 // Now let's simulate the evil page calling history.back(). |
1173 contents()->OnGoToEntryAtOffset(-1); | 1173 contents()->OnGoToEntryAtOffset(evil_rfh->GetRenderViewHost(), -1); |
1174 contents()->GetMainFrame()->PrepareForCommit(); | 1174 contents()->GetMainFrame()->PrepareForCommit(); |
1175 // We should have a new pending RFH. | 1175 // We should have a new pending RFH. |
1176 // Note that in this case, the navigation has not committed, so evil_rfh will | 1176 // Note that in this case, the navigation has not committed, so evil_rfh will |
1177 // not be deleted yet. | 1177 // not be deleted yet. |
1178 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); | 1178 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); |
1179 EXPECT_NE(evil_rfh->GetRenderViewHost(), | 1179 EXPECT_NE(evil_rfh->GetRenderViewHost(), |
1180 contents()->GetPendingMainFrame()->GetRenderViewHost()); | 1180 contents()->GetPendingMainFrame()->GetRenderViewHost()); |
1181 | 1181 |
1182 // Before that RFH has committed, the evil page reloads itself. | 1182 // Before that RFH has committed, the evil page reloads itself. |
1183 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 1183 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
(...skipping 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3148 ASSERT_FALSE(delete_observer.deleted()); | 3148 ASSERT_FALSE(delete_observer.deleted()); |
3149 EXPECT_FALSE(initial_rfh->is_active()); | 3149 EXPECT_FALSE(initial_rfh->is_active()); |
3150 | 3150 |
3151 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not | 3151 // The initial RFH receives a DidStartProvisionalLoad IPC. It should not |
3152 // create a NavigationHandle. | 3152 // create a NavigationHandle. |
3153 initial_rfh->SimulateNavigationStart(kUrl3); | 3153 initial_rfh->SimulateNavigationStart(kUrl3); |
3154 EXPECT_FALSE(initial_rfh->navigation_handle()); | 3154 EXPECT_FALSE(initial_rfh->navigation_handle()); |
3155 } | 3155 } |
3156 | 3156 |
3157 } // namespace content | 3157 } // namespace content |
OLD | NEW |