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

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

Issue 6335014: Ensure that normal URLs are not loaded in the NTP process in process-per-tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | « chrome/browser/dom_ui/new_tab_ui_uitest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_host_manager.cc
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index ed5628e9731376f45603da6908967fd43c812b53..a4129246a7e9e3e6ca7c38a3337dd1c2304a2be5 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -292,18 +292,32 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
const NavigationEntry* new_entry) const {
DCHECK(new_entry);
+ // Check for reasons to swap processes even if we are in a process model that
+ // doesn't usually swap (e.g., process-per-tab).
+
+ // For security, we should transition between processes when one is a DOM UI
+ // page and one isn't. If there's no cur_entry, check the current RVH's
+ // site, which might already be committed to a DOM UI URL (such as the NTP).
+ const GURL& current_url = (cur_entry) ? cur_entry->url() :
+ render_view_host_->site_instance()->site();
+ Profile* profile = delegate_->GetControllerForRenderManager().profile();
+ if (DOMUIFactory::UseDOMUIForURL(profile, current_url)) {
+ // Force swap if it's not an acceptable URL for DOM UI.
+ if (!DOMUIFactory::IsURLAcceptableForDOMUI(profile, new_entry->url()))
+ return true;
+ } else {
+ // Force swap if it's a DOM UI URL.
+ if (DOMUIFactory::UseDOMUIForURL(profile, new_entry->url()))
+ return true;
+ }
+
if (!cur_entry) {
// Always choose a new process when navigating to extension URLs. The
// process grouping logic will combine all of a given extension's pages
// into the same process.
if (new_entry->url().SchemeIs(chrome::kExtensionScheme))
return true;
- // When a tab is created, it starts as TYPE_NORMAL. If the new entry is a
- // DOM UI page, it needs to be grouped with other DOM UI pages. This matches
- // the logic when transitioning between DOM UI and normal pages.
- Profile* profile = delegate_->GetControllerForRenderManager().profile();
- if (DOMUIFactory::UseDOMUIForURL(profile, new_entry->url()))
- return true;
+
return false;
}
@@ -314,19 +328,6 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
if (cur_entry->IsViewSourceMode() != new_entry->IsViewSourceMode())
return true;
- // For security, we should transition between processes when one is a DOM UI
- // page and one isn't.
- Profile* profile = delegate_->GetControllerForRenderManager().profile();
- if (DOMUIFactory::UseDOMUIForURL(profile, cur_entry->url())) {
- // Force swap if it's not an acceptable URL for DOM UI.
- if (!DOMUIFactory::IsURLAcceptableForDOMUI(profile, new_entry->url()))
- return true;
- } else {
- // Force swap if it's a DOM UI URL.
- if (DOMUIFactory::UseDOMUIForURL(profile, new_entry->url()))
- return true;
- }
-
// Also, we must switch if one is an extension and the other is not the exact
// same extension.
if (cur_entry->url().SchemeIs(chrome::kExtensionScheme) ||
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui_uitest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698