mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Improve the timing of OnLoadEnd (fixes issue #3341)
Use WebContentsDelegate::DidFinishLoad instead of a custom Mojo message. This fixes flaky OnLoadEnd behavior with NavigationTest.Order.
This commit is contained in:
@ -515,6 +515,20 @@ void CefBrowserContentsDelegate::DidFailLoad(
|
||||
OnLoadEnd(frame, validated_url, error_code);
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::DidFinishLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url) {
|
||||
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||
frame->RefreshAttributes();
|
||||
|
||||
int http_status_code = 0;
|
||||
if (auto response_headers = render_frame_host->GetLastResponseHeaders()) {
|
||||
http_status_code = response_headers->response_code();
|
||||
}
|
||||
|
||||
OnLoadEnd(frame, validated_url, http_status_code);
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::TitleWasSet(content::NavigationEntry* entry) {
|
||||
// |entry| may be NULL if a popup is created via window.open and never
|
||||
// navigated.
|
||||
@ -577,17 +591,6 @@ void CefBrowserContentsDelegate::Observe(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::OnLoadEnd(CefRefPtr<CefFrame> frame,
|
||||
const GURL& url,
|
||||
int http_status_code) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetLoadHandler()) {
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
handler->OnLoadEnd(browser(), frame, http_status_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserContentsDelegate::OnSetFocus(cef_focus_source_t source) {
|
||||
// SetFocus() might be called while inside the OnSetFocus() callback. If
|
||||
// so, don't re-enter the callback.
|
||||
@ -649,6 +652,17 @@ void CefBrowserContentsDelegate::OnLoadStart(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::OnLoadEnd(CefRefPtr<CefFrame> frame,
|
||||
const GURL& url,
|
||||
int http_status_code) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetLoadHandler()) {
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
handler->OnLoadEnd(browser(), frame, http_status_code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::OnLoadError(CefRefPtr<CefFrame> frame,
|
||||
const GURL& url,
|
||||
int error_code) {
|
||||
|
Reference in New Issue
Block a user