| 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "content/browser/frame_host/navigation_controller_impl.h" | 6 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 7 #include "content/browser/frame_host/navigation_entry_impl.h" | 7 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 8 #include "content/browser/frame_host/render_frame_host_manager.h" | 8 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 9 #include "content/browser/site_instance_impl.h" | 9 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 10 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 11 #include "content/common/frame_messages.h" |
| 11 #include "content/common/view_messages.h" | 12 #include "content/common/view_messages.h" |
| 12 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
| 13 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/browser/notification_source.h" | 15 #include "content/public/browser/notification_source.h" |
| 15 #include "content/public/browser/notification_types.h" | 16 #include "content/public/browser/notification_types.h" |
| 16 #include "content/public/browser/render_process_host.h" | 17 #include "content/public/browser/render_process_host.h" |
| 17 #include "content/public/browser/render_widget_host_iterator.h" | 18 #include "content/public/browser/render_widget_host_iterator.h" |
| 18 #include "content/public/browser/web_contents_delegate.h" | 19 #include "content/public/browser/web_contents_delegate.h" |
| 19 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 20 #include "content/public/browser/web_ui_controller.h" | 21 #include "content/public/browser/web_ui_controller.h" |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 967 |
| 967 // Now let's simulate the evil page calling history.back(). | 968 // Now let's simulate the evil page calling history.back(). |
| 968 contents()->OnGoToEntryAtOffset(-1); | 969 contents()->OnGoToEntryAtOffset(-1); |
| 969 // We should have a new pending RVH. | 970 // We should have a new pending RVH. |
| 970 // Note that in this case, the navigation has not committed, so evil_rvh will | 971 // Note that in this case, the navigation has not committed, so evil_rvh will |
| 971 // not be deleted yet. | 972 // not be deleted yet. |
| 972 EXPECT_NE(evil_rvh, contents()->GetRenderManagerForTesting()-> | 973 EXPECT_NE(evil_rvh, contents()->GetRenderManagerForTesting()-> |
| 973 pending_render_view_host()); | 974 pending_render_view_host()); |
| 974 | 975 |
| 975 // Before that RVH has committed, the evil page reloads itself. | 976 // Before that RVH has committed, the evil page reloads itself. |
| 976 ViewHostMsg_FrameNavigate_Params params; | 977 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 977 params.page_id = 1; | 978 params.page_id = 1; |
| 978 params.url = kUrl2; | 979 params.url = kUrl2; |
| 979 params.transition = PAGE_TRANSITION_CLIENT_REDIRECT; | 980 params.transition = PAGE_TRANSITION_CLIENT_REDIRECT; |
| 980 params.should_update_history = false; | 981 params.should_update_history = false; |
| 981 params.gesture = NavigationGestureAuto; | 982 params.gesture = NavigationGestureAuto; |
| 982 params.was_within_same_page = false; | 983 params.was_within_same_page = false; |
| 983 params.is_post = false; | 984 params.is_post = false; |
| 984 params.page_state = PageState::CreateFromURL(kUrl2); | 985 params.page_state = PageState::CreateFromURL(kUrl2); |
| 985 contents()->DidNavigate(evil_rvh, params); | 986 contents()->DidNavigate(evil_rvh, params); |
| 986 | 987 |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1336 Source<RenderWidgetHost>(host2->render_view_host())); | 1337 Source<RenderWidgetHost>(host2->render_view_host())); |
| 1337 manager->ShouldClosePage(false, true, base::TimeTicks()); | 1338 manager->ShouldClosePage(false, true, base::TimeTicks()); |
| 1338 | 1339 |
| 1339 EXPECT_TRUE( | 1340 EXPECT_TRUE( |
| 1340 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED)); | 1341 notifications.Check1AndReset(NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED)); |
| 1341 EXPECT_FALSE(manager->pending_frame_host()); | 1342 EXPECT_FALSE(manager->pending_frame_host()); |
| 1342 EXPECT_EQ(host, manager->current_frame_host()); | 1343 EXPECT_EQ(host, manager->current_frame_host()); |
| 1343 } | 1344 } |
| 1344 | 1345 |
| 1345 } // namespace content | 1346 } // namespace content |
| OLD | NEW |