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_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
(...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 validated_params.page_state)) { | 1015 validated_params.page_state)) { |
1016 bad_message::ReceivedBadMessage( | 1016 bad_message::ReceivedBadMessage( |
1017 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); | 1017 GetProcess(), bad_message::RFH_CAN_ACCESS_FILES_OF_PAGE_STATE); |
1018 return; | 1018 return; |
1019 } | 1019 } |
1020 | 1020 |
1021 // If the URL does not match what the NavigationHandle expects, treat the | 1021 // If the URL does not match what the NavigationHandle expects, treat the |
1022 // commit as a new navigation. This can happen if an ongoing slow | 1022 // commit as a new navigation. This can happen if an ongoing slow |
1023 // same-process navigation is interrupted by a synchronous renderer-initiated | 1023 // same-process navigation is interrupted by a synchronous renderer-initiated |
1024 // navigation. | 1024 // navigation. |
1025 // TODO(csharrison): Data navigations loaded with LoadDataWithBaseURL get | |
1026 // reset here, because the NavigationHandle tracks the URL but the | |
1027 // validated_params.url tracks the data. The trick of saving the old entry ids | |
1028 // for these navigations should go away when this is properly handled. See | |
1029 // crbug.com/588317. | |
1030 int entry_id_for_data_nav = 0; | |
1031 if (navigation_handle_ && | 1025 if (navigation_handle_ && |
1032 (navigation_handle_->GetURL() != validated_params.url)) { | 1026 navigation_handle_->GetURL() != validated_params.url) { |
1033 // Make sure that the pending entry was really loaded via | |
1034 // LoadDataWithBaseURL and that it matches this handle. | |
1035 NavigationEntry* pending_entry = | |
1036 frame_tree_node()->navigator()->GetController()->GetPendingEntry(); | |
1037 bool pending_entry_matches_handle = | |
1038 pending_entry && | |
1039 pending_entry->GetUniqueID() == | |
1040 navigation_handle_->pending_nav_entry_id(); | |
1041 // TODO(csharrison): The pending entry's base url should equal | |
1042 // |validated_params.base_url|. This is not the case for loads with invalid | |
1043 // base urls. | |
1044 if (navigation_handle_->GetURL() == validated_params.base_url && | |
1045 pending_entry_matches_handle && | |
1046 !pending_entry->GetBaseURLForDataURL().is_empty()) { | |
1047 entry_id_for_data_nav = navigation_handle_->pending_nav_entry_id(); | |
1048 } | |
1049 navigation_handle_.reset(); | 1027 navigation_handle_.reset(); |
1050 } | 1028 } |
1051 | 1029 |
1052 // Synchronous renderer-initiated navigations will send a | 1030 // Synchronous renderer-initiated navigations will send a |
1053 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad | 1031 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad |
1054 // message. | 1032 // message. |
1055 if (!navigation_handle_) { | 1033 if (!navigation_handle_) { |
1056 // There is no pending NavigationEntry in these cases, so pass 0 as the | 1034 navigation_handle_ = |
1057 // nav_id. If the previous handle was a prematurely aborted navigation | 1035 NavigationHandleImpl::Create(validated_params.url, frame_tree_node_, |
1058 // loaded via LoadDataWithBaseURL, propogate the entry id. | 1036 true, // is_synchronous |
1059 navigation_handle_ = NavigationHandleImpl::Create( | 1037 validated_params.is_srcdoc, |
1060 validated_params.url, frame_tree_node_, | 1038 base::TimeTicks::Now()); |
1061 true, // is_synchronous | |
1062 validated_params.is_srcdoc, base::TimeTicks::Now(), | |
1063 entry_id_for_data_nav); | |
1064 // PlzNavigate | 1039 // PlzNavigate |
1065 if (IsBrowserSideNavigationEnabled()) { | 1040 if (IsBrowserSideNavigationEnabled()) { |
1066 // PlzNavigate: synchronous loads happen in the renderer, and the browser | 1041 // PlzNavigate: synchronous loads happen in the renderer, and the browser |
1067 // has not been notified about the start of the load yet. Do it now. | 1042 // has not been notified about the start of the load yet. Do it now. |
1068 if (!is_loading()) { | 1043 if (!is_loading()) { |
1069 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); | 1044 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); |
1070 is_loading_ = true; | 1045 is_loading_ = true; |
1071 frame_tree_node()->DidStartLoading(true, was_loading); | 1046 frame_tree_node()->DidStartLoading(true, was_loading); |
1072 } | 1047 } |
1073 pending_commit_ = false; | 1048 pending_commit_ = false; |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2634 *dst = src; | 2609 *dst = src; |
2635 | 2610 |
2636 if (src.routing_id != -1) | 2611 if (src.routing_id != -1) |
2637 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2612 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2638 | 2613 |
2639 if (src.parent_routing_id != -1) | 2614 if (src.parent_routing_id != -1) |
2640 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2615 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2641 } | 2616 } |
2642 | 2617 |
2643 } // namespace content | 2618 } // namespace content |
OLD | NEW |