From cac04d40014aa7a024577c9bdb39f1fb05e4eb86 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 31 Oct 2018 08:54:29 +0100 Subject: [PATCH] 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 --- qutebrowser/browser/webengine/cookies.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/qutebrowser/browser/webengine/cookies.py b/qutebrowser/browser/webengine/cookies.py index d9d11cd98..e5abc20ea 100644 --- a/qutebrowser/browser/webengine/cookies.py +++ b/qutebrowser/browser/webengine/cookies.py @@ -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: