summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tab_contents
diff options
context:
space:
mode:
authorcreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 22:37:28 +0000
committercreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-11 22:37:28 +0000
commitd7cb0d5a5779308baec99bfa3518977cea41e34e (patch)
treeea427cf65dc9f5953dccf234c9bf8d82d35d1eea /chrome/browser/tab_contents
parentdc822779ae2efab0bd7d01778b06a7a53343cca8 (diff)
downloadchromium_src-d7cb0d5a5779308baec99bfa3518977cea41e34e.zip
chromium_src-d7cb0d5a5779308baec99bfa3518977cea41e34e.tar.gz
chromium_src-d7cb0d5a5779308baec99bfa3518977cea41e34e.tar.bz2
Avoids sending about: URLs to DOM UI renderers in process-per-tab.
Since about:version, etc get translated to chrome://about/version, we were sending them to a DOM UI renderer in process-per-tab mode. This hit a CHECK where we ensured non-DOM-UI URLs weren't sent to such renderers. BUG=46290 TEST=RenderViewHostManagerTest.NonDOMUIChromeURLs Review URL: http://codereview.chromium.org/2730014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49603 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager.cc4
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager.h1
-rw-r--r--chrome/browser/tab_contents/render_view_host_manager_unittest.cc38
3 files changed, 40 insertions, 3 deletions
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index 58f488b..4754425 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -308,8 +308,8 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation(
// For security, we should transition between processes when one is a DOM UI
// page and one isn't.
- if (DOMUIFactory::HasDOMUIScheme(cur_entry->url()) !=
- DOMUIFactory::HasDOMUIScheme(new_entry->url()))
+ if (DOMUIFactory::UseDOMUIForURL(cur_entry->url()) !=
+ DOMUIFactory::UseDOMUIForURL(new_entry->url()))
return true;
// Also, we must switch if one is an extension and the other is not the exact
diff --git a/chrome/browser/tab_contents/render_view_host_manager.h b/chrome/browser/tab_contents/render_view_host_manager.h
index e04235d..0fa0f26 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.h
+++ b/chrome/browser/tab_contents/render_view_host_manager.h
@@ -170,6 +170,7 @@ class RenderViewHostManager
private:
friend class TestTabContents;
+ friend class RenderViewHostManagerTest;
// Returns whether this tab should transition to a new renderer for
// cross-site URLs. Enabled unless we see the --process-per-tab command line
diff --git a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
index 5dc2213..16c0c7f 100644
--- a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/browser_url_handler.h"
#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
@@ -24,6 +25,12 @@ class RenderViewHostManagerTest : public RenderViewHostTestHarness {
max_page_id() + 1,
url);
}
+
+ bool ShouldSwapProcesses(RenderViewHostManager* manager,
+ const NavigationEntry* cur_entry,
+ const NavigationEntry* new_entry) const {
+ return manager->ShouldSwapProcessesForNavigation(cur_entry, new_entry);
+ }
};
// Tests that when you navigate from the New TabPage to another page, and
@@ -140,7 +147,7 @@ TEST_F(RenderViewHostManagerTest, Init) {
EXPECT_FALSE(manager.pending_render_view_host());
}
-// Tests the Navigate function. We navigate three sites consequently and check
+// Tests the Navigate function. We navigate three sites consecutively and check
// how the pending/committed RenderViewHost are modified.
TEST_F(RenderViewHostManagerTest, Navigate) {
TestNotificationTracker notifications;
@@ -255,3 +262,32 @@ TEST_F(RenderViewHostManagerTest, DOMUI) {
EXPECT_FALSE(manager.pending_dom_ui());
EXPECT_TRUE(manager.dom_ui());
}
+
+// Tests that chrome: URLs that are not DOM UI pages do not get grouped into
+// DOM UI renderers, even if --process-per-tab is enabled. In that mode, we
+// still swap processes if ShouldSwapProcessesForNavigation is true.
+// Regression test for bug 46290.
+TEST_F(RenderViewHostManagerTest, NonDOMUIChromeURLs) {
+ SiteInstance* instance = SiteInstance::CreateSiteInstance(profile_.get());
+ TestTabContents tab_contents(profile_.get(), instance);
+ RenderViewHostManager manager(&tab_contents, &tab_contents);
+ manager.Init(profile_.get(), instance, MSG_ROUTING_NONE);
+
+ // NTP is a DOM UI page.
+ GURL ntp_url(chrome::kChromeUINewTabURL);
+ NavigationEntry ntp_entry(NULL /* instance */, -1 /* page_id */, ntp_url,
+ GURL() /* referrer */, string16() /* title */,
+ PageTransition::TYPED);
+
+ // about: URLs are not DOM UI pages.
+ GURL about_url(chrome::kAboutMemoryURL);
+ // Rewrite so it looks like chrome://about/memory
+ bool reverse_on_redirect = false;
+ BrowserURLHandler::RewriteURLIfNecessary(
+ &about_url, profile_.get(), &reverse_on_redirect);
+ NavigationEntry about_entry(NULL /* instance */, -1 /* page_id */, about_url,
+ GURL() /* referrer */, string16() /* title */,
+ PageTransition::TYPED);
+
+ EXPECT_TRUE(ShouldSwapProcesses(&manager, &ntp_entry, &about_entry));
+}