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

Unified Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 2023013002: Prevent renderer kills for in-page navigations on subframes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase filter file Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index fe5cdcd0f764db3adaa7b8a7932f6907fb31d66d..d2012a51ef3584010466b4242aa9a25896fddbeb 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -1376,9 +1376,14 @@ bool NavigationControllerImpl::IsURLInPageNavigation(
const GURL& url,
bool renderer_says_in_page,
RenderFrameHost* rfh) const {
+ RenderFrameHostImpl* rfhi = static_cast<RenderFrameHostImpl*>(rfh);
GURL last_committed_url;
if (rfh->GetParent()) {
- last_committed_url = rfh->GetLastCommittedURL();
+ // Use the FrameTreeNode's current_url and not rfh->GetLastCommittedURL(),
+ // which might be empty in a new RenderFrameHost after a process swap.
+ // Here, we care about the last committed URL in the FrameTreeNode,
+ // regardless of which process it is in.
+ last_committed_url = rfhi->frame_tree_node()->current_url();
} else {
NavigationEntry* last_committed = GetLastCommittedEntry();
// There must be a last-committed entry to compare URLs to. TODO(avi): When
@@ -1390,9 +1395,8 @@ bool NavigationControllerImpl::IsURLInPageNavigation(
}
WebPreferences prefs = rfh->GetRenderViewHost()->GetWebkitPreferences();
- const url::Origin& committed_origin = static_cast<RenderFrameHostImpl*>(rfh)
- ->frame_tree_node()
- ->current_origin();
+ const url::Origin& committed_origin =
+ rfhi->frame_tree_node()->current_origin();
bool is_same_origin = last_committed_url.is_empty() ||
// TODO(japhet): We should only permit navigations
// originating from about:blank to be in-page if the
@@ -1854,6 +1858,8 @@ void NavigationControllerImpl::FindFramesToNavigate(
DCHECK(pending_entry_);
DCHECK_GE(last_committed_entry_index_, 0);
FrameNavigationEntry* new_item = pending_entry_->GetFrameEntry(frame);
+ // TODO(creis): Store the last committed FrameNavigationEntry to use here,
+ // rather than assuming the NavigationEntry has up to date info on subframes.
FrameNavigationEntry* old_item =
GetLastCommittedEntry()->GetFrameEntry(frame);
if (!new_item)
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_controller_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698