X Tutup
Skip to content

Latest commit

 

History

History
42 lines (24 loc) · 2.08 KB

File metadata and controls

42 lines (24 loc) · 2.08 KB

Project will move to github. Find this wiki page at the new address: https://github.com/cztomczak/cefpython/wiki/JavascriptContextHandler


JavascriptContextHandler callbacks

Implement this interface to handle javascript exceptions globally.

For an example of how to implement handler see cefpython.CreateBrowser(). For a list of all handler interfaces see API > Client handlers.

void OnContextCreated(Browser browser, Frame frame)

In CEF 1 called immediately after the V8 context for a frame has been created.

In CEF 3 called shortly after (process message delay) the V8 context for a frame has been created.

void OnContextReleased(Browser browser, Frame frame)

In CEF 1 called immediately before the V8 context for a frame is released.

In CEF 3 called shortly after (process message delay) the V8 context for a frame was released.

Due to multi-process architecture in CEF 3, this function won't get called for the main frame in main browser. To send a message from the renderer process a parent browser is used. If this is the main frame then this would mean that the browser is being destroyed, thus we can't send a process message using this browser. There is no guarantee that this will get called for frames in the main browser, if the browser is destroyed shortly after the frames were released.

void OnUncaughtException(Browser browser, Frame frame, dict exception, list stackTrace)

Not yet implemented in CEF Python 3.

Called for global uncaught exceptions. Execution of this callback is disabled by default. To enable set ApplicationSettings.uncaught_exception_stack_size > 0.

exception is a dictionary with following keys: lineNumber, message, scriptResourceName, sourceLine.

stackTrace is in the same format as returned by cefpython.GetJavascriptStackTrace(), see description of that function for more details. To get a string call cefpython.FormatJavascriptStackTrace().

X Tutup