diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -9717,6 +9717,14 @@ ForSecurityDropFullscreen(display_id).RunAndReset(); + // Widen race window: pump nestable tasks so pending WebContents + // destruction can execute. Simulates the natural race from + // ::SetWindowPos nested message loop on Windows. + { + base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed); + base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask( + FROM_HERE, run_loop.QuitClosure(), base::Milliseconds(2000)); + run_loop.Run(); + } + delegate_->SetContentsBounds(this, bounds); }