wangyu190810 / cefpython

Automatically exported from code.google.com/p/cefpython
0 stars 0 forks source link

Fix errors when calling GetPyBrowserByCefBrowser() in client handler callbacks #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This function is not reliable in handlers, many callbacks may be called before 
a browser is created, then this function returns None when it is the first 
browser, later it causes error when calling pyBrowser.GetHandler().

There seems to be appearing new cases every week, just a moment ago I had an 
error in DisplayHandler_OnStatusMessage() when running wxpython example.

Maybe we should make the second parameter "ignoreError" to be True by default? 
Or change the way it works completely, so we are able to get PyBrowser even 
during initialization of a browser.

In wiki documentation there are comments about this behavior in some of the 
handlers, for example LifeSpanHandler::OnAfterCreated():

    This function does not get called during creation of a browser initiated 
    through a call to cefpython.CreateBrowser(), it is a temporary limitation in 
    current implementation of cefpython. When a browser is created through 
    javascript "window.open" then this callback gets called.

Original issue reported on code.google.com by czarek.t...@gmail.com on 28 Nov 2012 at 2:38

GoogleCodeExporter commented 9 years ago
When pyBrowser is empty in a callback print the message to the console when 
g_debug is True.

Original comment by czarek.t...@gmail.com on 28 Nov 2012 at 1:20

GoogleCodeExporter commented 9 years ago
Fixed in revision 94627675489e. All client handler callbacks are passing 
ignoreError=True as second parameter, also if the pyBrowser cannot be get then 
a debug message is logged.

Original comment by czarek.t...@gmail.com on 30 Nov 2012 at 10:29

GoogleCodeExporter commented 9 years ago
The function for getting PyBrowser by CefBrowser has been redesigned, there are 
no more limits for events happening during browser creation, the documentation 
in the wiki should be updated.

Original comment by czarek.t...@gmail.com on 7 Dec 2012 at 4:25