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

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

Issue 1039403002: OOPIF: Remove the FrameTreeNode when a RemoteFrame is detached. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add security checks Created 5 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_proxy_host.cc
diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc
index 988f9e876b4bdc989331f534aed27ff9014d36f5..597012084ead267fa2245ce8e8e0a2522433b333 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -116,6 +116,7 @@ bool RenderFrameProxyHost::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(RenderFrameProxyHost, msg)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_Detach, OnDetach)
IPC_MESSAGE_HANDLER(FrameHostMsg_OpenURL, OnOpenURL)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -157,8 +158,22 @@ void RenderFrameProxyHost::DisownOpener() {
Send(new FrameMsg_DisownOpener(GetRoutingID()));
}
+void RenderFrameProxyHost::OnDetach() {
+ // This message should only be received for subframes, and only from processes
+ // of its ancestor frames (which have the ability to remove it).
+ if (frame_tree_node_->IsMainFrame() ||
+ !frame_tree_node_->HasAncestorFrom(GetSiteInstance())) {
+ // TODO(creis): Use updated contract for ReceivedBadMessage.
+ GetProcess()->ReceivedBadMessage();
+ return;
+ }
+ frame_tree_node_->frame_tree()->RemoveFrame(frame_tree_node_);
+}
+
void RenderFrameProxyHost::OnOpenURL(
const FrameHostMsg_OpenURL_Params& params) {
+ // TODO(creis): Verify that we are in the same BrowsingInstance as the current
+ // RenderFrameHost. See NavigatorImpl::RequestOpenURL.
frame_tree_node_->current_frame_host()->OpenURL(params, site_instance_.get());
}

Powered by Google App Engine
This is Rietveld 408576698