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; | |
1025 if (navigation_handle_ && | 1031 if (navigation_handle_ && |
1026 navigation_handle_->GetURL() != validated_params.url) { | 1032 (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(); | |
Charlie Reis
2016/02/25 22:22:33
I take it there's a pending entry in these cases?
Charlie Harrison
2016/02/26 17:39:51
I believe there will always be a pending entry for
| |
1037 bool pending_entry_matches_handle = | |
1038 pending_entry && | |
1039 pending_entry->GetUniqueID() == | |
1040 navigation_handle_->pending_nav_entry_id(); | |
1041 if (navigation_handle_->GetURL() == validated_params.base_url && | |
1042 pending_entry_matches_handle && | |
1043 !pending_entry->GetBaseURLForDataURL().is_empty()) { | |
Charlie Reis
2016/02/25 22:22:33
Should this be checking if pending_entry->GetBaseU
Charlie Harrison
2016/02/26 17:39:51
Yep. Done.
| |
1044 entry_id_for_data_nav = navigation_handle_->pending_nav_entry_id(); | |
1045 } | |
1027 navigation_handle_.reset(); | 1046 navigation_handle_.reset(); |
1028 } | 1047 } |
1029 | 1048 |
1030 // Synchronous renderer-initiated navigations will send a | 1049 // Synchronous renderer-initiated navigations will send a |
1031 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad | 1050 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad |
1032 // message. | 1051 // message. |
1033 if (!navigation_handle_) { | 1052 if (!navigation_handle_) { |
1034 navigation_handle_ = | 1053 // There is no pending NavigationEntry in these cases, so pass 0 as the |
1035 NavigationHandleImpl::Create(validated_params.url, frame_tree_node_, | 1054 // nav_id. If the previous handle was a prematurely aborted navigation |
1036 true, // is_synchronous | 1055 // loaded via LoadDataWithBaseURL, propogate the entry id. |
1037 validated_params.is_srcdoc, | 1056 navigation_handle_ = NavigationHandleImpl::Create( |
1038 base::TimeTicks::Now()); | 1057 validated_params.url, frame_tree_node_, |
1058 true, // is_synchronous | |
1059 validated_params.is_srcdoc, base::TimeTicks::Now(), | |
1060 entry_id_for_data_nav); | |
1039 // PlzNavigate | 1061 // PlzNavigate |
1040 if (IsBrowserSideNavigationEnabled()) { | 1062 if (IsBrowserSideNavigationEnabled()) { |
1041 // PlzNavigate: synchronous loads happen in the renderer, and the browser | 1063 // PlzNavigate: synchronous loads happen in the renderer, and the browser |
1042 // has not been notified about the start of the load yet. Do it now. | 1064 // has not been notified about the start of the load yet. Do it now. |
1043 if (!is_loading()) { | 1065 if (!is_loading()) { |
1044 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); | 1066 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); |
1045 is_loading_ = true; | 1067 is_loading_ = true; |
1046 frame_tree_node()->DidStartLoading(true, was_loading); | 1068 frame_tree_node()->DidStartLoading(true, was_loading); |
1047 } | 1069 } |
1048 pending_commit_ = false; | 1070 pending_commit_ = false; |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2599 *dst = src; | 2621 *dst = src; |
2600 | 2622 |
2601 if (src.routing_id != -1) | 2623 if (src.routing_id != -1) |
2602 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); | 2624 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); |
2603 | 2625 |
2604 if (src.parent_routing_id != -1) | 2626 if (src.parent_routing_id != -1) |
2605 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); | 2627 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); |
2606 } | 2628 } |
2607 | 2629 |
2608 } // namespace content | 2630 } // namespace content |
OLD | NEW |