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

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

Issue 1907443006: PlzNavigate: store POST data in the FrameNavigationEntry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 /* 5 /*
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 730
731 // Update the FTN ID to use below in case we found a named frame. 731 // Update the FTN ID to use below in case we found a named frame.
732 frame_tree_node_id = node->frame_tree_node_id(); 732 frame_tree_node_id = node->frame_tree_node_id();
733 733
734 // In --site-per-process, create an identical NavigationEntry with a 734 // In --site-per-process, create an identical NavigationEntry with a
735 // new FrameNavigationEntry for the target subframe. 735 // new FrameNavigationEntry for the target subframe.
736 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 736 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
737 entry = GetLastCommittedEntry()->Clone(); 737 entry = GetLastCommittedEntry()->Clone();
738 entry->SetPageID(-1); 738 entry->SetPageID(-1);
739 entry->AddOrUpdateFrameEntry(node, "", -1, -1, nullptr, params.url, 739 entry->AddOrUpdateFrameEntry(node, "", -1, -1, nullptr, params.url,
740 params.referrer, PageState(), "GET", -1); 740 params.referrer, PageState(), "GET", -1,
741 nullptr);
741 } 742 }
742 } 743 }
743 } 744 }
744 745
745 // Otherwise, create a pending entry for the main frame. 746 // Otherwise, create a pending entry for the main frame.
746 if (!entry) { 747 if (!entry) {
747 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( 748 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry(
748 params.url, params.referrer, params.transition_type, 749 params.url, params.referrer, params.transition_type,
749 params.is_renderer_initiated, params.extra_headers, browser_context_)); 750 params.is_renderer_initiated, params.extra_headers, browser_context_));
750 } 751 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
798 799
799 bool NavigationControllerImpl::PendingEntryMatchesHandle( 800 bool NavigationControllerImpl::PendingEntryMatchesHandle(
800 NavigationHandleImpl* handle) const { 801 NavigationHandleImpl* handle) const {
801 return pending_entry_ && 802 return pending_entry_ &&
802 pending_entry_->GetUniqueID() == handle->pending_nav_entry_id(); 803 pending_entry_->GetUniqueID() == handle->pending_nav_entry_id();
803 } 804 }
804 805
805 bool NavigationControllerImpl::RendererDidNavigate( 806 bool NavigationControllerImpl::RendererDidNavigate(
806 RenderFrameHostImpl* rfh, 807 RenderFrameHostImpl* rfh,
807 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 808 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
808 LoadCommittedDetails* details) { 809 LoadCommittedDetails* details,
810 scoped_refptr<ResourceRequestBody> post_data) {
809 is_initial_navigation_ = false; 811 is_initial_navigation_ = false;
810 812
811 // Save the previous state before we clobber it. 813 // Save the previous state before we clobber it.
812 if (GetLastCommittedEntry()) { 814 if (GetLastCommittedEntry()) {
813 details->previous_url = GetLastCommittedEntry()->GetURL(); 815 details->previous_url = GetLastCommittedEntry()->GetURL();
814 details->previous_entry_index = GetLastCommittedEntryIndex(); 816 details->previous_entry_index = GetLastCommittedEntryIndex();
815 } else { 817 } else {
816 details->previous_url = GURL(); 818 details->previous_url = GURL();
817 details->previous_entry_index = -1; 819 details->previous_entry_index = -1;
818 } 820 }
(...skipping 12 matching lines...) Expand all
831 833
832 // Do navigation-type specific actions. These will make and commit an entry. 834 // Do navigation-type specific actions. These will make and commit an entry.
833 details->type = ClassifyNavigation(rfh, params); 835 details->type = ClassifyNavigation(rfh, params);
834 836
835 // is_in_page must be computed before the entry gets committed. 837 // is_in_page must be computed before the entry gets committed.
836 details->is_in_page = IsURLInPageNavigation( 838 details->is_in_page = IsURLInPageNavigation(
837 params.url, params.was_within_same_page, rfh); 839 params.url, params.was_within_same_page, rfh);
838 840
839 switch (details->type) { 841 switch (details->type) {
840 case NAVIGATION_TYPE_NEW_PAGE: 842 case NAVIGATION_TYPE_NEW_PAGE:
841 RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry); 843 RendererDidNavigateToNewPage(rfh, params, details->did_replace_entry,
844 post_data);
842 break; 845 break;
843 case NAVIGATION_TYPE_EXISTING_PAGE: 846 case NAVIGATION_TYPE_EXISTING_PAGE:
844 details->did_replace_entry = details->is_in_page; 847 details->did_replace_entry = details->is_in_page;
845 RendererDidNavigateToExistingPage(rfh, params); 848 RendererDidNavigateToExistingPage(rfh, params, post_data);
846 break; 849 break;
847 case NAVIGATION_TYPE_SAME_PAGE: 850 case NAVIGATION_TYPE_SAME_PAGE:
848 RendererDidNavigateToSamePage(rfh, params); 851 RendererDidNavigateToSamePage(rfh, params, post_data);
849 break; 852 break;
850 case NAVIGATION_TYPE_NEW_SUBFRAME: 853 case NAVIGATION_TYPE_NEW_SUBFRAME:
851 RendererDidNavigateNewSubframe(rfh, params, details->did_replace_entry); 854 RendererDidNavigateNewSubframe(rfh, params, details->did_replace_entry,
855 post_data);
852 break; 856 break;
853 case NAVIGATION_TYPE_AUTO_SUBFRAME: 857 case NAVIGATION_TYPE_AUTO_SUBFRAME:
854 if (!RendererDidNavigateAutoSubframe(rfh, params)) 858 if (!RendererDidNavigateAutoSubframe(rfh, params, post_data))
855 return false; 859 return false;
856 break; 860 break;
857 case NAVIGATION_TYPE_NAV_IGNORE: 861 case NAVIGATION_TYPE_NAV_IGNORE:
858 // If a pending navigation was in progress, this canceled it. We should 862 // If a pending navigation was in progress, this canceled it. We should
859 // discard it and make sure it is removed from the URL bar. After that, 863 // discard it and make sure it is removed from the URL bar. After that,
860 // there is nothing we can do with this navigation, so we just return to 864 // there is nothing we can do with this navigation, so we just return to
861 // the caller that nothing has happened. 865 // the caller that nothing has happened.
862 if (pending_entry_) { 866 if (pending_entry_) {
863 DiscardNonCommittedEntries(); 867 DiscardNonCommittedEntries();
864 delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); 868 delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_URL);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 } 1064 }
1061 1065
1062 // Since we weeded out "new" navigations above, we know this is an existing 1066 // Since we weeded out "new" navigations above, we know this is an existing
1063 // (back/forward) navigation. 1067 // (back/forward) navigation.
1064 return NAVIGATION_TYPE_EXISTING_PAGE; 1068 return NAVIGATION_TYPE_EXISTING_PAGE;
1065 } 1069 }
1066 1070
1067 void NavigationControllerImpl::RendererDidNavigateToNewPage( 1071 void NavigationControllerImpl::RendererDidNavigateToNewPage(
1068 RenderFrameHostImpl* rfh, 1072 RenderFrameHostImpl* rfh,
1069 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 1073 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
1070 bool replace_entry) { 1074 bool replace_entry,
1075 scoped_refptr<ResourceRequestBody> post_data) {
1071 std::unique_ptr<NavigationEntryImpl> new_entry; 1076 std::unique_ptr<NavigationEntryImpl> new_entry;
1072 bool update_virtual_url; 1077 bool update_virtual_url;
1073 // Only make a copy of the pending entry if it is appropriate for the new page 1078 // Only make a copy of the pending entry if it is appropriate for the new page
1074 // that was just loaded. Verify this by checking if the entry corresponds 1079 // that was just loaded. Verify this by checking if the entry corresponds
1075 // to the current navigation handle. Note that in some tests the render frame 1080 // to the current navigation handle. Note that in some tests the render frame
1076 // host does not have a valid handle. Additionally, coarsely check that: 1081 // host does not have a valid handle. Additionally, coarsely check that:
1077 // 1. The SiteInstance hasn't been assigned to something else. 1082 // 1. The SiteInstance hasn't been assigned to something else.
1078 // 2. The pending entry was intended as a new entry, rather than being a 1083 // 2. The pending entry was intended as a new entry, rather than being a
1079 // history navigation that was interrupted by an unrelated, 1084 // history navigation that was interrupted by an unrelated,
1080 // renderer-initiated navigation. 1085 // renderer-initiated navigation.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1124 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent); 1129 new_entry->SetIsOverridingUserAgent(params.is_overriding_user_agent);
1125 1130
1126 // Update the FrameNavigationEntry for new main frame commits. 1131 // Update the FrameNavigationEntry for new main frame commits.
1127 FrameNavigationEntry* frame_entry = 1132 FrameNavigationEntry* frame_entry =
1128 new_entry->GetFrameEntry(rfh->frame_tree_node()); 1133 new_entry->GetFrameEntry(rfh->frame_tree_node());
1129 frame_entry->set_frame_unique_name(params.frame_unique_name); 1134 frame_entry->set_frame_unique_name(params.frame_unique_name);
1130 frame_entry->set_item_sequence_number(params.item_sequence_number); 1135 frame_entry->set_item_sequence_number(params.item_sequence_number);
1131 frame_entry->set_document_sequence_number(params.document_sequence_number); 1136 frame_entry->set_document_sequence_number(params.document_sequence_number);
1132 frame_entry->set_method(params.method); 1137 frame_entry->set_method(params.method);
1133 frame_entry->set_post_id(params.post_id); 1138 frame_entry->set_post_id(params.post_id);
1139 frame_entry->set_post_data(post_data);
1134 1140
1135 // history.pushState() is classified as a navigation to a new page, but 1141 // history.pushState() is classified as a navigation to a new page, but
1136 // sets was_within_same_page to true. In this case, we already have the 1142 // sets was_within_same_page to true. In this case, we already have the
1137 // title and favicon available, so set them immediately. 1143 // title and favicon available, so set them immediately.
1138 if (params.was_within_same_page && GetLastCommittedEntry()) { 1144 if (params.was_within_same_page && GetLastCommittedEntry()) {
1139 new_entry->SetTitle(GetLastCommittedEntry()->GetTitle()); 1145 new_entry->SetTitle(GetLastCommittedEntry()->GetTitle());
1140 new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon(); 1146 new_entry->GetFavicon() = GetLastCommittedEntry()->GetFavicon();
1141 } 1147 }
1142 1148
1143 DCHECK(!params.history_list_was_cleared || !replace_entry); 1149 DCHECK(!params.history_list_was_cleared || !replace_entry);
1144 // The browser requested to clear the session history when it initiated the 1150 // The browser requested to clear the session history when it initiated the
1145 // navigation. Now we know that the renderer has updated its state accordingly 1151 // navigation. Now we know that the renderer has updated its state accordingly
1146 // and it is safe to also clear the browser side history. 1152 // and it is safe to also clear the browser side history.
1147 if (params.history_list_was_cleared) { 1153 if (params.history_list_was_cleared) {
1148 DiscardNonCommittedEntriesInternal(); 1154 DiscardNonCommittedEntriesInternal();
1149 entries_.clear(); 1155 entries_.clear();
1150 last_committed_entry_index_ = -1; 1156 last_committed_entry_index_ = -1;
1151 } 1157 }
1152 1158
1153 InsertOrReplaceEntry(std::move(new_entry), replace_entry); 1159 InsertOrReplaceEntry(std::move(new_entry), replace_entry);
1154 } 1160 }
1155 1161
1156 void NavigationControllerImpl::RendererDidNavigateToExistingPage( 1162 void NavigationControllerImpl::RendererDidNavigateToExistingPage(
1157 RenderFrameHostImpl* rfh, 1163 RenderFrameHostImpl* rfh,
1158 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 1164 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
1165 scoped_refptr<ResourceRequestBody> post_data) {
1159 // We should only get here for main frame navigations. 1166 // We should only get here for main frame navigations.
1160 DCHECK(!rfh->GetParent()); 1167 DCHECK(!rfh->GetParent());
1161 1168
1162 NavigationEntryImpl* entry; 1169 NavigationEntryImpl* entry;
1163 if (params.intended_as_new_entry) { 1170 if (params.intended_as_new_entry) {
1164 // This was intended as a new entry but the pending entry was lost in the 1171 // This was intended as a new entry but the pending entry was lost in the
1165 // meanwhile and no new page was created. We are stuck at the last committed 1172 // meanwhile and no new page was created. We are stuck at the last committed
1166 // entry. 1173 // entry.
1167 entry = GetLastCommittedEntry(); 1174 entry = GetLastCommittedEntry();
1168 } else if (params.nav_entry_id) { 1175 } else if (params.nav_entry_id) {
(...skipping 13 matching lines...) Expand all
1182 entry->SetURL(params.url); 1189 entry->SetURL(params.url);
1183 entry->SetReferrer(params.referrer); 1190 entry->SetReferrer(params.referrer);
1184 if (entry->update_virtual_url_with_url()) 1191 if (entry->update_virtual_url_with_url())
1185 UpdateVirtualURLToURL(entry, params.url); 1192 UpdateVirtualURLToURL(entry, params.url);
1186 1193
1187 // Update the post parameters. 1194 // Update the post parameters.
1188 FrameNavigationEntry* frame_entry = 1195 FrameNavigationEntry* frame_entry =
1189 entry->GetFrameEntry(rfh->frame_tree_node()); 1196 entry->GetFrameEntry(rfh->frame_tree_node());
1190 frame_entry->set_method(params.method); 1197 frame_entry->set_method(params.method);
1191 frame_entry->set_post_id(params.post_id); 1198 frame_entry->set_post_id(params.post_id);
1199 frame_entry->set_post_data(post_data);
1192 1200
1193 // The redirected to page should not inherit the favicon from the previous 1201 // The redirected to page should not inherit the favicon from the previous
1194 // page. 1202 // page.
1195 if (ui::PageTransitionIsRedirect(params.transition)) 1203 if (ui::PageTransitionIsRedirect(params.transition))
1196 entry->GetFavicon() = FaviconStatus(); 1204 entry->GetFavicon() = FaviconStatus();
1197 1205
1198 // The site instance will normally be the same except during session restore, 1206 // The site instance will normally be the same except during session restore,
1199 // when no site instance will be assigned. 1207 // when no site instance will be assigned.
1200 DCHECK(entry->site_instance() == nullptr || 1208 DCHECK(entry->site_instance() == nullptr ||
1201 entry->site_instance() == rfh->GetSiteInstance()); 1209 entry->site_instance() == rfh->GetSiteInstance());
(...skipping 11 matching lines...) Expand all
1213 // actually change any other state, just kill the pointer. 1221 // actually change any other state, just kill the pointer.
1214 DiscardNonCommittedEntriesInternal(); 1222 DiscardNonCommittedEntriesInternal();
1215 1223
1216 // If a transient entry was removed, the indices might have changed, so we 1224 // If a transient entry was removed, the indices might have changed, so we
1217 // have to query the entry index again. 1225 // have to query the entry index again.
1218 last_committed_entry_index_ = GetIndexOfEntry(entry); 1226 last_committed_entry_index_ = GetIndexOfEntry(entry);
1219 } 1227 }
1220 1228
1221 void NavigationControllerImpl::RendererDidNavigateToSamePage( 1229 void NavigationControllerImpl::RendererDidNavigateToSamePage(
1222 RenderFrameHostImpl* rfh, 1230 RenderFrameHostImpl* rfh,
1223 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 1231 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
1232 scoped_refptr<ResourceRequestBody> post_data) {
1224 // This classification says that we have a pending entry that's the same as 1233 // This classification says that we have a pending entry that's the same as
1225 // the last committed entry. This entry is guaranteed to exist by 1234 // the last committed entry. This entry is guaranteed to exist by
1226 // ClassifyNavigation. All we need to do is update the existing entry. 1235 // ClassifyNavigation. All we need to do is update the existing entry.
1227 NavigationEntryImpl* existing_entry = GetLastCommittedEntry(); 1236 NavigationEntryImpl* existing_entry = GetLastCommittedEntry();
1228 1237
1229 // If we classified this correctly, the SiteInstance should not have changed. 1238 // If we classified this correctly, the SiteInstance should not have changed.
1230 CHECK_EQ(existing_entry->site_instance(), rfh->GetSiteInstance()); 1239 CHECK_EQ(existing_entry->site_instance(), rfh->GetSiteInstance());
1231 1240
1232 // We assign the entry's unique ID to be that of the new one. Since this is 1241 // We assign the entry's unique ID to be that of the new one. Since this is
1233 // always the result of a user action, we want to dismiss infobars, etc. like 1242 // always the result of a user action, we want to dismiss infobars, etc. like
1234 // a regular user-initiated navigation. 1243 // a regular user-initiated navigation.
1235 DCHECK_EQ(pending_entry_->GetUniqueID(), params.nav_entry_id); 1244 DCHECK_EQ(pending_entry_->GetUniqueID(), params.nav_entry_id);
1236 existing_entry->set_unique_id(pending_entry_->GetUniqueID()); 1245 existing_entry->set_unique_id(pending_entry_->GetUniqueID());
1237 1246
1238 // The URL may have changed due to redirects. 1247 // The URL may have changed due to redirects.
1239 existing_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR 1248 existing_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR
1240 : PAGE_TYPE_NORMAL); 1249 : PAGE_TYPE_NORMAL);
1241 if (existing_entry->update_virtual_url_with_url()) 1250 if (existing_entry->update_virtual_url_with_url())
1242 UpdateVirtualURLToURL(existing_entry, params.url); 1251 UpdateVirtualURLToURL(existing_entry, params.url);
1243 existing_entry->SetURL(params.url); 1252 existing_entry->SetURL(params.url);
1244 existing_entry->SetReferrer(params.referrer); 1253 existing_entry->SetReferrer(params.referrer);
1245 1254
1246 // The page may have been requested with a different HTTP method. 1255 // The page may have been requested with a different HTTP method.
1247 FrameNavigationEntry* frame_entry = 1256 FrameNavigationEntry* frame_entry =
1248 existing_entry->GetFrameEntry(rfh->frame_tree_node()); 1257 existing_entry->GetFrameEntry(rfh->frame_tree_node());
1249 frame_entry->set_method(params.method); 1258 frame_entry->set_method(params.method);
1250 frame_entry->set_post_id(params.post_id); 1259 frame_entry->set_post_id(params.post_id);
1260 frame_entry->set_post_data(post_data);
1251 1261
1252 DiscardNonCommittedEntries(); 1262 DiscardNonCommittedEntries();
1253 } 1263 }
1254 1264
1255 void NavigationControllerImpl::RendererDidNavigateNewSubframe( 1265 void NavigationControllerImpl::RendererDidNavigateNewSubframe(
1256 RenderFrameHostImpl* rfh, 1266 RenderFrameHostImpl* rfh,
1257 const FrameHostMsg_DidCommitProvisionalLoad_Params& params, 1267 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
1258 bool replace_entry) { 1268 bool replace_entry,
1269 scoped_refptr<ResourceRequestBody> post_data) {
1259 DCHECK(ui::PageTransitionCoreTypeIs(params.transition, 1270 DCHECK(ui::PageTransitionCoreTypeIs(params.transition,
1260 ui::PAGE_TRANSITION_MANUAL_SUBFRAME)); 1271 ui::PAGE_TRANSITION_MANUAL_SUBFRAME));
1261 1272
1262 // Manual subframe navigations just get the current entry cloned so the user 1273 // Manual subframe navigations just get the current entry cloned so the user
1263 // can go back or forward to it. The actual subframe information will be 1274 // can go back or forward to it. The actual subframe information will be
1264 // stored in the page state for each of those entries. This happens out of 1275 // stored in the page state for each of those entries. This happens out of
1265 // band with the actual navigations. 1276 // band with the actual navigations.
1266 DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee " 1277 DCHECK(GetLastCommittedEntry()) << "ClassifyNavigation should guarantee "
1267 << "that a last committed entry exists."; 1278 << "that a last committed entry exists.";
1268 1279
1269 std::unique_ptr<NavigationEntryImpl> new_entry; 1280 std::unique_ptr<NavigationEntryImpl> new_entry;
1270 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 1281 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
1271 // Make sure new_entry takes ownership of frame_entry in a scoped_refptr. 1282 // Make sure new_entry takes ownership of frame_entry in a scoped_refptr.
1272 FrameNavigationEntry* frame_entry = new FrameNavigationEntry( 1283 FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
1273 rfh->frame_tree_node()->frame_tree_node_id(), params.frame_unique_name, 1284 rfh->frame_tree_node()->frame_tree_node_id(), params.frame_unique_name,
1274 params.item_sequence_number, params.document_sequence_number, 1285 params.item_sequence_number, params.document_sequence_number,
1275 rfh->GetSiteInstance(), params.url, params.referrer, params.method, 1286 rfh->GetSiteInstance(), params.url, params.referrer, params.method,
1276 params.post_id); 1287 params.post_id, post_data);
1277 new_entry = GetLastCommittedEntry()->CloneAndReplace(rfh->frame_tree_node(), 1288 new_entry = GetLastCommittedEntry()->CloneAndReplace(rfh->frame_tree_node(),
1278 frame_entry); 1289 frame_entry);
1279 1290
1280 // TODO(creis): Make sure the last committed entry always has the subframe 1291 // TODO(creis): Make sure the last committed entry always has the subframe
1281 // entry to replace, and CHECK(frame_entry->HasOneRef). For now, we might 1292 // entry to replace, and CHECK(frame_entry->HasOneRef). For now, we might
1282 // not find the entry to replace, and new_entry will be deleted when it goes 1293 // not find the entry to replace, and new_entry will be deleted when it goes
1283 // out of scope. See https://crbug.com/522193. 1294 // out of scope. See https://crbug.com/522193.
1284 } else { 1295 } else {
1285 new_entry = GetLastCommittedEntry()->Clone(); 1296 new_entry = GetLastCommittedEntry()->Clone();
1286 } 1297 }
1287 1298
1288 new_entry->SetPageID(params.page_id); 1299 new_entry->SetPageID(params.page_id);
1289 InsertOrReplaceEntry(std::move(new_entry), replace_entry); 1300 InsertOrReplaceEntry(std::move(new_entry), replace_entry);
1290 } 1301 }
1291 1302
1292 bool NavigationControllerImpl::RendererDidNavigateAutoSubframe( 1303 bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(
1293 RenderFrameHostImpl* rfh, 1304 RenderFrameHostImpl* rfh,
1294 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { 1305 const FrameHostMsg_DidCommitProvisionalLoad_Params& params,
1306 scoped_refptr<ResourceRequestBody> post_data) {
1295 DCHECK(ui::PageTransitionCoreTypeIs(params.transition, 1307 DCHECK(ui::PageTransitionCoreTypeIs(params.transition,
1296 ui::PAGE_TRANSITION_AUTO_SUBFRAME)); 1308 ui::PAGE_TRANSITION_AUTO_SUBFRAME));
1297 1309
1298 // We're guaranteed to have a previously committed entry, and we now need to 1310 // We're guaranteed to have a previously committed entry, and we now need to
1299 // handle navigation inside of a subframe in it without creating a new entry. 1311 // handle navigation inside of a subframe in it without creating a new entry.
1300 DCHECK(GetLastCommittedEntry()); 1312 DCHECK(GetLastCommittedEntry());
1301 1313
1302 if (params.nav_entry_id) { 1314 if (params.nav_entry_id) {
1303 int entry_index = GetEntryIndexWithUniqueID(params.nav_entry_id); 1315 int entry_index = GetEntryIndexWithUniqueID(params.nav_entry_id);
1304 1316
(...skipping 23 matching lines...) Expand all
1328 } 1340 }
1329 1341
1330 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 1342 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
1331 // This may be a "new auto" case where we add a new FrameNavigationEntry, or 1343 // This may be a "new auto" case where we add a new FrameNavigationEntry, or
1332 // it may be a "history auto" case where we update an existing one. 1344 // it may be a "history auto" case where we update an existing one.
1333 NavigationEntryImpl* last_committed = GetLastCommittedEntry(); 1345 NavigationEntryImpl* last_committed = GetLastCommittedEntry();
1334 last_committed->AddOrUpdateFrameEntry( 1346 last_committed->AddOrUpdateFrameEntry(
1335 rfh->frame_tree_node(), params.frame_unique_name, 1347 rfh->frame_tree_node(), params.frame_unique_name,
1336 params.item_sequence_number, params.document_sequence_number, 1348 params.item_sequence_number, params.document_sequence_number,
1337 rfh->GetSiteInstance(), params.url, params.referrer, params.page_state, 1349 rfh->GetSiteInstance(), params.url, params.referrer, params.page_state,
1338 params.method, params.post_id); 1350 params.method, params.post_id, post_data);
1339 1351
1340 // Cross-process subframe navigations may leave a pending entry around. 1352 // Cross-process subframe navigations may leave a pending entry around.
1341 // Clear it if it's actually for the subframe. 1353 // Clear it if it's actually for the subframe.
1342 // TODO(creis): Don't use pending entries for subframe navigations. 1354 // TODO(creis): Don't use pending entries for subframe navigations.
1343 // See https://crbug.com/495161. 1355 // See https://crbug.com/495161.
1344 if (pending_entry_ && 1356 if (pending_entry_ &&
1345 pending_entry_->frame_tree_node_id() == 1357 pending_entry_->frame_tree_node_id() ==
1346 rfh->frame_tree_node()->frame_tree_node_id()) { 1358 rfh->frame_tree_node()->frame_tree_node_id()) {
1347 DiscardPendingEntry(false); 1359 DiscardPendingEntry(false);
1348 } 1360 }
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 } 2060 }
2049 } 2061 }
2050 } 2062 }
2051 2063
2052 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2064 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2053 const base::Callback<base::Time()>& get_timestamp_callback) { 2065 const base::Callback<base::Time()>& get_timestamp_callback) {
2054 get_timestamp_callback_ = get_timestamp_callback; 2066 get_timestamp_callback_ = get_timestamp_callback;
2055 } 2067 }
2056 2068
2057 } // namespace content 2069 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698