diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 654ae3b9b..cc24b1a53 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -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 diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py index f33b7a06d..d1a7de71f 100644 --- a/qutebrowser/config/qtargs.py +++ b/qutebrowser/config/qtargs.py @@ -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 # diff --git a/tests/end2end/test_invocations.py b/tests/end2end/test_invocations.py index 8328784a1..279e55db4 100644 --- a/tests/end2end/test_invocations.py +++ b/tests/end2end/test_invocations.py @@ -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 ]) diff --git a/tests/unit/config/test_qtargs.py b/tests/unit/config/test_qtargs.py index 95c045cb5..9a6dd2b07 100644 --- a/tests/unit/config/test_qtargs.py +++ b/tests/unit/config/test_qtargs.py @@ -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):