From 6c67f927c8922f0bcf25b524dfb4a72455625f93 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 10 Mar 2021 20:04:41 +0100 Subject: Make locale workaround configurable See #6235 --- doc/changelog.asciidoc | 6 +++++ doc/help/settings.asciidoc | 13 +++++++++++ qutebrowser/config/configdata.yml | 14 ++++++++++++ qutebrowser/config/qtargs.py | 3 +++ tests/unit/config/test_qtargs_locale_workaround.py | 26 +++++++++++++++++----- 5 files changed, 57 insertions(+), 5 deletions(-) diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index d57698df7..8bbaef0b1 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -97,6 +97,12 @@ Fixed accidentally treated that as "@run-at document-idle". However, other GreaseMonkey implementations default to "@run-at document-end" instead, which is what qutebrowser now does, too. +- With QtWebEngine 5.15.3 and some locales, Chromium can't start its + subprocesses. As a result, qutebrowser only shows a blank page and logs + "Network service crashed, restarting service.". This release adds a + `qt.workarounds.locale` setting working around the issue. It is disabled by + default since distributions shipping 5.15.3 will probably have a proper patch + for it backported very soon. [[v2.0.2]] v2.0.2 (2021-02-04) diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 392f60c49..7a5cfd47b 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -283,6 +283,7 @@ |<>|Turn on Qt HighDPI scaling. |<>|When to use Chromium's low-end device mode. |<>|Which Chromium process model to use. +|<>|Work around locale parsing issues in QtWebEngine 5.15.3. |<>|Delete the QtWebEngine Service Worker directory on every start. |<>|When/how to show the scrollbar. |<>|Enable smooth scrolling for web pages. @@ -3666,6 +3667,18 @@ Default: +pass:[process-per-site-instance]+ This setting is only available with the QtWebEngine backend. +[[qt.workarounds.locale]] +=== qt.workarounds.locale +Work around locale parsing issues in QtWebEngine 5.15.3. +With some locales, QtWebEngine 5.15.3 is unusable without this workaround. In affected scenarios, QtWebEngine will log "Network service crashed, restarting service." and only display a blank page. +However, It is expected that distributions shipping QtWebEngine 5.15.3 follow up with a proper fix soon, so it is disabled by default. + +Type: <> + +Default: +pass:[false]+ + +This setting is only available with the QtWebEngine backend. + [[qt.workarounds.remove_service_workers]] === qt.workarounds.remove_service_workers Delete the QtWebEngine Service Worker directory on every start. diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 34d8bec96..6b5687fc2 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -311,6 +311,20 @@ qt.workarounds.remove_service_workers: Note however that enabling this option *can lead to data loss* on some pages (as Service Worker data isn't persisted) and will negatively impact start-up time. +qt.workarounds.locale: + type: Bool + default: false + backend: QtWebEngine + desc: >- + Work around locale parsing issues in QtWebEngine 5.15.3. + + With some locales, QtWebEngine 5.15.3 is unusable without this workaround. + In affected scenarios, QtWebEngine will log "Network service crashed, + restarting service." and only display a blank page. + + However, It is expected that distributions shipping QtWebEngine 5.15.3 + follow up with a proper fix soon, so it is disabled by default. + ## auto_save auto_save.interval: diff --git a/qutebrowser/config/qtargs.py b/qutebrowser/config/qtargs.py index c2c5ede7e..3e35e6908 100644 --- a/qutebrowser/config/qtargs.py +++ b/qutebrowser/config/qtargs.py @@ -174,6 +174,9 @@ def _get_lang_override( This is needed as a WORKAROUND for https://bugreports.qt.io/browse/QTBUG-91715 There is no fix yet, but we assume it'll be fixed with QtWebEngine 5.15.4. """ + if not config.val.qt.workarounds.locale: + return None + if webengine_version != utils.VersionNumber(5, 15, 3) or not utils.is_linux: return None diff --git a/tests/unit/config/test_qtargs_locale_workaround.py b/tests/unit/config/test_qtargs_locale_workaround.py index f38940283..977118198 100644 --- a/tests/unit/config/test_qtargs_locale_workaround.py +++ b/tests/unit/config/test_qtargs_locale_workaround.py @@ -28,6 +28,17 @@ from qutebrowser.config import qtargs pytest.importorskip('PyQt5.QtWebEngineWidgets') +@pytest.fixture(autouse=True) +def enable_workaround(config_stub): + config_stub.val.qt.workarounds.locale = True + + +@pytest.fixture +def qtwe_version(): + """A version number needing the workaround.""" + return utils.VersionNumber(5, 15, 3) + + @pytest.mark.parametrize('lang, expected', [ ("POSIX.UTF-8", "en-US"), ("aa_DJ.UTF-8", "en-US"), @@ -392,12 +403,12 @@ pytest.importorskip('PyQt5.QtWebEngineWidgets') ("zh_XX.UTF-8", "zh-CN"), # locale not available on my system ("zu_ZA.UTF-8", "en-US"), ]) -def test_lang_workaround_all_locales(lang, expected): +def test_lang_workaround_all_locales(lang, expected, qtwe_version): locale_name = QLocale(lang).bcp47Name() print(locale_name) override = qtargs._get_lang_override( - webengine_version=utils.VersionNumber(5, 15, 3), + webengine_version=qtwe_version, locale_name=locale_name, ) @@ -425,6 +436,11 @@ def test_different_qt_version(version): @pytest.mark.fake_os('windows') -def test_non_linux(): - version = utils.VersionNumber(5, 15, 3) - assert qtargs._get_lang_override(version, "de-CH") is None +def test_non_linux(qtwe_version): + assert qtargs._get_lang_override(qtwe_version, "de-CH") is None + + +@pytest.mark.fake_os('linux') +def test_disabled(qtwe_version, config_stub): + config_stub.val.qt.workarounds.locale = False + assert qtargs._get_lang_override(qtwe_version, "de-CH") is None -- cgit v1.2.3-54-g00ecf