electron/patches/common/chromium/webview_reattach.patch

16 lines
846 B
Diff

diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 11bf320311bb..27f087d4f706 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -4725,6 +4725,11 @@ void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_host,
for (auto& observer : observers_)
observer.RenderViewHostChanged(old_host, new_host);
+ // If this is an inner WebContents that has swapped views, we need to reattach
+ // it to its outer WebContents.
+ if (node_.outer_web_contents())
+ ReattachToOuterWebContentsFrame();
+
// Ensure that the associated embedder gets cleared after a RenderViewHost
// gets swapped, so we don't reuse the same embedder next time a
// RenderViewHost is attached to this WebContents.