Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1661423002: Solidify Entry discarding logic (NavigationHandle keeps its ID) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix check that's invalid when base url has invalid url. Added TODO Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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();
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 }
1027 navigation_handle_.reset(); 1049 navigation_handle_.reset();
1028 } 1050 }
1029 1051
1030 // Synchronous renderer-initiated navigations will send a 1052 // Synchronous renderer-initiated navigations will send a
1031 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad 1053 // DidCommitProvisionalLoad IPC without a prior DidStartProvisionalLoad
1032 // message. 1054 // message.
1033 if (!navigation_handle_) { 1055 if (!navigation_handle_) {
1034 navigation_handle_ = 1056 // There is no pending NavigationEntry in these cases, so pass 0 as the
1035 NavigationHandleImpl::Create(validated_params.url, frame_tree_node_, 1057 // nav_id. If the previous handle was a prematurely aborted navigation
1036 true, // is_synchronous 1058 // loaded via LoadDataWithBaseURL, propogate the entry id.
1037 validated_params.is_srcdoc, 1059 navigation_handle_ = NavigationHandleImpl::Create(
1038 base::TimeTicks::Now()); 1060 validated_params.url, frame_tree_node_,
1061 true, // is_synchronous
1062 validated_params.is_srcdoc, base::TimeTicks::Now(),
1063 entry_id_for_data_nav);
1039 // PlzNavigate 1064 // PlzNavigate
1040 if (IsBrowserSideNavigationEnabled()) { 1065 if (IsBrowserSideNavigationEnabled()) {
1041 // PlzNavigate: synchronous loads happen in the renderer, and the browser 1066 // 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. 1067 // has not been notified about the start of the load yet. Do it now.
1043 if (!is_loading()) { 1068 if (!is_loading()) {
1044 bool was_loading = frame_tree_node()->frame_tree()->IsLoading(); 1069 bool was_loading = frame_tree_node()->frame_tree()->IsLoading();
1045 is_loading_ = true; 1070 is_loading_ = true;
1046 frame_tree_node()->DidStartLoading(true, was_loading); 1071 frame_tree_node()->DidStartLoading(true, was_loading);
1047 } 1072 }
1048 pending_commit_ = false; 1073 pending_commit_ = false;
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 *dst = src; 2634 *dst = src;
2610 2635
2611 if (src.routing_id != -1) 2636 if (src.routing_id != -1)
2612 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); 2637 dst->tree_id = RoutingIDToAXTreeID(src.routing_id);
2613 2638
2614 if (src.parent_routing_id != -1) 2639 if (src.parent_routing_id != -1)
2615 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); 2640 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
2616 } 2641 }
2617 2642
2618 } // namespace content 2643 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.cc ('k') | content/public/browser/navigation_handle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698