mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix ceftest failures with BackForwardCache enabled (see issue #2421)
When BackForwardCache is enabled the old RFH tree may be cached instead of being immediately deleted as a result of main frame navigation. If a RFH is cached then delivery of the CefFrameHandler::OnFrameDetached callback will be delayed until the the RFH is ejected from the cache (possibly not occurring until the browser is destroyed). This change in OnFrameDetached timing was causing FrameHandlerTest.OrderSubCrossOrigin* to fail, and the inclusion of cached frames in CefBrowserInfo::GetAllFrames was causing FrameTest.NestedIframesDiffOrigin to fail. BackForwardCache is currently being tested via field trials (see https://crbug.com/1171298) and can be explicitly disabled using the `--disable-back-forward-cache` or `--disable-features=BackForwardCache` command-line flags.
This commit is contained in:
@ -427,18 +427,22 @@ content::RenderFrameHost* CefFrameHostImpl::GetRenderFrameHost() const {
|
||||
return render_frame_host_;
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::Detach() {
|
||||
bool CefFrameHostImpl::Detach() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// May be called multiple times (e.g. from CefBrowserInfo SetMainFrame and
|
||||
// RemoveFrame).
|
||||
bool first_detach = false;
|
||||
|
||||
// Should not be called for temporary frames.
|
||||
DCHECK(!is_temporary());
|
||||
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
|
||||
// Should be called only once.
|
||||
DCHECK(browser_info_);
|
||||
browser_info_ = nullptr;
|
||||
if (browser_info_) {
|
||||
first_detach = true;
|
||||
browser_info_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// In case we never attached, clean up.
|
||||
@ -449,6 +453,8 @@ void CefFrameHostImpl::Detach() {
|
||||
render_frame_.reset();
|
||||
render_frame_host_ = nullptr;
|
||||
is_attached_ = false;
|
||||
|
||||
return first_detach;
|
||||
}
|
||||
|
||||
// static
|
||||
|
Reference in New Issue
Block a user