java-cef
                                
                                 java-cef copied to clipboard
                                
                                    java-cef copied to clipboard
                            
                            
                            
                        Synchronization of CefMessageRouterConfig is broken
Original report by Nikita Gubarkov (Bitbucket: YaaZ, GitHub: YaaZ).
Please see https://bitbucket.org/chromiumembedded/cef/issues/2978
As CEF now creates render processes in advance, we cannot pass CefMessageRouterConfig parameters to extra_info of OnRenderThreadCreated, as it’s now called too early for us to know what to pass to it. We cannot use extra_info of OnBrowserCreated as well, because it’s called after OnWebKitInitialized where CefMessageRouterRendererSide is created.
Original issue with JS callbacks was posted on CEF forum, there’s also a test and necessary steps for reproducing the problem: https://magpcss.org/ceforum/viewtopic.php?f=17&t=17599
This is a critical issue, which completely breaks usage of JS callbacks and exists since 78.2.7+g9cd8bac+chromium-78.0.3904.70
We cannot use
extra_infoofOnBrowserCreatedas well, because it’s called afterOnWebKitInitializedwhereCefMessageRouterRendererSideis created.
So create the CefMessageRouterRendererSide in OnBrowserCreated instead. OnBrowserCreated might be called multiple times if the render process is used by multiple browsers, so you can either keep a map of browser ID to router, or just use the first registration for all browsers.
Alternately, the registration could be handled via the messages in OnProcessMessageReceived exclusively.