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

Unified Diff: chrome/browser/site_details.cc

Issue 1487933002: SiteDetails: use the Origin instead of the URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/site_details.cc
diff --git a/chrome/browser/site_details.cc b/chrome/browser/site_details.cc
index b38c389d48a8e4ba1d3d3250f95511803f2d728f..df14d12cef92657ec338883f7a5a9ccbff4c2f0d 100644
--- a/chrome/browser/site_details.cc
+++ b/chrome/browser/site_details.cc
@@ -8,6 +8,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
+#include "url/origin.h"
#if defined(ENABLE_EXTENSIONS)
#include "extensions/browser/extension_registry.h"
@@ -65,18 +66,15 @@ void CollectForScenario(std::map<RenderFrameHost*, GURL>* frame_urls,
RenderFrameHost* frame) {
BrowserContext* context = primary->GetBrowserContext();
- GURL url = frame->GetLastCommittedURL();
+ // Determine the site from the frame's origin, with a fallback to the
+ // frame's URL. In cases like <iframe sandbox>, we can wind up with an http
+ // URL but a unique origin. The origin of the resource will still determine
+ // process placement.
+ url::Origin origin = frame->GetLastCommittedOrigin();
+ GURL site = SiteInstance::GetSiteForURL(
+ context, origin.unique() ? frame->GetLastCommittedURL()
+ : GURL(origin.Serialize()));
- // Treat about:blank url specially: use the URL on the SiteInstance if it is
- // assigned. The rest of this computation must not depend on the
- // SiteInstance's URL, since its value reflects the current process model, and
- // this computation is simulating other process models.
- if (url == GURL(url::kAboutBlankURL) &&
- !frame->GetSiteInstance()->GetSiteURL().is_empty()) {
- url = frame->GetSiteInstance()->GetSiteURL();
- }
-
- GURL site = SiteInstance::GetSiteForURL(context, url);
bool should_isolate = ShouldIsolate(context, scenario, site);
// Treat a subframe as part of its parent site if neither needs isolation.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698