WebBrowser/CookieJar/CookieJar.py

changeset 5474
3df49db6a347
parent 5389
9b1c800daff3
child 5783
44a9f08de394
--- a/WebBrowser/CookieJar/CookieJar.py	Sat Feb 04 12:41:38 2017 +0100
+++ b/WebBrowser/CookieJar/CookieJar.py	Sat Feb 04 13:10:20 2017 +0100
@@ -212,15 +212,16 @@
                 return True
         
         if self.__acceptCookies == self.AcceptOnlyFromSitesNavigatedTo:
-            url = WebBrowserWindow.mainWindow().getWindow().currentBrowser()\
-                .url()
-            if url.isValid():
-                host = url.host()
-            else:
-                host = ""
-            res = self.__matchDomain(cookieDomain, host)
-            if not res:
-                return True
+            mainWindow = WebBrowserWindow.mainWindow()
+            if mainWindow is not None:
+                url = mainWindow.getWindow().currentBrowser().url()
+                if url.isValid():
+                    host = url.host()
+                else:
+                    host = ""
+                res = self.__matchDomain(cookieDomain, host)
+                if not res:
+                    return True
         
         if self.__filterTrackingCookies and cookie.name().startsWith(b"__utm"):
             return True

eric ide

mercurial