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

Unified Diff: content/browser/tab_contents/render_view_host_manager.cc

Issue 8372036: Ensure forced process swaps use the correct page_id and SiteInstance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a test Created 9 years, 2 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/tab_contents/render_view_host_manager.cc
diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc
index 262786288337e1533c57ab6760ad69bfd53f34ae..adfa501f24084156003fdbd37ff7daeb3bd2508e 100644
--- a/content/browser/tab_contents/render_view_host_manager.cc
+++ b/content/browser/tab_contents/render_view_host_manager.cc
@@ -391,10 +391,17 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
// is part of an app that has been installed or uninstalled since the last
// visit.
if (entry.site_instance()) {
- if (entry.site_instance()->HasWrongProcessForURL(dest_url))
- return curr_instance->GetRelatedSiteInstance(dest_url);
- else
- return entry.site_instance();
+ if (entry.site_instance()->HasWrongProcessForURL(dest_url)) {
+ // If we need to swap to a different SiteInstance, the new one should have
+ // the same max_page_id as the current one so that it identifies new vs
+ // existing navigations correctly. We also need to update the entry's
+ // SiteInstance, which we will do in TabContents::NavigateToEntry.
+ SiteInstance* new_instance =
+ curr_instance->GetRelatedSiteInstance(dest_url);
+ new_instance->UpdateMaxPageID(curr_instance->max_page_id());
+ return new_instance;
+ }
+ return entry.site_instance();
}
// (UGLY) HEURISTIC, process-per-site only:
« no previous file with comments | « chrome/test/data/extensions/api_test/app_process/path1/simple.html ('k') | content/browser/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698