Avoid version warnings with PyQtWebEngine-Qt5 5.15.17

With PyQtWebEngine-Qt5 5.15.17 (Qt 5.15.19), we seem to run into similar issues
like we already did with Qt 6.5:

https://github.com/qutebrowser/qutebrowser/issues/7624#issuecomment-1474008470
9cb54b2099

However, skipping the ELF test is not enough, as we also get warnings
at runtime (as we don't have any API to get the version at runtime).

We don't care much about Qt 5 at this stage, so let's just not output
warnings in that case (and nothing in the code should care about the exact
QtWebEngine patch level beyond 5.15.2 anyways).

For most user-facing things, we *can* get the exact version number from
the user-agent, so this should not actually affect much.
This commit is contained in:
Florian Bruhin 2025-05-29 23:42:40 +02:00
parent 0de8337969
commit 072b03a631
3 changed files with 16 additions and 2 deletions

View File

@ -453,8 +453,19 @@ def _init_default_profile():
init_user_agent()
ua_version = version.qtwebengine_versions()
logger = log.init.warning
if machinery.IS_QT5:
# With Qt 5.15, we can't quite be sure about which QtWebEngine patch version
# we're getting, as ELF parsing might be broken and there's no other way.
# For most of the code, we don't really care about the patch version though.
assert (
non_ua_version.webengine.strip_patch() == ua_version.webengine.strip_patch()
), (non_ua_version, ua_version)
logger = log.init.debug
if ua_version.webengine != non_ua_version.webengine:
log.init.warning(
logger(
"QtWebEngine version mismatch - unexpected behavior might occur, "
"please open a bug about this.\n"
f" Early version: {non_ua_version}\n"

View File

@ -594,6 +594,7 @@ class WebEngineVersions:
utils.VersionNumber(5, 15, 16): (_BASES[87], '119.0.6045.123'), # 2023-11-07
utils.VersionNumber(5, 15, 17): (_BASES[87], '123.0.6312.58'), # 2024-03-19
utils.VersionNumber(5, 15, 18): (_BASES[87], '130.0.6723.59'), # 2024-10-14
utils.VersionNumber(5, 15, 19): (_BASES[87], '135.0.7049.95'), # 2025-04-14
## Qt 6.2

View File

@ -11,6 +11,7 @@ from hypothesis import strategies as hst
from qutebrowser.misc import elf, binparsing
from qutebrowser.utils import utils
from qutebrowser.utils.utils import VersionNumber
@pytest.mark.parametrize('fmt, expected', [
@ -45,7 +46,8 @@ def test_result(webengine_versions, qapp, caplog):
pytest.importorskip('qutebrowser.qt.webenginecore')
versions = elf.parse_webenginecore()
if webengine_versions.webengine >= utils.VersionNumber(6, 5):
qtwe_version = webengine_versions.webengine
if qtwe_version == VersionNumber(5, 15, 19) or qtwe_version >= VersionNumber(6, 5):
assert versions is None
pytest.xfail("ELF file structure not supported")