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

Unified Diff: content/browser/site_instance_impl.cc

Issue 2376083002: BlobUrlBrowserTest: Add a test exercising blob: URLs from file:// documents.
Patch Set: With fix Created 4 years, 2 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 | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/public/test/browser_test_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/site_instance_impl.cc
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
index c12a0c79160a24dea7b2667816cb670fc4f89114..ac535c86914a5be0e40f3eba2403c906721ce3d8 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
@@ -292,10 +292,10 @@ scoped_refptr<SiteInstance> SiteInstance::CreateForURL(
bool SiteInstance::IsSameWebSite(BrowserContext* browser_context,
const GURL& real_src_url,
const GURL& real_dest_url) {
+ GURL dest_url =
+ SiteInstanceImpl::GetEffectiveURL(browser_context, real_dest_url);
GURL src_url = SiteInstanceImpl::GetEffectiveURL(browser_context,
real_src_url);
- GURL dest_url = SiteInstanceImpl::GetEffectiveURL(browser_context,
- real_dest_url);
// We infer web site boundaries based on the registered domain name of the
// top-level page and the scheme. We do not pay attention to the port if
@@ -312,19 +312,18 @@ bool SiteInstance::IsSameWebSite(BrowserContext* browser_context,
if (!src_url.is_valid() || !dest_url.is_valid())
return false;
- // If the destination url is just a blank page, we treat them as part of the
- // same site.
- GURL blank_page(url::kAboutBlankURL);
- if (dest_url == blank_page)
+ // If the destination url is just a blank page, a data: URL, or another page
+ // without an origin, we can't reason about its origin.
+ url::Origin dest_origin(dest_url);
+ if (dest_origin.unique())
return true;
// If the schemes differ, they aren't part of the same site.
- if (src_url.scheme() != dest_url.scheme())
+ if (src_url.scheme() != dest_origin.scheme())
return false;
return net::registry_controlled_domains::SameDomainOrHost(
- src_url,
- dest_url,
+ src_url, dest_origin.GetURL(),
net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
}
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/public/test/browser_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698