CEF 3.33239 - renderer no longer gets OnLoadingStateChange ?

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CEF 3.33239 - renderer no longer gets OnLoadingStateChange ?

Postby HarmlessDave » Tue Jan 30, 2018 7:21 pm

Up through at least 3.2924 both the browser and renderer processes received OnLoadingStateChange events, but now I only see the browser event.

Am I missing something, or do I need to send messages to the renderer process myself if I want it to do something like inject JavaScript once a document has (more or less) loaded?
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm

Re: CEF 3.33239 - renderer no longer gets OnLoadingStateChan

Postby amaitland » Tue Jan 30, 2018 10:53 pm

Could be related to https://bitbucket.org/chromiumembedded/ ... navigation

There is a command line arg to use the old behavior, might be worth a try.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: CEF 3.33239 - renderer no longer gets OnLoadingStateChan

Postby ndesktop » Wed Jan 31, 2018 3:32 am

Looking in source of 3239 branch:
Code: Select all
void CefBrowserImpl::OnLoadingStateChange(bool isLoading) {
  CefRefPtr<CefApp> app = CefContentClient::Get()->application();
  if (app.get()) {
    CefRefPtr<CefRenderProcessHandler> handler = app->GetRenderProcessHandler();
    if (handler.get()) {
      CefRefPtr<CefLoadHandler> load_handler = handler->GetLoadHandler();
      if (load_handler.get()) {
        WebView* web_view = render_view()->GetWebView();
        const bool canGoBack = webkit_glue::CanGoBack(web_view);
        const bool canGoForward = webkit_glue::CanGoForward(web_view);

        load_handler->OnLoadingStateChange(this, isLoading, canGoBack,
                                           canGoForward);
      }
    }
  }
}


Looking from source it should be invoked in renderer. (Browser is invoked from libcef/browser/browser_host_impl.cc in CefBrowserHostImpl::LoadingStateChanged).
CefRenderProcessHandler implements GetLoadHandler and returns a CefLoadHandler (either the this or a delegate) which in turn implements OnLoadingStateChange.

CefBrowserImpl::OnLoadingStateChange (from libcef/renderer/browser_impl.cpp) is invoked from CefBrowserImpl::DidStartLoading/DidStopLoading.
The only way to not be invoked would be that CefBrowserImpl::DidStartLoading is not invoked, which I found hard to believe.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: CEF 3.33239 - renderer no longer gets OnLoadingStateChan

Postby amaitland » Wed Jan 31, 2018 6:17 am

Chromium is actively removing navigation code from the render process, CefCefRenderProcessHandler::OnBeforeNavigation will be removed for example.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: CEF 3.33239 - renderer no longer gets OnLoadingStateChan

Postby ndesktop » Wed Jan 31, 2018 8:25 am

Then for the time being I don't see other solution other than messaging between renderer and browser, as you pointed out.
ndesktop
Master
 
Posts: 750
Joined: Thu Dec 03, 2015 10:10 am

Re: CEF 3.33239 - renderer no longer gets OnLoadingStateChan

Postby HarmlessDave » Wed Jan 31, 2018 11:59 am

Thanks all. It was on our to-do list to shift navigation event code from the render process to the browser process eventually, it sounds like we should do it now and get it over with.
HarmlessDave
Expert
 
Posts: 370
Joined: Fri Jul 11, 2014 2:02 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 23 guests