Weird behavior when showing the Dev Tools in a custom window

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.

Weird behavior when showing the Dev Tools in a custom window

Postby Tsury » Mon Jan 19, 2015 4:45 am

Hi.

I upgraded from a very old version of CEF 3 to CEF 3.2171.1949.
Amongst the changes is the rework to how the Dev Tools work. Now instead of getting a URL, you have to use CefBrowserHost.ShowDevTools(...)

So in order to make it work, I create a Client, a WindowLess WindowInfo and a Browser, and call ShowDevTools.

When I open the Dev Tools everything works just fine as long as I don't interact with the dev tools window. It shows the elements and everything, but when I interact with the dev tools window, it resets.
It resets in a way that it is empty with no frame. Even writing errors in the console won't result in an error prompt - whatever you write just resets after you press 'ENTER'.
When I return to my original browser window and navigate, it starts working again as intended.

Another side note: Let's say I have a web page that will generate a Console.Log every second. As long as I'm interacting with the Dev Tools (mouse over, focus, whatever), it will be blank and without frame. As soon as I leave it and return to my browser, the Dev Tools will contain all of the previous information (all of the previous Console.Logs and whatever). So it's not actually losing all the data, it just loses frame for some reason. Like it has no frame to work with when I focus it.

Last side note: It looks like the dev tools have two states - Let's say I opened it (didn't interact with it) then it will show some tab (let's say Elements) and pour the data into it. If I interact with it and change tab, the next time I leave it and focus the browser, it will return to show my data in the Elements tab.

I know it's a long shot, but can someone here try to help me? I'm getting desperate.

Thanks!
Tsury
Mentor
 
Posts: 63
Joined: Mon Jan 19, 2015 4:31 am

Re: Weird behavior when showing the Dev Tools in a custom wi

Postby magreenblatt » Tue Jan 20, 2015 12:29 pm

Tsury wrote:So in order to make it work, I create a Client, a WindowLess WindowInfo and a Browser, and call ShowDevTools.

ShowDevTools will create the CefBrowser. See the example in cefclient: https://code.google.com/p/chromiumembed ... er.cpp#790.

Tsury wrote: It shows the elements and everything, but when I interact with the dev tools window, it resets. It resets in a way that it is empty with no frame.

That sounds like the renderer process might be crashing.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Weird behavior when showing the Dev Tools in a custom wi

Postby Tsury » Tue Jan 20, 2015 1:20 pm

Thanks for the reply.

This is starting to seem more fundamental.
I've moved to the sample cefclient to reduce noise and see if it works there, the same thing happened.

I created another client, set everything to be OSR/Transparent (both the default client and the DevTools one), and this issue is still occurring.
I also tried the same with the CefGlue wrapper, same thing again.

Am I missing something here?
Maybe it's because I create two browsers myself and then the ShowDevTools create an additional browser (and this is the two states I see? The original browser and the DevTools one)?
If so, how can I create the DevTools without creating an additional browser? I need to create a new Client for the DevTools, but for a new Client I need a Browser, so I Create a new Browser... I got confused.

My C# Code:
Code: Select all
CefWindowInfo wi = CefWindowInfo.Create();
wi.SetAsWindowless(new WindowInteropHelper(this).Handle, true);
var wpfCefClient = new WpfCefClient(devBrowser);
browser.GetHost().ShowDevTools(wi, wpfCefClient, new CefBrowserSettings(), new CefPoint());
Tsury
Mentor
 
Posts: 63
Joined: Mon Jan 19, 2015 4:31 am

Re: Weird behavior when showing the Dev Tools in a custom wi

Postby magreenblatt » Tue Jan 20, 2015 1:37 pm

Tsury wrote:I've moved to the sample cefclient to reduce noise and see if it works there, the same thing happened.

The problem reproduces with an unchanged version of cefclient? If so, what are the steps to reproduce?

Tsury wrote:I created another client, set everything to be OSR/Transparent (both the default client and the DevTools one), and this issue is still occurring.

You didn't mention previously that you're using off-screen rendering. The cefclient app does not currently allow popup windows when using off-screen rendering. However, the general concept (passing a custom CefClient and CefWindowInfo to ShowDevTools) should work.

Tsury wrote:If so, how can I create the DevTools without creating an additional browser? I need to create a new Client for the DevTools, but for a new Client I need a Browser, so I Create a new Browser... I got confused.

Pass the CefClient instance to ShowDevTools. ShowDevTools will then create the CefBrowser using that CefClient instance.

Alternately, you can use remote debugging by passing the `--remote-debugging-port=8080` command-line flag and browsing to http://localhost:8080 in any Chromium-based browser.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Weird behavior when showing the Dev Tools in a custom wi

Postby Tsury » Wed Jan 21, 2015 9:51 am

Never mind, I was completely wrong.
After you clarified things to me I was able to take the browser created by showDevTools (using the LifespanHandler) and attach it to my GUI.

Everything works as expected with OSR/Transparency.
Thank you very much for your time and help!
Tsury
Mentor
 
Posts: 63
Joined: Mon Jan 19, 2015 4:31 am


Return to Support Forum

Who is online

Users browsing this forum: Majestic-12 [Bot] and 43 guests