@@ -209,6 +209,7 @@ def PyCallback(self, *args):
209209 # -------------------------------------------------------------------------
210210 # Cookies
211211 # -------------------------------------------------------------------------
212+
212213 cookieVisitor = None
213214
214215 def VisitAllCookies (self ):
@@ -264,9 +265,11 @@ def Visit(self, cookie, count, total, deleteCookie):
264265 return True
265266
266267class ClientHandler :
268+
267269 # -------------------------------------------------------------------------
268270 # DisplayHandler
269271 # -------------------------------------------------------------------------
272+
270273 def OnLoadingStateChange (self , browser , isLoading , canGoBack ,
271274 canGoForward ):
272275 print ("DisplayHandler::OnLoadingStateChange()" )
@@ -309,6 +312,7 @@ def OnConsoleMessage(self, browser, message, source, line):
309312 # -------------------------------------------------------------------------
310313 # KeyboardHandler
311314 # -------------------------------------------------------------------------
315+
312316 def OnPreKeyEvent (self , browser , event , eventHandle ,
313317 isKeyboardShortcutOut ):
314318 print ("KeyboardHandler::OnPreKeyEvent()" )
@@ -325,6 +329,7 @@ def OnKeyEvent(self, browser, event, eventHandle):
325329 # -------------------------------------------------------------------------
326330 # RequestHandler
327331 # -------------------------------------------------------------------------
332+
328333 def OnBeforeResourceLoad (self , browser , frame , request ):
329334 print ("RequestHandler::OnBeforeResourceLoad()" )
330335 print ("url = %s" % request .GetUrl ()[:70 ])
@@ -404,6 +409,7 @@ def _OnCertificateError(self, certError, requestUrl, callback):
404409 # -------------------------------------------------------------------------
405410 # LoadHandler
406411 # -------------------------------------------------------------------------
412+
407413 def OnLoadStart (self , browser , frame ):
408414 print ("LoadHandler::OnLoadStart()" )
409415 print ("frame url = %s" % frame .GetUrl ()[:70 ])
@@ -439,6 +445,19 @@ def OnPluginCrashed(self, browser, pluginPath):
439445 print ("LoadHandler::OnPluginCrashed()" )
440446 print ("plugin path = %s" % pluginPath )
441447
448+ # -------------------------------------------------------------------------
449+ # LifespanHandler
450+ # -------------------------------------------------------------------------
451+
452+ # Empty place-holders: popupFeatures, windowInfo, client, browserSettings.
453+ def OnBeforePopup (self , browser , frame , targetUrl , targetFrameName ,
454+ popupFeatures , windowInfo , client , browserSettings , noJavascriptAccess ):
455+ print ("LifespanHandler::OnBeforePopup()" )
456+ print ("targetUrl = %s" % targetUrl )
457+ allowPopups = True
458+ return not allowPopups
459+
460+
442461class MyApp (wx .App ):
443462 timer = None
444463 timerID = 1
0 commit comments