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

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

Issue 2646683002: Implement OOPIFs within Devtools Extensions (Closed)
Patch Set: add devtools extension oopif fix implementation Created 3 years, 10 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..56454b4ae5f0c9fb7895c50e2621b1691267d9ca 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"
@@ -49,6 +50,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/referrer.h"
#include "content/public/common/url_constants.h"
+#include "content/public/test/browser_test_utils.h"
namespace content {
@@ -1507,12 +1509,49 @@ 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.
+ /*if (content::AreAllSitesIsolatedForTesting() ||
ncarter (slow) 2017/02/21 22:19:53 It's supposed to be a PRESUBMIT error if you call
davidsac (gone - try alexmos) 2017/03/09 20:21:22 Done.
+ extensions::IsIsolateExtensionsEnabled()) { // TODO get this working
ncarter (slow) 2017/02/21 22:19:53 This function is not known to content; content doe
davidsac (gone - try alexmos) 2017/03/09 20:21:22 Done.
+ // for other modes as well
+ if (url of current parent frame is devtool or about blank) {
+ CHECK(desturl is about blank or devtools or detools extension);
+ } else if (url of current parent frame is devtools
+ extension) { // TODO add tests to embed about url or
+ // devtools page in devtools extension?
+ if (!dest_url is devtools
+ extension) { // TODO or is devtools or about blank?
+ return true;
+ }
+ } else {
+ CHECK(false); // It should not be possible to get here?
+ }
+ }
+ return false;*/
ncarter (slow) 2017/02/21 22:19:53 This commented-out code should not be committed.
davidsac (gone - try alexmos) 2017/03/09 20:21:22 Done.
+
+ url::Origin origin = url::Origin(dest_url);
ncarter (slow) 2017/02/21 22:19:53 What if the origin is unique?
davidsac (gone - try alexmos) 2017/03/09 20:21:22 I'm still not entirely sure what you meant by that
+ auto* policy = content::ChildProcessSecurityPolicy::GetInstance();
+ bool is_allowed_origin = policy->HasSpecificPermissionForOrigin(
+ rfh->GetProcess()->GetID(), origin);
+
+ if (rfh->GetLastCommittedURL().SchemeIs(kChromeDevToolsScheme) ||
ncarter (slow) 2017/02/21 22:19:53 Why would the last committed URL of the frame matt
davidsac (gone - try alexmos) 2017/03/09 20:21:22 Done. This was using a weird strategy to only all
+ rfh->GetLastCommittedURL() == GURL(url::kAboutBlankURL)) {
ncarter (slow) 2017/02/21 22:19:53 Why can we assume that a frame currently with an "
davidsac (gone - try alexmos) 2017/03/09 20:21:22 Done. This was removed after the change in design
+ CHECK(is_allowed_origin);
+ } else { // url of current parent frame must be devtools extension
+ // TODO add tests to embed about url or devtools page in devtools
+ // extension?
+ if (!is_allowed_origin) {
+ return true;
+ }
+ }
+
return false;
+
+ // TODO remove comment
+ // extension/common/extensions.h
+ // childProcessSecurityPolicy::HasSpecificPermissionForOrigin(int child_id,
+ // const url::Origin& origin)
}
BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext();

Powered by Google App Engine
This is Rietveld 408576698