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

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1403343002: Don't grant WebUI bindings during non-WebUI subframe navigations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check if is_active agrees Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 int proxy_routing_id) { 1994 int proxy_routing_id) {
1995 // Ensure the renderer process is initialized before creating the 1995 // Ensure the renderer process is initialized before creating the
1996 // RenderView. 1996 // RenderView.
1997 if (!render_view_host->GetProcess()->Init()) 1997 if (!render_view_host->GetProcess()->Init())
1998 return false; 1998 return false;
1999 1999
2000 // We may have initialized this RenderViewHost for another RenderFrameHost. 2000 // We may have initialized this RenderViewHost for another RenderFrameHost.
2001 if (render_view_host->IsRenderViewLive()) 2001 if (render_view_host->IsRenderViewLive())
2002 return true; 2002 return true;
2003 2003
2004 // If the ongoing navigation is to a WebUI and the RenderView is not in a 2004 // If |render_view_host| is not for a proxy and the navigation is to a WebUI,
2005 // guest process, tell the RenderViewHost about any bindings it will need 2005 // and if the RenderView is not in a guest process, tell |render_view_host|
2006 // enabled. 2006 // about any bindings it will need enabled.
2007 // TODO(carlosk): Move WebUI to RenderFrameHost in https://crbug.com/508850.
2007 WebUIImpl* dest_web_ui = nullptr; 2008 WebUIImpl* dest_web_ui = nullptr;
2008 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2009 DCHECK_EQ(render_view_host->is_active(),
2009 switches::kEnableBrowserSideNavigation)) { 2010 proxy_routing_id == MSG_ROUTING_NONE);
2010 dest_web_ui = 2011 if (proxy_routing_id == MSG_ROUTING_NONE) {
2011 should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get(); 2012 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2012 } else { 2013 switches::kEnableBrowserSideNavigation)) {
2013 dest_web_ui = pending_web_ui(); 2014 dest_web_ui =
2015 should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get();
2016 } else {
2017 dest_web_ui = pending_web_ui();
2018 }
2014 } 2019 }
2015 if (dest_web_ui && !render_view_host->GetProcess()->IsForGuestsOnly()) { 2020 if (dest_web_ui && !render_view_host->GetProcess()->IsForGuestsOnly()) {
2016 render_view_host->AllowBindings(dest_web_ui->GetBindings()); 2021 render_view_host->AllowBindings(dest_web_ui->GetBindings());
2017 } else { 2022 } else {
2018 // Ensure that we don't create an unprivileged RenderView in a WebUI-enabled 2023 // Ensure that we don't create an unprivileged RenderView in a WebUI-enabled
2019 // process unless it's swapped out. 2024 // process unless it's swapped out.
2020 if (render_view_host->is_active()) { 2025 if (render_view_host->is_active()) {
2021 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings( 2026 CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
2022 render_view_host->GetProcess()->GetID())); 2027 render_view_host->GetProcess()->GetID()));
2023 } 2028 }
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2638 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2643 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2639 if (!frame_tree_node_->opener()) 2644 if (!frame_tree_node_->opener())
2640 return MSG_ROUTING_NONE; 2645 return MSG_ROUTING_NONE;
2641 2646
2642 return frame_tree_node_->opener() 2647 return frame_tree_node_->opener()
2643 ->render_manager() 2648 ->render_manager()
2644 ->GetRoutingIdForSiteInstance(instance); 2649 ->GetRoutingIdForSiteInstance(instance);
2645 } 2650 }
2646 2651
2647 } // namespace content 2652 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698