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

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

Issue 1454883006: Revert of Reland #1 of: Move WebUI ownership from the RenderFrameHostManager to the RenderFrameHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 14c25ffe34edbe4361dc4fc06f87ead1eabd7593..f2ea2b299d3eba5dae49e59f56e67d5aad973716 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -30,6 +30,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
+#include "content/browser/webui/web_ui_impl.h"
#include "content/common/frame_messages.h"
#include "content/common/site_isolation_policy.h"
#include "content/common/view_messages.h"
@@ -38,6 +39,7 @@
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/user_metrics.h"
+#include "content/public/browser/web_ui_controller.h"
#include "content/public/common/browser_plugin_guest_mode.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/referrer.h"
@@ -205,17 +207,6 @@
return true;
}
-// static
-bool RenderFrameHostManager::ClearWebUIInstances(FrameTreeNode* node) {
- node->current_frame_host()->ClearAllWebUI();
- if (node->render_manager()->pending_render_frame_host_)
- node->render_manager()->pending_render_frame_host_->ClearAllWebUI();
- // PlzNavigate
- if (node->render_manager()->speculative_render_frame_host_)
- node->render_manager()->speculative_render_frame_host_->ClearAllWebUI();
- return true;
-}
-
RenderFrameHostManager::RenderFrameHostManager(
FrameTreeNode* frame_tree_node,
RenderFrameHostDelegate* render_frame_delegate,
@@ -229,6 +220,7 @@
render_widget_delegate_(render_widget_delegate),
proxy_hosts_(new RenderFrameProxyHostMap(this)),
interstitial_page_(nullptr),
+ should_reuse_web_ui_(false),
weak_factory_(this) {
DCHECK(frame_tree_node_);
}
@@ -252,6 +244,10 @@
// RenderFrameProxyHost) points to the RenderWidgetHostView associated with
// the current RenderFrameHost and uses it during its destructor.
ResetProxyHosts();
+
+ // Release the WebUI prior to resetting the current RenderFrameHost, as the
+ // WebUI accesses the RenderFrameHost during cleanup.
+ web_ui_.reset();
// We should always have a current RenderFrameHost except in some tests.
SetRenderFrameHost(scoped_ptr<RenderFrameHostImpl>());
@@ -293,18 +289,6 @@
return pending_render_frame_host_->render_view_host();
}
-WebUIImpl* RenderFrameHostManager::GetNavigatingWebUI() const {
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBrowserSideNavigation)) {
- if (speculative_render_frame_host_)
- return speculative_render_frame_host_->web_ui();
- } else {
- if (pending_render_frame_host_)
- return pending_render_frame_host_->web_ui();
- }
- return render_frame_host_->pending_web_ui();
-}
-
RenderWidgetHostView* RenderFrameHostManager::GetRenderWidgetHostView() const {
if (interstitial_page_)
return interstitial_page_->GetView();
@@ -371,6 +355,27 @@
DCHECK(outer_delegate_frame_tree_node->parent());
outer_delegate_frame_tree_node->frame_tree()->RemoveFrame(
outer_delegate_frame_tree_node);
+}
+
+void RenderFrameHostManager::SetPendingWebUI(const GURL& url, int bindings) {
+ pending_web_ui_ = CreateWebUI(url, bindings);
+ pending_and_current_web_ui_.reset();
+}
+
+scoped_ptr<WebUIImpl> RenderFrameHostManager::CreateWebUI(const GURL& url,
+ int bindings) {
+ scoped_ptr<WebUIImpl> new_web_ui(delegate_->CreateWebUIForRenderManager(url));
+
+ // If we have assigned (zero or more) bindings to this NavigationEntry in the
+ // past, make sure we're not granting it different bindings than it had
+ // before. If so, note it and don't give it any bindings, to avoid a
+ // potential privilege escalation.
+ if (new_web_ui && bindings != NavigationEntryImpl::kInvalidBindings &&
+ new_web_ui->GetBindings() != bindings) {
+ RecordAction(base::UserMetricsAction("ProcessSwapBindingsMismatch_RVHM"));
+ return nullptr;
+ }
+ return new_web_ui.Pass();
}
RenderFrameHostImpl* RenderFrameHostManager::Navigate(
@@ -420,13 +425,6 @@
frame_tree_node_);
if (!InitRenderView(dest_render_frame_host->render_view_host(), nullptr))
return nullptr;
-
- if (GetNavigatingWebUI()) {
- // A new RenderView was created and there is a navigating WebUI which
- // never interacted with it. So notify the WebUI using RenderViewCreated.
- GetNavigatingWebUI()->RenderViewCreated(
- dest_render_frame_host->render_view_host());
- }
// Now that we've created a new renderer, be sure to hide it if it isn't
// our primary one. Otherwise, we might crash if we try to call Show()
@@ -680,15 +678,13 @@
RenderFrameHostImpl* render_frame_host,
bool was_caused_by_user_gesture) {
if (!pending_render_frame_host_ && !speculative_render_frame_host_) {
+ DCHECK(!should_reuse_web_ui_ || web_ui_);
// We should only hear this from our current renderer.
DCHECK_EQ(render_frame_host_.get(), render_frame_host);
- // If the current RenderFrameHost has a pending WebUI it must be committed.
- // Note: When one tries to move same-site commit logic into RenderFrameHost
- // itself, mind that the focus setting logic inside CommitPending also needs
- // to be moved there.
- if (render_frame_host_->pending_web_ui())
+ // Even when there is no pending RVH, there may be a pending Web UI.
+ if (pending_web_ui() || speculative_web_ui_)
CommitPending();
return;
}
@@ -1027,57 +1023,45 @@
// if needed when it no longer breaks OAuth popups (see
// https://crbug.com/440266).
bool is_main_frame = frame_tree_node_->IsMainFrame();
- bool notify_webui_of_rv_creation = false;
if (current_site_instance == dest_site_instance.get() ||
(!request.browser_initiated() && is_main_frame) ||
(!is_main_frame && !dest_site_instance->RequiresDedicatedProcess() &&
!current_site_instance->RequiresDedicatedProcess())) {
- // Reuse the current RenderFrameHost if its SiteInstance matches the
- // navigation's or if this is a subframe navigation. We only swap
- // RenderFrameHosts for subframes when --site-per-process is enabled.
-
- // GetFrameHostForNavigation will be called more than once during a
- // navigation (currently twice, on request and when it's about to commit in
- // the renderer). In the follow up calls an existing pending WebUI should
- // not be recreated if the URL didn't change. So instead of calling
- // CleanUpNavigation just discard the speculative RenderFrameHost if one
- // exists.
- if (speculative_render_frame_host_)
- DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost());
-
- UpdatePendingWebUIOnCurrentFrameHost(request.common_params().url,
- request.bindings());
-
+ // Reuse the current RFH if its SiteInstance matches the the navigation's
+ // or if this is a subframe navigation. We only swap RFHs for subframes when
+ // --site-per-process is enabled.
+ CleanUpNavigation();
navigation_rfh = render_frame_host_.get();
- DCHECK(!speculative_render_frame_host_);
+ // As SiteInstances are the same, check if the WebUI should be reused.
+ const NavigationEntry* current_navigation_entry =
+ delegate_->GetLastCommittedNavigationEntryForRenderManager();
+ should_reuse_web_ui_ = ShouldReuseWebUI(current_navigation_entry,
+ request.common_params().url);
+ if (!should_reuse_web_ui_) {
+ speculative_web_ui_ = CreateWebUI(request.common_params().url,
+ request.bindings());
+ // Make sure the current RenderViewHost has the right bindings.
+ if (speculative_web_ui() &&
+ !render_frame_host_->GetProcess()->IsForGuestsOnly()) {
+ render_frame_host_->render_view_host()->AllowBindings(
+ speculative_web_ui()->GetBindings());
+ }
+ }
} else {
- // If the current RenderFrameHost cannot be used a speculative one is
- // created with the SiteInstance for the current URL. If a speculative
- // RenderFrameHost already exists we try as much as possible to reuse it and
- // its associated WebUI.
-
- // Check if an existing speculative RenderFrameHost can be reused.
+ // If the SiteInstance for the final URL doesn't match the one from the
+ // speculatively created RenderFrameHost, create a new RenderFrameHost using
+ // this new SiteInstance.
if (!speculative_render_frame_host_ ||
speculative_render_frame_host_->GetSiteInstance() !=
dest_site_instance.get()) {
- // If a previous speculative RenderFrameHost didn't exist or if its
- // SiteInstance differs from the one for the current URL, a new one needs
- // to be created.
CleanUpNavigation();
- bool success = CreateSpeculativeRenderFrameHost(current_site_instance,
- dest_site_instance.get());
+ bool success = CreateSpeculativeRenderFrameHost(
+ request.common_params().url, current_site_instance,
+ dest_site_instance.get(), request.bindings());
DCHECK(success);
}
DCHECK(speculative_render_frame_host_);
-
- bool changed_web_ui = speculative_render_frame_host_->UpdatePendingWebUI(
- request.common_params().url, request.bindings());
- speculative_render_frame_host_->CommitPendingWebUI();
- DCHECK_EQ(GetNavigatingWebUI(), speculative_render_frame_host_->web_ui());
- notify_webui_of_rv_creation =
- changed_web_ui && speculative_render_frame_host_->web_ui();
-
navigation_rfh = speculative_render_frame_host_.get();
// Check if our current RFH is live.
@@ -1099,9 +1083,9 @@
if (!navigation_rfh->IsRenderFrameLive()) {
// Recreate the opener chain.
CreateOpenerProxies(navigation_rfh->GetSiteInstance(), frame_tree_node_);
- if (!InitRenderView(navigation_rfh->render_view_host(), nullptr))
+ if (!InitRenderView(navigation_rfh->render_view_host(), nullptr)) {
return nullptr;
- notify_webui_of_rv_creation = true;
+ }
if (navigation_rfh == render_frame_host_.get()) {
// TODO(nasko): This is a very ugly hack. The Chrome extensions process
@@ -1113,14 +1097,7 @@
delegate_->NotifyMainFrameSwappedFromRenderManager(
nullptr, render_frame_host_->render_view_host());
}
- DCHECK(navigation_rfh->IsRenderFrameLive());
- }
-
- // If a WebUI was created in a speculative RenderFrameHost or a new RenderView
- // was created then the WebUI never interacted with the RenderView. Notify
- // using RenderViewCreated.
- if (notify_webui_of_rv_creation && GetNavigatingWebUI())
- GetNavigatingWebUI()->RenderViewCreated(navigation_rfh->render_view_host());
+ }
return navigation_rfh;
}
@@ -1129,7 +1106,8 @@
void RenderFrameHostManager::CleanUpNavigation() {
CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation));
- render_frame_host_->ClearPendingWebUI();
+ speculative_web_ui_.reset();
+ should_reuse_web_ui_ = false;
if (speculative_render_frame_host_)
DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost());
}
@@ -1320,6 +1298,18 @@
return true;
return false;
+}
+
+bool RenderFrameHostManager::ShouldReuseWebUI(
+ const NavigationEntry* current_entry,
+ const GURL& new_url) const {
+ NavigationControllerImpl& controller =
+ delegate_->GetControllerForRenderManager();
+ return current_entry && web_ui_ &&
+ (WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType(
+ controller.GetBrowserContext(), current_entry->GetURL()) ==
+ WebUIControllerFactoryRegistry::GetInstance()->GetWebUIType(
+ controller.GetBrowserContext(), new_url));
}
SiteInstance* RenderFrameHostManager::GetSiteInstanceForNavigation(
@@ -1654,8 +1644,8 @@
CreateProxiesForNewRenderFrameHost(old_instance, new_instance);
// Create a non-swapped-out RFH with the given opener.
- pending_render_frame_host_ =
- CreateRenderFrame(new_instance, create_render_frame_flags, nullptr);
+ pending_render_frame_host_ = CreateRenderFrame(
+ new_instance, pending_web_ui(), create_render_frame_flags, nullptr);
}
void RenderFrameHostManager::CreateProxiesForNewRenderFrameHost(
@@ -1751,10 +1741,18 @@
// PlzNavigate
bool RenderFrameHostManager::CreateSpeculativeRenderFrameHost(
+ const GURL& url,
SiteInstance* old_instance,
- SiteInstance* new_instance) {
+ SiteInstance* new_instance,
+ int bindings) {
CHECK(new_instance);
CHECK_NE(old_instance, new_instance);
+ CHECK(!should_reuse_web_ui_);
+
+ // Note: |speculative_web_ui_| must be initialized before starting the
+ // |speculative_render_frame_host_| creation steps otherwise the WebUI
+ // won't be properly initialized.
+ speculative_web_ui_ = CreateWebUI(url, bindings);
// The process for the new SiteInstance may (if we're sharing a process with
// another host that already initialized it) or may not (we have our own
@@ -1769,13 +1767,19 @@
if (delegate_->IsHidden())
create_render_frame_flags |= CREATE_RF_HIDDEN;
speculative_render_frame_host_ =
- CreateRenderFrame(new_instance, create_render_frame_flags, nullptr);
-
- return !!speculative_render_frame_host_;
+ CreateRenderFrame(new_instance, speculative_web_ui_.get(),
+ create_render_frame_flags, nullptr);
+
+ if (!speculative_render_frame_host_) {
+ speculative_web_ui_.reset();
+ return false;
+ }
+ return true;
}
scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame(
SiteInstance* instance,
+ WebUIImpl* web_ui,
int flags,
int* view_routing_id_ptr) {
bool swapped_out = !!(flags & CREATE_RF_SWAPPED_OUT);
@@ -1893,6 +1897,21 @@
}
}
+ // When a new RenderView is created by the renderer process, the new
+ // WebContents gets a RenderViewHost in the SiteInstance of its opener
+ // WebContents. If not used in the first navigation, this RVH is swapped out
+ // and is not granted bindings, so we may need to grant them when swapping it
+ // in.
+ if (web_ui && !new_render_frame_host->GetProcess()->IsForGuestsOnly()) {
+ int required_bindings = web_ui->GetBindings();
+ RenderViewHost* render_view_host =
+ new_render_frame_host->render_view_host();
+ if ((render_view_host->GetEnabledBindings() & required_bindings) !=
+ required_bindings) {
+ render_view_host->AllowBindings(required_bindings);
+ }
+ }
+
// Returns the new RFH if it isn't swapped out.
if (success && !swapped_out) {
DCHECK(new_render_frame_host->GetSiteInstance() == instance);
@@ -2010,6 +2029,31 @@
// We may have initialized this RenderViewHost for another RenderFrameHost.
if (render_view_host->IsRenderViewLive())
return true;
+
+ // If |render_view_host| is not for a proxy and the navigation is to a WebUI,
+ // and if the RenderView is not in a guest process, tell |render_view_host|
+ // about any bindings it will need enabled.
+ // TODO(carlosk): Move WebUI to RenderFrameHost in https://crbug.com/508850.
+ WebUIImpl* dest_web_ui = nullptr;
+ if (!proxy) {
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation)) {
+ dest_web_ui =
+ should_reuse_web_ui_ ? web_ui_.get() : speculative_web_ui_.get();
+ } else {
+ dest_web_ui = pending_web_ui();
+ }
+ }
+ if (dest_web_ui && !render_view_host->GetProcess()->IsForGuestsOnly()) {
+ render_view_host->AllowBindings(dest_web_ui->GetBindings());
+ } else {
+ // Ensure that we don't create an unprivileged RenderView in a WebUI-enabled
+ // process unless it's swapped out.
+ if (render_view_host->is_active()) {
+ CHECK(!ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
+ render_view_host->GetProcess()->GetID()));
+ }
+ }
int opener_frame_routing_id =
GetOpenerRoutingID(render_view_host->GetSiteInstance());
@@ -2102,17 +2146,42 @@
void RenderFrameHostManager::CommitPending() {
TRACE_EVENT1("navigation", "RenderFrameHostManager::CommitPending",
"FrameTreeNode id", frame_tree_node_->frame_tree_node_id());
+ bool browser_side_navigation =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation);
+
// First check whether we're going to want to focus the location bar after
// this commit. We do this now because the navigation hasn't formally
- // committed yet, so if we've already cleared the pending WebUI the call chain
+ // committed yet, so if we've already cleared |pending_web_ui_| the call chain
// this triggers won't be able to figure out what's going on.
bool will_focus_location_bar = delegate_->FocusLocationBarByDefault();
- // If the current RenderFrameHost has a pending WebUI then just commit it and
- // return (there should be nothing else to commit).
- if (render_frame_host_->pending_web_ui()) {
- DCHECK(!pending_render_frame_host_ && !speculative_render_frame_host_);
- render_frame_host_->CommitPendingWebUI();
+ // Next commit the Web UI, if any. Either replace |web_ui_| with
+ // |pending_web_ui_|, or clear |web_ui_| if there is no pending WebUI, or
+ // leave |web_ui_| as is if reusing it.
+ DCHECK(!(pending_web_ui_ && pending_and_current_web_ui_));
+ if (pending_web_ui_ || speculative_web_ui_) {
+ DCHECK(!should_reuse_web_ui_);
+ web_ui_.reset(browser_side_navigation ? speculative_web_ui_.release()
+ : pending_web_ui_.release());
+ } else if (pending_and_current_web_ui_ || should_reuse_web_ui_) {
+ if (browser_side_navigation) {
+ DCHECK(web_ui_);
+ should_reuse_web_ui_ = false;
+ } else {
+ DCHECK_EQ(pending_and_current_web_ui_.get(), web_ui_.get());
+ pending_and_current_web_ui_.reset();
+ }
+ } else {
+ web_ui_.reset();
+ }
+ DCHECK(!speculative_web_ui_);
+ DCHECK(!should_reuse_web_ui_);
+
+ // It's possible for the pending_render_frame_host_ to be nullptr when we
+ // aren't crossing process boundaries. If so, we just needed to handle the Web
+ // UI committing above and we're done.
+ if (!pending_render_frame_host_ && !speculative_render_frame_host_) {
if (will_focus_location_bar)
delegate_->SetFocusToLocationBar(false);
return;
@@ -2129,8 +2198,7 @@
// Swap in the pending or speculative frame and make it active. Also ensure
// the FrameTree stays in sync.
scoped_ptr<RenderFrameHostImpl> old_render_frame_host;
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBrowserSideNavigation)) {
+ if (!browser_side_navigation) {
DCHECK(!speculative_render_frame_host_);
old_render_frame_host =
SetRenderFrameHost(pending_render_frame_host_.Pass());
@@ -2300,6 +2368,9 @@
dest_url, source_instance, dest_instance, nullptr, transition,
dest_is_restore, dest_is_view_source_mode);
+ const NavigationEntry* current_entry =
+ delegate_->GetLastCommittedNavigationEntryForRenderManager();
+
DCHECK(!pending_render_frame_host_);
if (new_instance.get() != current_instance) {
@@ -2312,22 +2383,16 @@
// New SiteInstance: create a pending RFH to navigate.
+ // This will possibly create (set to nullptr) a Web UI object for the
+ // pending page. We'll use this later to give the page special access. This
+ // must happen before the new renderer is created below so it will get
+ // bindings. It must also happen after the above conditional call to
+ // CancelPending(), otherwise CancelPending may clear the pending_web_ui_
+ // and the page will not have its bindings set appropriately.
+ SetPendingWebUI(dest_url, bindings);
CreatePendingRenderFrameHost(current_instance, new_instance.get());
- DCHECK(pending_render_frame_host_);
if (!pending_render_frame_host_)
return nullptr;
-
- pending_render_frame_host_->UpdatePendingWebUI(dest_url, bindings);
- pending_render_frame_host_->CommitPendingWebUI();
- DCHECK_EQ(GetNavigatingWebUI(), pending_render_frame_host_->web_ui());
-
- // If a WebUI exists in the pending RenderFrameHost it was just created, as
- // well as the RenderView, and they never interacted. So notify it using
- // RenderViewCreated.
- if (pending_render_frame_host_->web_ui()) {
- pending_render_frame_host_->web_ui()->RenderViewCreated(
- pending_render_frame_host_->render_view_host());
- }
// Check if our current RFH is live before we set up a transition.
if (!render_frame_host_->IsRenderFrameLive()) {
@@ -2341,12 +2406,16 @@
}
// Otherwise, it's safe to treat this as a pending cross-process transition.
+ // We now have a pending RFH.
+ DCHECK(pending_render_frame_host_);
+
// We need to wait until the beforeunload handler has run, unless we are
// transferring an existing request (in which case it has already run).
// Suspend the new render view (i.e., don't let it send the cross-process
// Navigate message) until we hear back from the old renderer's
// beforeunload handler. If the handler returns false, we'll have to
// cancel the request.
+ //
DCHECK(!pending_render_frame_host_->are_navigations_suspended());
bool is_transfer = transferred_request_id != GlobalRequestID();
if (is_transfer) {
@@ -2369,7 +2438,6 @@
render_frame_host_->DispatchBeforeUnload(true);
}
- DCHECK(!render_frame_host_->pending_web_ui());
return pending_render_frame_host_.get();
}
@@ -2382,7 +2450,23 @@
// delete the proxy.
proxy_hosts_->Remove(new_instance.get()->GetId());
- UpdatePendingWebUIOnCurrentFrameHost(dest_url, bindings);
+ if (ShouldReuseWebUI(current_entry, dest_url)) {
+ pending_web_ui_.reset();
+ pending_and_current_web_ui_ = web_ui_->AsWeakPtr();
+ } else {
+ SetPendingWebUI(dest_url, bindings);
+ // Make sure the new RenderViewHost has the right bindings.
+ if (pending_web_ui() &&
+ !render_frame_host_->GetProcess()->IsForGuestsOnly()) {
+ render_frame_host_->render_view_host()->AllowBindings(
+ pending_web_ui()->GetBindings());
+ }
+ }
+
+ if (pending_web_ui() && render_frame_host_->IsRenderFrameLive()) {
+ pending_web_ui()->RenderViewReused(render_frame_host_->render_view_host(),
+ frame_tree_node_->IsMainFrame());
+ }
// The renderer can exit view source mode when any error or cancellation
// happen. We must overwrite to recover the mode.
@@ -2395,39 +2479,9 @@
return render_frame_host_.get();
}
-void RenderFrameHostManager::UpdatePendingWebUIOnCurrentFrameHost(
- const GURL& dest_url,
- int entry_bindings) {
- bool pending_webui_changed =
- render_frame_host_->UpdatePendingWebUI(dest_url, entry_bindings);
- DCHECK_EQ(GetNavigatingWebUI(), render_frame_host_->pending_web_ui());
-
- if (render_frame_host_->pending_web_ui() && pending_webui_changed &&
- render_frame_host_->IsRenderFrameLive()) {
- // If a pending WebUI exists in the current RenderFrameHost and it has been
- // updated and the associated RenderFrame is alive, notify the WebUI about
- // the RenderView.
- // Note: If the RenderFrame is not alive at this point the notification will
- // happen later, when the RenderView is created.
- if (render_frame_host_->pending_web_ui() == render_frame_host_->web_ui()) {
- // If the active WebUI is being reused it has already interacting with
- // this RenderView in the past, so call RenderViewReused.
- render_frame_host_->pending_web_ui()->RenderViewReused(
- render_frame_host_->render_view_host(),
- frame_tree_node_->IsMainFrame());
- } else {
- // If this is a new WebUI it has never interacted with the existing
- // RenderView so call RenderViewCreated.
- render_frame_host_->pending_web_ui()->RenderViewCreated(
- render_frame_host_->render_view_host());
- }
- }
-}
-
void RenderFrameHostManager::CancelPending() {
TRACE_EVENT1("navigation", "RenderFrameHostManager::CancelPending",
"FrameTreeNode id", frame_tree_node_->frame_tree_node_id());
- render_frame_host_->ClearPendingWebUI();
DiscardUnusedFrame(UnsetPendingRenderFrameHost());
}
@@ -2442,6 +2496,9 @@
// We no longer need to prevent the process from exiting.
pending_render_frame_host->GetProcess()->RemovePendingView();
+
+ pending_web_ui_.reset();
+ pending_and_current_web_ui_.reset();
return pending_render_frame_host.Pass();
}
@@ -2617,7 +2674,8 @@
frame_tree->root()->render_manager()->CreateRenderFrameProxy(instance);
} else {
frame_tree->root()->render_manager()->CreateRenderFrame(
- instance, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN, nullptr);
+ instance, nullptr, CREATE_RF_SWAPPED_OUT | CREATE_RF_HIDDEN,
+ nullptr);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698