Adjust referrer handling for Qt 6

As suspected in a comment, ReducedReferrerGranularity does not exist anymore
with Chromium 90, and neither does an option for getting the full referrer back:

https://chromium-review.googlesource.com/c/chromium/src/+/2545444
https://bugs.chromium.org/p/chromium/issues/detail?id=1150018
This commit is contained in:
Florian Bruhin 2022-05-07 22:12:16 +02:00
parent c151183e9d
commit 81a67a9201
4 changed files with 21 additions and 5 deletions

View File

@ -679,7 +679,8 @@ content.headers.referer:
type:
name: String
valid_values:
- always: "Always send the Referer."
- always: "Always send the Referer. With QtWebEngine 6.2+, this value is
unavailable and will act like `same-domain`."
- never: "Never send the Referer. This is not recommended, as some sites
may break."
- same-domain: "Only send the Referer for the same domain. This will

View File

@ -93,6 +93,8 @@ def _qtwebengine_features(
versions: The WebEngineVersions to get flags for.
special_flags: Existing flags passed via the commandline.
"""
assert versions.chromium_major is not None
enabled_features = []
disabled_features = []
@ -143,7 +145,8 @@ def _qtwebengine_features(
if config.val.scrolling.bar == 'overlay':
enabled_features.append('OverlayScrollbar')
if config.val.content.headers.referer == 'same-domain':
if (config.val.content.headers.referer == 'same-domain' and
versions.chromium_major < 89):
# Handling of reduced-referrer-granularity in Chromium 76+
# https://chromium-review.googlesource.com/c/chromium/src/+/1572699
#

View File

@ -412,7 +412,18 @@ def test_qute_settings_persistence(short_tmpdir, request, quteproc_new):
@pytest.mark.parametrize('value, expected', [
('always', 'http://localhost:(port2)/headers-link/(port)'),
# https://chromium-review.googlesource.com/c/chromium/src/+/2545444
pytest.param(
'always',
'http://localhost:(port2)/headers-link/(port)',
marks=pytest.mark.qt5_only,
),
pytest.param(
'always',
'http://localhost:(port2)/',
marks=pytest.mark.qt6_only,
),
('never', None),
('same-domain', 'http://localhost:(port2)/'), # None with QtWebKit
])

View File

@ -283,8 +283,6 @@ class TestWebEngineArgs:
assert not set(args) & remaining_flags
@pytest.mark.parametrize('qt_version, referer, arg', [
# FIXME:qt6 update?
# 'always' -> no arguments
('5.15.2', 'always', None),
('5.15.3', 'always', None),
@ -296,6 +294,9 @@ class TestWebEngineArgs:
# 'same-domain'
('5.15.2', 'same-domain', '--enable-features=ReducedReferrerGranularity'),
('5.15.3', 'same-domain', '--enable-features=ReducedReferrerGranularity'),
# (Not available anymore)
('6.2', 'same-domain', None),
('6.3', 'same-domain', None),
])
def test_referer(self, config_stub, version_patcher, parser,
qt_version, referer, arg):