Move browser-to-renderer opener plumbing to frame routing IDs.
commit5ac402d1ed5d323a9ea9223c2acf213b5dfc9aaa
authoralexmos <alexmos@chromium.org>
Thu, 9 Jul 2015 07:51:10 +0000 (9 00:51 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 9 Jul 2015 07:51:43 +0000 (9 07:51 +0000)
tree055f09d82095aa9fd7bd69abb10051e50c98a907
parentc912aec70c08c540c65f76a4c7ba6ab4938c2bc2
Move browser-to-renderer opener plumbing to frame routing IDs.

This CL allows a new RenderView to set its main frame's opener to any
frame, rather than a top-level frame.  I.e., it is now possible to use
window.opener to refer to a cross-process subframe.

Summary of changes:

* The ViewMsg_New IPC now passes the opener's frame ID rather than
  view ID.  RenderView::Initialize resolves this into the opener's
  WebFrame.

* The flow of opener routing IDs from RFHM::InitRenderView to
  RenderViewHostImpl::CreateRenderView (which sends the IPC) is moved
  from view to frame IDs.

* The passing of opener routing IDs from CreateOpenerProxies, etc.,
  into RFHM::InitRenderView is removed.  Instead, InitRenderView now
  looks up the proper opener frame routing ID itself.  This is because
  (1) the previous flow would complicate implementing opener updates,
  which would allow subframes to have openers and FrameTrees to have
  more than one opener to traverse, and (2) previous plumbing missed
  some cases (e.g., creating swapped-out RVs via
  CreateRenderFrameProxy or CreateProxiesForSiteInstance), and fixing
  this would add more complexity.

* There are paths where the opener chain is intentionally suppressed
  from a new RenderView, for example for <webview>: see
  WCI::CreateSwappedOutRenderView and EnsureOpenerProxiesExist.  This
  is now supported via an explicit flag which is passed into
  InitRenderView rather than passing around MSG_ROUTING_NONE for the
  opener's routing ID.

BUG=225940, 304341

Review URL: https://codereview.chromium.org/1202593002

Cr-Commit-Position: refs/heads/master@{#337995}
19 files changed:
content/browser/frame_host/frame_tree.cc
content/browser/frame_host/render_frame_host_manager.cc
content/browser/frame_host/render_frame_host_manager.h
content/browser/frame_host/render_frame_host_manager_unittest.cc
content/browser/renderer_host/render_view_host_impl.cc
content/browser/renderer_host/render_view_host_impl.h
content/browser/site_per_process_browsertest.cc
content/browser/web_contents/web_contents_impl.cc
content/browser/web_contents/web_contents_impl.h
content/browser/web_contents/web_contents_impl_unittest.cc
content/common/view_messages.h
content/public/test/render_view_test.cc
content/public/test/test_renderer_host.h
content/renderer/render_view_impl.cc
content/test/data/post_message.html
content/test/test_render_view_host.cc
content/test/test_render_view_host.h
content/test/test_web_contents.cc
content/test/test_web_contents.h