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

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

Issue 1816763002: OOPIF: Fix subframe back/forward after recreating FTNs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix review comments 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 DCHECK(GetLastCommittedEntry()); 729 DCHECK(GetLastCommittedEntry());
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()); 740 params.referrer, PageState());
741 } 741 }
742 } 742 }
743 } 743 }
744 744
745 // Otherwise, create a pending entry for the main frame. 745 // Otherwise, create a pending entry for the main frame.
746 if (!entry) { 746 if (!entry) {
747 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( 747 entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry(
748 params.url, params.referrer, params.transition_type, 748 params.url, params.referrer, params.transition_type,
749 params.is_renderer_initiated, params.extra_headers, browser_context_)); 749 params.is_renderer_initiated, params.extra_headers, browser_context_));
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 970
971 // Valid subframe navigation. 971 // Valid subframe navigation.
972 return NAVIGATION_TYPE_NEW_SUBFRAME; 972 return NAVIGATION_TYPE_NEW_SUBFRAME;
973 } 973 }
974 974
975 // Cross-process location.replace navigations should be classified as New with 975 // Cross-process location.replace navigations should be classified as New with
976 // replacement rather than ExistingPage, since it is not safe to reuse the 976 // replacement rather than ExistingPage, since it is not safe to reuse the
977 // NavigationEntry. 977 // NavigationEntry.
978 // TODO(creis): Have the renderer classify location.replace as 978 // TODO(creis): Have the renderer classify location.replace as
979 // did_create_new_entry for all cases and eliminate this special case. This 979 // did_create_new_entry for all cases and eliminate this special case. This
980 // requires updating several test expectations. See https://crbug.com/317872. 980 // requires updating several test expectations. See https://crbug.com/596707.
981 if (!rfh->GetParent() && GetLastCommittedEntry() && 981 if (!rfh->GetParent() && GetLastCommittedEntry() &&
982 GetLastCommittedEntry()->site_instance() != rfh->GetSiteInstance() && 982 GetLastCommittedEntry()->site_instance() != rfh->GetSiteInstance() &&
983 params.should_replace_current_entry) { 983 params.should_replace_current_entry) {
984 return NAVIGATION_TYPE_NEW_PAGE; 984 return NAVIGATION_TYPE_NEW_PAGE;
985 } 985 }
986 986
987 // We only clear the session history when navigating to a new page. 987 // We only clear the session history when navigating to a new page.
988 DCHECK(!params.history_list_was_cleared); 988 DCHECK(!params.history_list_was_cleared);
989 989
990 if (rfh->GetParent()) { 990 if (rfh->GetParent()) {
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 DCHECK(entry); 1177 DCHECK(entry);
1178 1178
1179 // The URL may have changed due to redirects. 1179 // The URL may have changed due to redirects.
1180 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR 1180 entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR
1181 : PAGE_TYPE_NORMAL); 1181 : PAGE_TYPE_NORMAL);
1182 entry->SetURL(params.url); 1182 entry->SetURL(params.url);
1183 entry->SetReferrer(params.referrer); 1183 entry->SetReferrer(params.referrer);
1184 if (entry->update_virtual_url_with_url()) 1184 if (entry->update_virtual_url_with_url())
1185 UpdateVirtualURLToURL(entry, params.url); 1185 UpdateVirtualURLToURL(entry, params.url);
1186 1186
1187 // Update the ISN and DSN in case this was a location.replace, which can cause
1188 // them to change.
1189 // TODO(creis): Classify location.replace as NEW_PAGE instead of EXISTING_PAGE
1190 // in https://crbug.com/596707.
1191 FrameNavigationEntry* frame_entry =
1192 entry->GetFrameEntry(rfh->frame_tree_node());
1193 frame_entry->set_item_sequence_number(params.item_sequence_number);
1194 frame_entry->set_document_sequence_number(params.document_sequence_number);
1195
1187 // The redirected to page should not inherit the favicon from the previous 1196 // The redirected to page should not inherit the favicon from the previous
1188 // page. 1197 // page.
1189 if (ui::PageTransitionIsRedirect(params.transition)) 1198 if (ui::PageTransitionIsRedirect(params.transition))
1190 entry->GetFavicon() = FaviconStatus(); 1199 entry->GetFavicon() = FaviconStatus();
1191 1200
1192 // The site instance will normally be the same except during session restore, 1201 // The site instance will normally be the same except during session restore,
1193 // when no site instance will be assigned. 1202 // when no site instance will be assigned.
1194 DCHECK(entry->site_instance() == nullptr || 1203 DCHECK(entry->site_instance() == nullptr ||
1195 entry->site_instance() == rfh->GetSiteInstance()); 1204 entry->site_instance() == rfh->GetSiteInstance());
1196 entry->set_site_instance( 1205 entry->set_site_instance(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 DiscardNonCommittedEntriesInternal(); 1328 DiscardNonCommittedEntriesInternal();
1320 return true; 1329 return true;
1321 } 1330 }
1322 } 1331 }
1323 1332
1324 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 1333 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
1325 // This may be a "new auto" case where we add a new FrameNavigationEntry, or 1334 // This may be a "new auto" case where we add a new FrameNavigationEntry, or
1326 // it may be a "history auto" case where we update an existing one. 1335 // it may be a "history auto" case where we update an existing one.
1327 NavigationEntryImpl* last_committed = GetLastCommittedEntry(); 1336 NavigationEntryImpl* last_committed = GetLastCommittedEntry();
1328 last_committed->AddOrUpdateFrameEntry( 1337 last_committed->AddOrUpdateFrameEntry(
1329 rfh->frame_tree_node(), params.frame_unique_name, 1338 rfh->frame_tree_node(), params.item_sequence_number,
1330 params.item_sequence_number, params.document_sequence_number, 1339 params.document_sequence_number, rfh->GetSiteInstance(), params.url,
1331 rfh->GetSiteInstance(), params.url, params.referrer, params.page_state); 1340 params.referrer, params.page_state);
1332 1341
1333 // Cross-process subframe navigations may leave a pending entry around. 1342 // Cross-process subframe navigations may leave a pending entry around.
1334 // Clear it if it's actually for the subframe. 1343 // Clear it if it's actually for the subframe.
1335 // TODO(creis): Don't use pending entries for subframe navigations. 1344 // TODO(creis): Don't use pending entries for subframe navigations.
1336 // See https://crbug.com/495161. 1345 // See https://crbug.com/495161.
1337 if (pending_entry_ && 1346 if (pending_entry_ &&
1338 pending_entry_->frame_tree_node_id() == 1347 pending_entry_->frame_tree_node_id() ==
1339 rfh->frame_tree_node()->frame_tree_node_id()) { 1348 rfh->frame_tree_node()->frame_tree_node_id()) {
1340 DiscardPendingEntry(false); 1349 DiscardPendingEntry(false);
1341 } 1350 }
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 } 2050 }
2042 } 2051 }
2043 } 2052 }
2044 2053
2045 void NavigationControllerImpl::SetGetTimestampCallbackForTest( 2054 void NavigationControllerImpl::SetGetTimestampCallbackForTest(
2046 const base::Callback<base::Time()>& get_timestamp_callback) { 2055 const base::Callback<base::Time()>& get_timestamp_callback) {
2047 get_timestamp_callback_ = get_timestamp_callback; 2056 get_timestamp_callback_ = get_timestamp_callback;
2048 } 2057 }
2049 2058
2050 } // namespace content 2059 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698