Replace SiteInstance::IsSameWebSite() with a new non-static method.
Currently, SiteInstance::IsSameWebSite() is static and will need to be
modified to support dynamic isolated origins. Those origins will
apply only to future BrowsingInstances, meaning the answer to
IsSameWebSite will depend on which frame/SiteInstance is asking this
question. This CL replaces this method with a non-static
SiteInstance::IsSameSiteWithURL method. This will ensure that the
internal implementation will be able to provide sufficient context
(i.e., BrowsingInstance info) in the future, without having to expose
that context outside of content/. Note that the content-internal
version of this call, SiteInstanceImpl::IsSameWebSite, stays as-is for
now.
The only two non-test uses of this were in NaCl code. They were
checking whether the current SiteInstance's site URL is same-site with
the URL of the NaCl file to be loaded, with both URLs expected to be
extension URLs. There should be no behavior change in these, as the
underlying implementation doesn't change.
A few tests are also refactored to either avoid using IsSameWebSite
entirely, or, for tests inside content/, to use the internal version
of IsSameWebSite.
Bug: 905513
Change-Id: Ia2957bb1ec7a16de8c3d18ef167149f1f5a08066
Reviewed-on: https://chromium-review.googlesource.com/c/1352856
Reviewed-by: Avi Drissman <[email protected]>
Reviewed-by: François Doray <[email protected]>
Reviewed-by: Derek Schuff <[email protected]>
Reviewed-by: Łukasz Anforowicz <[email protected]>
Commit-Queue: Alex Moshchuk <[email protected]>
Cr-Commit-Position: refs/heads/master@{#612495}
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
index e283790..09ffaf8 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
@@ -333,14 +333,13 @@
return SiteInstanceImpl::ShouldAssignSiteForURL(url);
}
-// static
-bool SiteInstance::IsSameWebSite(BrowserContext* browser_context,
- const GURL& real_src_url,
- const GURL& real_dest_url) {
- return SiteInstanceImpl::IsSameWebSite(browser_context, real_src_url,
- real_dest_url, true);
+bool SiteInstanceImpl::IsSameSiteWithURL(const GURL& url) {
+ return SiteInstanceImpl::IsSameWebSite(
+ browsing_instance_->browser_context(), site_, url,
+ true /* should_compare_effective_urls */);
}
+// static
bool SiteInstanceImpl::IsSameWebSite(BrowserContext* browser_context,
const GURL& real_src_url,
const GURL& real_dest_url,