diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc @@ -7,6 +7,7 @@ #include +#include "base/run_loop.h" #include "base/callback_helpers.h" #include "base/command_line.h" #include "base/containers/contains.h" @@ -9323,6 +9324,14 @@ void RenderFrameHostImpl::ExitFullscreen() { base::RecordAction(base::UserMetricsAction("ExitFullscreen_API")); delegate_->ExitFullscreenMode(/*will_cause_resize=*/true); + // PoC: Pump tasks to allow pending RFHI destruction to process. + // Simulates the race window from ::SetWindowPos nested message loop. + { + base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed); + base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask( + FROM_HERE, run_loop.QuitClosure(), base::Milliseconds(500)); + run_loop.Run(); + } + // The previous call might change the fullscreen state. We need to make sure // the renderer is aware of that, which is done via the resize message.