Sun, 10 Jul 2016 16:40:17 +0200
Fixed bugs in the cookie handling of the new web browser.
--- 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("."):
--- a/WebBrowser/CookieJar/CookieModel.py Sun Jul 10 13:02:09 2016 +0200 +++ b/WebBrowser/CookieJar/CookieModel.py Sun Jul 10 16:40:17 2016 +0200 @@ -32,6 +32,7 @@ self.tr("Path"), self.tr("Secure"), self.tr("Expires"), + self.tr("Contents"), ] self.__cookieJar = cookieJar self.__cookieJar.cookiesChanged.connect(self.__cookiesChanged)
--- a/WebBrowser/CookieJar/CookiesDialog.py Sun Jul 10 13:02:09 2016 +0200 +++ b/WebBrowser/CookieJar/CookiesDialog.py Sun Jul 10 16:40:17 2016 +0200 @@ -97,9 +97,11 @@ path = model.data(model.index(row, 2)) secure = model.data(model.index(row, 3)) expires = model.data(model.index(row, 4)).toString("yyyy-MM-dd hh:mm") - value = bytes( - QByteArray.fromPercentEncoding( - model.data(model.index(row, 5)))).decode() + data = model.data(model.index(row, 5)) + if data is None: + value = "" + else: + value = bytes(QByteArray.fromPercentEncoding(data)).decode() if self.__detailsDialog is None: from .CookieDetailsDialog import CookieDetailsDialog