Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index 3dca1b3cb7e75eea29e27a007fbf5038d317d1c7..2c7c9f51234e3bdf5bfe035b6868c458d8f783e6 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -903,6 +903,7 @@ bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { |
OnUserMetricsRecordAction) |
IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) |
IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) |
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SendPostMessage, OnSendPostMessage) |
IPC_MESSAGE_UNHANDLED_ERROR() |
IPC_END_MESSAGE_MAP_EX() |
@@ -1317,3 +1318,30 @@ void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
MHTMLGenerated(job_id, data_size); |
} |
+ |
+void RenderProcessHostImpl::OnSendPostMessage(int64 browsing_instance_frame_id, |
+ const ViewMsg_PostMessage_Params& params) { |
+ DLOG(WARNING) << "OnSendPostMessage"; |
+ content::FrameMapper& frame_mapper = GetBrowserContext()->frame_mapper(); |
+ content::BrowsingInstanceFrame* frame = |
+ frame_mapper.FindById(browsing_instance_frame_id); |
+ |
+ // Until we remove the proxy when a frame is closed, there might be a proxy |
+ // for a frame that no longer exists. If that's the case, just drop the msg. |
+ if (!frame) { |
+ return; |
+ } |
+ |
+ RenderViewHost *rvh = RenderViewHost::FromID(frame->current_process_host_id(), |
+ frame->current_route_id()); |
+ |
+ // TODO(supersat): Temporary workaround for frames not being removed from |
+ // the mapper properly. |
+ if (!rvh) { |
+ return; |
+ } |
+ |
+ rvh->Send(new ViewMsg_PostMessage(rvh->routing_id(), |
+ frame->current_frame_id(), |
+ params)); |
+} |