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

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: Update tests and fix, clean up. 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
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..57ca3613a0a79afe85d72e2bc914e81f5e392ece 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -1376,9 +1376,10 @@ 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();
Charlie Reis 2016/06/03 19:20:35 This is wrong after a process swap, when the newly
Avi (use Gerrit) 2016/06/03 20:26:57 Interesting; worthy of a comment why we don't do i
Charlie Reis 2016/06/03 20:53:28 Good idea. Done.
+ 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 +1391,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 +1854,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.
Charlie Reis 2016/06/03 19:20:35 I decided to punt this for another CL, since it wi
FrameNavigationEntry* old_item =
GetLastCommittedEntry()->GetFrameEntry(frame);
if (!new_item)

Powered by Google App Engine
This is Rietveld 408576698