WebBrowser/CookieJar/CookieJar.py

changeset 5028
f7ea46dd1b7e
parent 5025
2060a0f66c51
child 5030
b728bb00886e
diff -r fe7ecf4517e0 -r f7ea46dd1b7e WebBrowser/CookieJar/CookieJar.py
--- a/WebBrowser/CookieJar/CookieJar.py	Sun Jul 10 13:02:09 2016 +0200
+++ b/WebBrowser/CookieJar/CookieJar.py	Sun Jul 10 16:40:17 2016 +0200
@@ -191,20 +191,14 @@
         if not self.__loaded:
             self.__load()
         
-        eBlock = self.__isOnDomainList(self.__exceptionsBlock, cookieDomain)
-        eAllow = not eBlock and \
-            self.__isOnDomainList(self.__exceptionsAllow, cookieDomain)
-        eAllowSession = not eBlock and \
-            not eAllow and \
-            self.__isOnDomainList(
-                self.__exceptionsAllowForSession, cookieDomain)
-        
         if self.__acceptCookies == self.AcceptNever:
-            if not eAllow and not eAllowSession:
+            res = self.__isOnDomainList(self.__exceptionsAllow, cookieDomain)
+            if not res:
                 return True
         
         if self.__acceptCookies == self.AcceptAlways:
-            if eBlock:
+            res = self.__isOnDomainList(self.__exceptionsBlock, cookieDomain)
+            if res:
                 return True
         
         if self.__acceptCookies == self.AcceptOnlyFromSitesNavigatedTo:
@@ -214,7 +208,8 @@
                 host = url.host()
             else:
                 host = ""
-            if not self.__matchDomain(cookieDomain, host):
+            res = self.__matchDomain(cookieDomain, host)
+            if not res:
                 return True
         
         if self.__filterTrackingCookies and cookie.name().startsWith(b"__utm"):
@@ -411,6 +406,10 @@
         @return flag indicating a match
         @rtype bool
         """
+        if not siteDomain:
+            # empty URLs always match
+            return True
+        
         if cookieDomain.startswith("."):
             cookieDomain = cookieDomain[1:]
         if siteDomain.startswith("."):

eric ide

mercurial