Skip to content

Commit 7d5f7d6

Browse files
committed
* Fixed python fatal error when opening popups
(Issue 45 & Issue 46)
1 parent 6c83c4c commit 7d5f7d6

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

cefpython/browser.pyx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ cdef PyBrowser GetPyBrowser(CefRefPtr[CefBrowser] cefBrowser):
7070
pyBrowser.SetClientCallbacksDict(clientCallbacks)
7171
IF CEF_VERSION == 1:
7272
javascriptBindings = tempPyBrowser.GetJavascriptBindings()
73-
if javascriptBindings.GetBindToPopups():
74-
pyBrowser.SetJavascriptBindings(javascriptBindings)
75-
73+
if javascriptBindings:
74+
if javascriptBindings.GetBindToPopups():
75+
pyBrowser.SetJavascriptBindings(javascriptBindings)
7676
return pyBrowser
7777

7878
cpdef PyBrowser GetBrowserByWindowHandle(int windowHandle):
@@ -128,7 +128,8 @@ cdef class PyBrowser:
128128
if <void*>cefBrowserHost != NULL and cefBrowserHost.get():
129129
return cefBrowserHost
130130
raise Exception("PyBrowser.GetCefBrowserHost() failed: this "
131-
"method can only be called in the browser process.")
131+
"method can only be called in the browser "
132+
"process.")
132133

133134
def __init__(self):
134135
self.clientCallbacks = {}

cefpython/cef1/windows/binaries/cefsimple.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ <h3>User agent</h3>
2020

2121
<script>document.write(navigator.userAgent)</script>
2222

23+
<h3>Popup</h3>
24+
25+
<a href="javascript:window.open('cefsimple.html')">
26+
window.open('cefsimple.html')</a>
27+
2328
<br><br><br><br><br><br><br><br><br><br><br>
2429
<br><br><br><br><br><br><br><br><br><br><br>
2530
<br><br><br><br><br><br><br><br><br><br><br>

cefpython/cef1/windows/binaries/cefsimple.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def ExceptHook(type, value, traceObject):
5757

5858
def CefSimple():
5959
sys.excepthook = ExceptHook
60+
cefpython.g_debug = True
6061
cefpython.Initialize()
6162
wndproc = {
6263
win32con.WM_CLOSE: CloseWindow,

0 commit comments

Comments
 (0)