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

Unified Diff: chrome/browser/site_instance.cc

Issue 12451: Don't create separate SiteInstances for pages from the same domain and scheme... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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/site_instance.h ('k') | chrome/browser/site_instance_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/site_instance.cc
===================================================================
--- chrome/browser/site_instance.cc (revision 6002)
+++ chrome/browser/site_instance.cc (working copy)
@@ -85,9 +85,17 @@
// If the url has a host, then determine the site.
if (url.has_host()) {
- // Only keep the scheme, registered domain, and port as given by GetOrigin.
+ // Only keep the scheme and registered domain as given by GetOrigin. This
+ // may also include a port, which we need to drop.
site = url.GetOrigin();
+ // Remove port, if any.
+ if (site.has_port()) {
+ GURL::Replacements rep;
+ rep.ClearPort();
+ site = site.ReplaceComponents(rep);
+ }
+
// If this URL has a registered domain, we only want to remember that part.
std::string domain =
net::RegistryControlledDomainService::GetDomainAndRegistry(url);
@@ -103,7 +111,9 @@
/*static*/
bool SiteInstance::IsSameWebSite(const GURL& url1, const GURL& url2) {
// We infer web site boundaries based on the registered domain name of the
- // top-level page, as well as the scheme and the port.
+ // top-level page and the scheme. We do not pay attention to the port if
+ // one is present, because pages served from different ports can still
+ // access each other if they change their document.domain variable.
// We must treat javascript: URLs as part of the same site, regardless of
// the site.
@@ -125,8 +135,8 @@
return false;
}
- // If the scheme or port differ, they aren't part of the same site.
- if (url1.scheme() != url2.scheme() || url1.port() != url2.port()) {
+ // If the schemes differ, they aren't part of the same site.
+ if (url1.scheme() != url2.scheme()) {
return false;
}
« no previous file with comments | « chrome/browser/site_instance.h ('k') | chrome/browser/site_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698