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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 2646683002: Implement OOPIFs within Devtools Extensions (Closed)
Patch Set: fixed bug links in comments Created 3 years, 9 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
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 3a98b03f2430d58d029712a28d04846caf948f84..1e382de01848ae82ef1fc8fcae5c58ce05823357 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -40,6 +40,7 @@
#include "content/common/frame_owner_properties.h"
#include "content/common/site_isolation_policy.h"
#include "content/common/view_messages.h"
+#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_process_host_observer.h"
#include "content/public/browser/render_widget_host_iterator.h"
@@ -1294,6 +1295,19 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
dest_url.SchemeIs(kChromeUIScheme)) {
return SiteInstanceDescriptor(parent_site_instance);
}
+ if (parent_site_instance->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) {
+ url::Origin origin = url::Origin(dest_url);
alexmos 2017/03/20 22:52:51 nit: you can just use url::Origin origin(dest_url)
davidsac (gone - try alexmos) 2017/03/23 01:22:36 Done.
+ auto* policy = ChildProcessSecurityPolicy::GetInstance();
+ // Some non-devtools origins (e.g., devtools extensions) have special
+ // permission to stay in the devtools process.
+ bool is_origin_allowed_in_devtools_process =
+ policy->HasSpecificPermissionForOrigin(
+ parent_site_instance->GetProcess()->GetID(), origin);
+ if (origin.scheme() == kChromeDevToolsScheme ||
+ is_origin_allowed_in_devtools_process) {
+ return SiteInstanceDescriptor(parent_site_instance);
+ }
+ }
}
// If we haven't used our SiteInstance (and thus RVH) yet, then we can use it
@@ -1472,12 +1486,18 @@ bool RenderFrameHostManager::IsRendererTransferNeededForNavigation(
if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kGuestScheme))
return false;
- // Don't swap processes for extensions embedded in DevTools. See
- // https://crbug.com/564216.
+ // Devtools pages and devtools extensions must stay in the devtools process.
+ // See https://crbug.com/564216.
if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) {
- // TODO(nick): https://crbug.com/570483 Check to see if |dest_url| is a
- // devtools extension, and swap processes if not.
- return false;
+ url::Origin origin = url::Origin(dest_url);
alexmos 2017/03/20 22:52:51 Ditto
davidsac (gone - try alexmos) 2017/03/23 01:22:36 Done.
+ auto* policy = ChildProcessSecurityPolicy::GetInstance();
+ // Some non-devtools origins (e.g., devtools extensions) have special
+ // permission to stay in the devtools process.
+ bool is_origin_allowed_in_devtools_process =
+ policy->HasSpecificPermissionForOrigin(rfh->GetProcess()->GetID(),
+ origin);
+ return !(origin.scheme() == kChromeDevToolsScheme ||
+ is_origin_allowed_in_devtools_process);
}
BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext();

Powered by Google App Engine
This is Rietveld 408576698