summaryrefslogtreecommitdiffstats
path: root/chrome/browser/site_instance_unittest.cc
diff options
context:
space:
mode:
authorcreis@google.com <creis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-26 00:16:51 +0000
committercreis@google.com <creis@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-26 00:16:51 +0000
commit6705b23f96dc6953abe9911907a8d25d924e5e7f (patch)
tree01d12f8da8fabc7d541e90fa5a27b8bbe77cc825 /chrome/browser/site_instance_unittest.cc
parent8a304074522d7c710298bb24ae55fb4a60143ba6 (diff)
downloadchromium_src-6705b23f96dc6953abe9911907a8d25d924e5e7f.zip
chromium_src-6705b23f96dc6953abe9911907a8d25d924e5e7f.tar.gz
chromium_src-6705b23f96dc6953abe9911907a8d25d924e5e7f.tar.bz2
Don't create separate SiteInstances for pages from the same domain and scheme
but from different ports. (These pages can still access each other.) (This is copied from http://codereview.chromium.org/12443, which has already been reviewed by darin and abarth. Just had to commit from a different checked out codebase.) BUG=4792 R=darin,abarth Review URL: http://codereview.chromium.org/12451 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/site_instance_unittest.cc')
-rw-r--r--chrome/browser/site_instance_unittest.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/chrome/browser/site_instance_unittest.cc b/chrome/browser/site_instance_unittest.cc
index 69c83fa..dc0297e 100644
--- a/chrome/browser/site_instance_unittest.cc
+++ b/chrome/browser/site_instance_unittest.cc
@@ -202,13 +202,15 @@ TEST_F(SiteInstanceTest, SetSite) {
// Test to ensure GetSiteForURL properly returns sites for URLs.
TEST_F(SiteInstanceTest, GetSiteForURL) {
+ // Pages are irrelevant.
GURL test_url = GURL("http://www.google.com/index.html");
EXPECT_EQ(GURL("http://google.com"), SiteInstance::GetSiteForURL(test_url));
+ // Ports are irrlevant.
test_url = GURL("https://www.google.com:8080");
- EXPECT_EQ(GURL("https://google.com:8080"),
- SiteInstance::GetSiteForURL(test_url));
+ EXPECT_EQ(GURL("https://google.com"), SiteInstance::GetSiteForURL(test_url));
+ // Javascript URLs have no site.
test_url = GURL("javascript:foo();");
EXPECT_EQ(GURL::EmptyGURL(), SiteInstance::GetSiteForURL(test_url));
@@ -238,9 +240,15 @@ TEST_F(SiteInstanceTest, IsSameWebSite) {
GURL url_hang = GURL("about:hang");
GURL url_shorthang = GURL("about:shorthang");
+ // Same scheme and port -> same site.
EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo2));
+
+ // Different scheme -> different site.
EXPECT_FALSE(SiteInstance::IsSameWebSite(url_foo, url_foo_https));
- EXPECT_FALSE(SiteInstance::IsSameWebSite(url_foo, url_foo_port));
+
+ // Different port -> same site.
+ // (Changes to document.domain make renderer ignore the port.)
+ EXPECT_TRUE(SiteInstance::IsSameWebSite(url_foo, url_foo_port));
// JavaScript links should be considered same site for anything.
EXPECT_TRUE(SiteInstance::IsSameWebSite(url_javascript, url_foo));