Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/frame_host/render_frame_host_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #include "content/browser/frame_host/render_frame_proxy_host.h" | 33 #include "content/browser/frame_host/render_frame_proxy_host.h" |
| 34 #include "content/browser/renderer_host/render_process_host_impl.h" | 34 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 35 #include "content/browser/renderer_host/render_view_host_factory.h" | 35 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 36 #include "content/browser/renderer_host/render_view_host_impl.h" | 36 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 37 #include "content/browser/site_instance_impl.h" | 37 #include "content/browser/site_instance_impl.h" |
| 38 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 38 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 39 #include "content/common/frame_messages.h" | 39 #include "content/common/frame_messages.h" |
| 40 #include "content/common/frame_owner_properties.h" | 40 #include "content/common/frame_owner_properties.h" |
| 41 #include "content/common/site_isolation_policy.h" | 41 #include "content/common/site_isolation_policy.h" |
| 42 #include "content/common/view_messages.h" | 42 #include "content/common/view_messages.h" |
| 43 #include "content/public/browser/child_process_security_policy.h" | |
| 43 #include "content/public/browser/content_browser_client.h" | 44 #include "content/public/browser/content_browser_client.h" |
| 44 #include "content/public/browser/render_process_host_observer.h" | 45 #include "content/public/browser/render_process_host_observer.h" |
| 45 #include "content/public/browser/render_widget_host_iterator.h" | 46 #include "content/public/browser/render_widget_host_iterator.h" |
| 46 #include "content/public/browser/render_widget_host_view.h" | 47 #include "content/public/browser/render_widget_host_view.h" |
| 47 #include "content/public/browser/user_metrics.h" | 48 #include "content/public/browser/user_metrics.h" |
| 48 #include "content/public/common/browser_side_navigation_policy.h" | 49 #include "content/public/common/browser_side_navigation_policy.h" |
| 49 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
| 50 #include "content/public/common/referrer.h" | 51 #include "content/public/common/referrer.h" |
| 51 #include "content/public/common/url_constants.h" | 52 #include "content/public/common/url_constants.h" |
| 53 #include "content/public/test/browser_test_utils.h" | |
| 52 | 54 |
| 53 namespace content { | 55 namespace content { |
| 54 | 56 |
| 55 RenderFrameHostManager::RenderFrameHostManager( | 57 RenderFrameHostManager::RenderFrameHostManager( |
| 56 FrameTreeNode* frame_tree_node, | 58 FrameTreeNode* frame_tree_node, |
| 57 RenderFrameHostDelegate* render_frame_delegate, | 59 RenderFrameHostDelegate* render_frame_delegate, |
| 58 RenderWidgetHostDelegate* render_widget_delegate, | 60 RenderWidgetHostDelegate* render_widget_delegate, |
| 59 Delegate* delegate) | 61 Delegate* delegate) |
| 60 : frame_tree_node_(frame_tree_node), | 62 : frame_tree_node_(frame_tree_node), |
| 61 delegate_(delegate), | 63 delegate_(delegate), |
| (...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1500 const GURL& dest_url) { | 1502 const GURL& dest_url) { |
| 1501 // A transfer is not needed if the current SiteInstance doesn't yet have a | 1503 // A transfer is not needed if the current SiteInstance doesn't yet have a |
| 1502 // site. This is the case for tests that use NavigateToURL. | 1504 // site. This is the case for tests that use NavigateToURL. |
| 1503 if (!rfh->GetSiteInstance()->HasSite()) | 1505 if (!rfh->GetSiteInstance()->HasSite()) |
| 1504 return false; | 1506 return false; |
| 1505 | 1507 |
| 1506 // We do not currently swap processes for navigations in webview tag guests. | 1508 // We do not currently swap processes for navigations in webview tag guests. |
| 1507 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kGuestScheme)) | 1509 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kGuestScheme)) |
| 1508 return false; | 1510 return false; |
| 1509 | 1511 |
| 1510 // Don't swap processes for extensions embedded in DevTools. See | 1512 // Don't swap processes for devtools extensions embedded in DevTools, except |
| 1511 // https://crbug.com/564216. | 1513 // for external navigations in iframes. See https://crbug.com/564216. |
| 1512 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) { | 1514 if (rfh->GetSiteInstance()->GetSiteURL().SchemeIs(kChromeDevToolsScheme)) { |
| 1513 // TODO(nick): https://crbug.com/570483 Check to see if |dest_url| is a | 1515 /*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.
| |
| 1514 // devtools extension, and swap processes if not. | 1516 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.
| |
| 1517 // for other modes as well | |
| 1518 if (url of current parent frame is devtool or about blank) { | |
| 1519 CHECK(desturl is about blank or devtools or detools extension); | |
| 1520 } else if (url of current parent frame is devtools | |
| 1521 extension) { // TODO add tests to embed about url or | |
| 1522 // devtools page in devtools extension? | |
| 1523 if (!dest_url is devtools | |
| 1524 extension) { // TODO or is devtools or about blank? | |
| 1525 return true; | |
| 1526 } | |
| 1527 } else { | |
| 1528 CHECK(false); // It should not be possible to get here? | |
| 1529 } | |
| 1530 } | |
| 1531 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.
| |
| 1532 | |
| 1533 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
| |
| 1534 auto* policy = content::ChildProcessSecurityPolicy::GetInstance(); | |
| 1535 bool is_allowed_origin = policy->HasSpecificPermissionForOrigin( | |
| 1536 rfh->GetProcess()->GetID(), origin); | |
| 1537 | |
| 1538 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
| |
| 1539 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
| |
| 1540 CHECK(is_allowed_origin); | |
| 1541 } else { // url of current parent frame must be devtools extension | |
| 1542 // TODO add tests to embed about url or devtools page in devtools | |
| 1543 // extension? | |
| 1544 if (!is_allowed_origin) { | |
| 1545 return true; | |
| 1546 } | |
| 1547 } | |
| 1548 | |
| 1515 return false; | 1549 return false; |
| 1550 | |
| 1551 // TODO remove comment | |
| 1552 // extension/common/extensions.h | |
| 1553 // childProcessSecurityPolicy::HasSpecificPermissionForOrigin(int child_id, | |
| 1554 // const url::Origin& origin) | |
| 1516 } | 1555 } |
| 1517 | 1556 |
| 1518 BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext(); | 1557 BrowserContext* context = rfh->GetSiteInstance()->GetBrowserContext(); |
| 1519 // TODO(nasko, nick): These following --site-per-process checks are | 1558 // TODO(nasko, nick): These following --site-per-process checks are |
| 1520 // overly simplistic. Update them to match all the cases | 1559 // overly simplistic. Update them to match all the cases |
| 1521 // considered by DetermineSiteInstanceForURL. | 1560 // considered by DetermineSiteInstanceForURL. |
| 1522 if (IsCurrentlySameSite(rfh, dest_url)) { | 1561 if (IsCurrentlySameSite(rfh, dest_url)) { |
| 1523 // The same site, no transition needed for security purposes, and we must | 1562 // The same site, no transition needed for security purposes, and we must |
| 1524 // keep the same SiteInstance for correctness of synchronous scripting. | 1563 // keep the same SiteInstance for correctness of synchronous scripting. |
| 1525 return false; | 1564 return false; |
| (...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2782 resolved_url)) { | 2821 resolved_url)) { |
| 2783 DCHECK(!dest_instance || | 2822 DCHECK(!dest_instance || |
| 2784 dest_instance == render_frame_host_->GetSiteInstance()); | 2823 dest_instance == render_frame_host_->GetSiteInstance()); |
| 2785 return false; | 2824 return false; |
| 2786 } | 2825 } |
| 2787 | 2826 |
| 2788 return true; | 2827 return true; |
| 2789 } | 2828 } |
| 2790 | 2829 |
| 2791 } // namespace content | 2830 } // namespace content |
| OLD | NEW |