summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2022-04-29 19:20:50 +0200
committerFlorian Bruhin <me@the-compiler.org>2022-08-23 18:31:41 +0200
commit4a799c15e7c52d45ebd2b407b4210310846e6aac (patch)
tree51ead4d37129442c692e12ee1cb3aa7b9e294b4a
parentf7897e98424f68455d291d88948bdd4e733b7be0 (diff)
downloadqutebrowser-4a799c15e7c52d45ebd2b407b4210310846e6aac.tar.gz
qutebrowser-4a799c15e7c52d45ebd2b407b4210310846e6aac.zip
Skip urlutils.same_domain tests on Qt 6
We never really use its functionality with QtWebEngine.
-rw-r--r--qutebrowser/utils/urlutils.py13
-rw-r--r--tests/unit/utils/test_urlutils.py1
2 files changed, 14 insertions, 0 deletions
diff --git a/qutebrowser/utils/urlutils.py b/qutebrowser/utils/urlutils.py
index 6fa70dfc9..58862925e 100644
--- a/qutebrowser/utils/urlutils.py
+++ b/qutebrowser/utils/urlutils.py
@@ -493,6 +493,19 @@ def same_domain(url1: QUrl, url2: QUrl) -> bool:
if url1.port() != url2.port():
return False
+ # QUrl.topLevelDomain() got removed in Qt 6:
+ # https://bugreports.qt.io/browse/QTBUG-80308
+ #
+ # However, we should never land here if we are on Qt 6:
+ #
+ # On QtWebEngine, we don't have a QNetworkAccessManager attached to a tab
+ # (all tab-specific downloads happen via the QtWebEngine network stack).
+ # Thus, ensure_valid(url2) above will raise InvalidUrlError, which is
+ # handled in NetworkManager.
+ #
+ # There are no other callers of same_domain, and url2 will only be ever valid when
+ # we use a NetworkManager from QtWebKit. However, QtWebKit is Qt 5 only.
+
suffix1 = url1.topLevelDomain()
suffix2 = url2.topLevelDomain()
if not suffix1:
diff --git a/tests/unit/utils/test_urlutils.py b/tests/unit/utils/test_urlutils.py
index 776f6d557..6ba0871cc 100644
--- a/tests/unit/utils/test_urlutils.py
+++ b/tests/unit/utils/test_urlutils.py
@@ -638,6 +638,7 @@ class TestInvalidUrlError:
(False, 'http://example.org', 'https://example.org'), # different scheme
(False, 'http://example.org:80', 'http://example.org:8080'), # different port
])
+@pytest.mark.qt5_only # https://bugreports.qt.io/browse/QTBUG-80308
def test_same_domain(are_same, url1, url2):
"""Test same_domain."""
assert urlutils.same_domain(QUrl(url1), QUrl(url2)) == are_same