Add workaround for accepting third-party cookies

An empty first-party URL is considered a first-party request. This workaround
is equivalent to the Qt fix: https://codereview.qt-project.org/#/c/244021/

Note that later versions of Chromium changed that check:
https://bugs.chromium.org/p/chromium/issues/detail?id=882107
That shouldn't be a problem since we disable our workaround with Qt 5.11.3, so
once Qt catches up there, the check isn't done anymore.

Fixes #4281
This commit is contained in:
Florian Bruhin 2018-10-31 08:54:29 +01:00
parent 7c43562807
commit cac04d4001

View File

@ -20,7 +20,7 @@
"""Filter for QtWebEngine cookies."""
from qutebrowser.config import config
from qutebrowser.utils import utils
from qutebrowser.utils import utils, qtutils
def _accept_cookie(request):
@ -29,7 +29,13 @@ def _accept_cookie(request):
if accept == 'all':
return True
elif accept in ['no-3rdparty', 'no-unknown-3rdparty']:
return not request.thirdParty
if qtutils.version_check('5.11.3', compiled=False):
third_party = request.thirdParty
else:
# WORKAROUND for https://bugreports.qt.io/browse/QTBUG-71393
third_party = (request.thirdParty and
not request.firstPartyUrl.isEmpty())
return not third_party
elif accept == 'never':
return False
else: