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

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

Issue 2646683002: Implement OOPIFs within Devtools Extensions (Closed)
Patch Set: added test for renavigating to about:blank 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 6de0f24d8ae81b9428617f5287e1fd7fc76a9562..3d844eaf47fcbdb705d8abe7b3cd3105e8d39f58 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"
@@ -1337,6 +1338,19 @@ RenderFrameHostManager::DetermineSiteInstanceForURL(
dest_url.SchemeIs(kChromeUIScheme)) {
return SiteInstanceDescriptor(parent_site_instance);
}
+ if (parent_site_instance->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) {
ncarter (slow) 2017/03/09 23:28:49 I think using |frame_tree_node_->parent()| is prob
alexmos 2017/03/10 21:18:26 Yes, I think we chatted about using the root here
davidsac (gone - try alexmos) 2017/03/11 01:51:47 Yeah, Alex pretty much covered it all. Even if a
+ url::Origin origin = url::Origin(dest_url);
+ auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
ncarter (slow) 2017/03/09 23:28:49 content:: is unnecessary here; we're already in th
davidsac (gone - try alexmos) 2017/03/11 01:51:47 Done.
+ bool is_devtools_extension =
ncarter (slow) 2017/03/09 23:28:49 Technically using 'extension' in this variable nam
davidsac (gone - try alexmos) 2017/03/11 01:51:47 Done.
+ policy->HasSpecificPermissionForOrigin(frame_tree_node_->parent()
+ ->current_frame_host()
+ ->GetProcess()
ncarter (slow) 2017/03/09 23:28:49 Instead of calling GetProcess on current_frame_hos
davidsac (gone - try alexmos) 2017/03/11 01:51:47 Done.
+ ->GetID(),
+ origin);
+ if (dest_url.SchemeIs(kChromeDevToolsScheme) || is_devtools_extension) {
ncarter (slow) 2017/03/09 23:28:49 Since you've already computed |origin|, it's proba
davidsac (gone - try alexmos) 2017/03/11 01:51:47 Done, I think? I used |origin.scheme()==kChromeDe
+ return SiteInstanceDescriptor(parent_site_instance);
+ }
+ }
}
// If we haven't used our SiteInstance (and thus RVH) yet, then we can use it
@@ -1507,12 +1521,14 @@ 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.
+ // Don't swap processes for devtools extensions embedded in DevTools, except
+ // for external navigations in iframes. 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);
+ auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
ncarter (slow) 2017/03/09 23:28:49 content:: is unnecessary here, we're already insid
davidsac (gone - try alexmos) 2017/03/11 01:51:47 Done.
+ bool is_devtools_extension = policy->HasSpecificPermissionForOrigin(
+ rfh->GetProcess()->GetID(), origin);
+ return !(dest_url.SchemeIs(kChromeDevToolsScheme) || is_devtools_extension);
ncarter (slow) 2017/03/09 23:28:49 As above, checking the scheme on |origin| instead
davidsac (gone - try alexmos) 2017/03/11 01:51:47 Done, I think? I used |origin.scheme()==kChromeDe
}
BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext();

Powered by Google App Engine
This is Rietveld 408576698