Reuse RemoteFrameView in plugin elements

During lazy reattach, a plugin element disposes of its current
OwnedEmbeddedContentView. For frames, this means the FrameView is
disposed of.

After update, if the plugin requests a frame again, it will:
  1- Create a LocalFrameView in case the target frame is local. This
  happens when DocumentLoader commits.
  2- Does nothing if target frame is remote, in which case the plugin
  element appears frozen.

An attempt to properly detach the ContentFrame during plugin updates
(which would omit this problem altogether) was tried in an earlier attempt
(CL 996314). It turns out detaching the frame during either update or
reattach phase could synchronously run scripts which rely on the frame
(often through window proxy) and detaching the frame in those cases is
not safe (hence 996314 got reverted). A proper clean up fix for plugins
is still a work in progress.

This CL instead aims at fixing some of the more blatant OOPIF plugin
elements bugs. Essentially most of these bugs occur due to losing ECV during
reattaching. This change fixes the issue by reinserting the RemoteFrameView
when plugin is updated (into a frame type).

(cherry picked from commit 830c8fce7fd31522bb848a24ea69ff2b77c7ce2f)

Bug: 781880, 908271
Change-Id: I9e723434d44f8b8c330aa66981c17bc479c753f5
Commit-Queue: Ehsan Karamad <>
Reviewed-by: Alex Moshchuk <>
Reviewed-by: Daniel Cheng <>
Cr-Original-Commit-Position: refs/heads/master@{#626624}
Reviewed-by: Ehsan Karamad <>
Cr-Commit-Position: refs/branch-heads/3683@{#147}
Cr-Branched-From: e51029943e0a38dd794b73caaf6373d5496ae783-refs/heads/master@{#625896}
2 files changed