summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 18:34:03 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-08 18:34:03 +0000
commit89f550b854228a6414d017c9186e3e8540b69e13 (patch)
tree863139cb1cfeeeeeebbfb48b729373ce4c12f112 /content
parent56283961a67c5beb667589a547adf3d94db018e9 (diff)
downloadchromium_src-89f550b854228a6414d017c9186e3e8540b69e13.zip
chromium_src-89f550b854228a6414d017c9186e3e8540b69e13.tar.gz
chromium_src-89f550b854228a6414d017c9186e3e8540b69e13.tar.bz2
*Fixup about and chrome scheme URLs in URLFixerUpper::FixupURL.
*Update AboutSource to use the source_name of each about/chrome page. *Make WillHandleBrowserAboutURL fix up schemes and handle chrome://foo/ -Redirect memory to memory-redirect (wasn't handling chrome://memory/). -Catalog all kChromeUI*Hosts in url_constants.cc -Simplify paths (credits, os-credits, ipc, settings, about/version). -Nix web_ui_util::ChromeURLHostEquals (use scheme & host comparison). -Favor GURL::SchemeIs and url_constants, update & expand tests. -Add and fixup chrome://chrome-urls (the about:about page). -Update special_tabs.py from Nirnimesh's codereview.chromium.org/6995057/. This change was reverted with r88166 for sync_integration_tests failures. These failures are a tangential issue, crbug.com/85294; I'll re-land this soon. BUG=55771 TEST=Access about:, about://, chrome:, chrome:// pages. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=88142 Review URL: http://codereview.chromium.org/7068007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88367 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/child_process_security_policy_unittest.cc15
-rw-r--r--content/browser/site_instance.cc8
-rw-r--r--content/browser/site_instance_unittest.cc19
3 files changed, 25 insertions, 17 deletions
diff --git a/content/browser/child_process_security_policy_unittest.cc b/content/browser/child_process_security_policy_unittest.cc
index f1f214c..4ef3306 100644
--- a/content/browser/child_process_security_policy_unittest.cc
+++ b/content/browser/child_process_security_policy_unittest.cc
@@ -45,6 +45,8 @@ TEST_F(ChildProcessSecurityPolicyTest, IsWebSafeSchemeTest) {
EXPECT_FALSE(p->IsWebSafeScheme("registered-web-safe-scheme"));
p->RegisterWebSafeScheme("registered-web-safe-scheme");
EXPECT_TRUE(p->IsWebSafeScheme("registered-web-safe-scheme"));
+
+ EXPECT_FALSE(p->IsWebSafeScheme(chrome::kChromeUIScheme));
}
TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) {
@@ -57,6 +59,8 @@ TEST_F(ChildProcessSecurityPolicyTest, IsPseudoSchemeTest) {
EXPECT_FALSE(p->IsPseudoScheme("registered-pseudo-scheme"));
p->RegisterPseudoScheme("registered-pseudo-scheme");
EXPECT_TRUE(p->IsPseudoScheme("registered-pseudo-scheme"));
+
+ EXPECT_FALSE(p->IsPseudoScheme(chrome::kChromeUIScheme));
}
TEST_F(ChildProcessSecurityPolicyTest, IsDisabledSchemeTest) {
@@ -119,6 +123,7 @@ TEST_F(ChildProcessSecurityPolicyTest, AboutTest) {
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("about:CrASh")));
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("abOuT:cAChe")));
+ // These requests for about: pages should be denied.
p->GrantRequestURL(kRendererID, GURL(chrome::kTestMemoryURL));
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kTestMemoryURL)));
@@ -131,6 +136,16 @@ TEST_F(ChildProcessSecurityPolicyTest, AboutTest) {
p->GrantRequestURL(kRendererID, GURL(chrome::kTestHangURL));
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL(chrome::kTestHangURL)));
+ // These requests for chrome:// pages should be granted.
+ p->GrantRequestURL(kRendererID, GURL(chrome::kTestNewTabURL));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL(chrome::kTestNewTabURL)));
+
+ p->GrantRequestURL(kRendererID, GURL(chrome::kTestHistoryURL));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL(chrome::kTestHistoryURL)));
+
+ p->GrantRequestURL(kRendererID, GURL(chrome::kTestBookmarksURL));
+ EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL(chrome::kTestBookmarksURL)));
+
p->Remove(kRendererID);
}
diff --git a/content/browser/site_instance.cc b/content/browser/site_instance.cc
index 610de02..53caf57 100644
--- a/content/browser/site_instance.cc
+++ b/content/browser/site_instance.cc
@@ -17,12 +17,10 @@ static bool IsURLSameAsAnySiteInstance(const GURL& url) {
if (!url.is_valid())
return false;
- // We treat javascript: and about:crash as the same site as any URL since they
- // are actually modifiers on existing pages.
- if (url.SchemeIs(chrome::kJavaScriptScheme) ||
- url.spec() == chrome::kAboutCrashURL) {
+ // We treat javascript: as the same site as any URL since it is actually
+ // a modifier on existing pages.
+ if (url.SchemeIs(chrome::kJavaScriptScheme))
return true;
- }
return
content::GetContentClient()->browser()->IsURLSameAsAnySiteInstance(url);
diff --git a/content/browser/site_instance_unittest.cc b/content/browser/site_instance_unittest.cc
index 8bda89e..6931e5a 100644
--- a/content/browser/site_instance_unittest.cc
+++ b/content/browser/site_instance_unittest.cc
@@ -24,10 +24,6 @@
namespace {
-// TODO(estade): this shouldn't need to be chrome:, but it does (or else GURL
-// doesn't think that the webui URLs have a host). Figure out where this is
-// coming from and fix it.
-const char kWebUIScheme[] = "chrome";
const char kSameAsAnyInstanceURL[] = "about:internets";
class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory {
@@ -36,7 +32,7 @@ class SiteInstanceTestWebUIFactory : public content::EmptyWebUIFactory {
return HasWebUIScheme(url);
}
virtual bool HasWebUIScheme(const GURL& url) const {
- return url.SchemeIs(kWebUIScheme);
+ return url.SchemeIs(chrome::kChromeUIScheme);
}
};
@@ -47,7 +43,8 @@ class SiteInstanceTestBrowserClient : public content::ContentBrowserClient {
}
virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE {
- return url.spec() == kSameAsAnyInstanceURL;
+ return url == GURL(kSameAsAnyInstanceURL) ||
+ url == GURL(chrome::kAboutCrashURL);
}
private:
@@ -492,14 +489,12 @@ TEST_F(SiteInstanceTest, ProcessSharingByType) {
extension2_instance->GetProcess());
// Create some WebUI instances and make sure they share a process.
- scoped_refptr<SiteInstance> webui1_instance(
- CreateSiteInstance(&rph_factory,
- GURL(kWebUIScheme + std::string("://newtab"))));
+ scoped_refptr<SiteInstance> webui1_instance(CreateSiteInstance(&rph_factory,
+ GURL(chrome::kChromeUIScheme + std::string("://newtab"))));
policy->GrantWebUIBindings(webui1_instance->GetProcess()->id());
- scoped_refptr<SiteInstance> webui2_instance(
- CreateSiteInstance(&rph_factory,
- GURL(kWebUIScheme + std::string("://history"))));
+ scoped_refptr<SiteInstance> webui2_instance( CreateSiteInstance(&rph_factory,
+ GURL(chrome::kChromeUIScheme + std::string("://history"))));
scoped_ptr<RenderProcessHost> dom_host(webui1_instance->GetProcess());
EXPECT_EQ(webui1_instance->GetProcess(), webui2_instance->GetProcess());