diff options
-rw-r--r-- | doc/changelog.asciidoc | 1 | ||||
-rw-r--r-- | misc/requirements/requirements-check-manifest.txt | 4 | ||||
-rw-r--r-- | misc/requirements/requirements-dev.txt | 2 | ||||
-rw-r--r-- | misc/requirements/requirements-mypy.txt | 2 | ||||
-rw-r--r-- | misc/requirements/requirements-pyinstaller.txt | 2 | ||||
-rw-r--r-- | misc/requirements/requirements-pyroma.txt | 4 | ||||
-rw-r--r-- | misc/requirements/requirements-tests.txt | 8 | ||||
-rw-r--r-- | misc/requirements/requirements-tox.txt | 9 | ||||
-rw-r--r-- | pytest.ini | 4 | ||||
-rw-r--r-- | qutebrowser/browser/webengine/webengineelem.py | 16 | ||||
-rw-r--r-- | qutebrowser/utils/version.py | 5 | ||||
-rw-r--r-- | tests/conftest.py | 15 | ||||
-rw-r--r-- | tests/end2end/data/hints/link_inject.html | 19 | ||||
-rw-r--r-- | tests/end2end/features/conftest.py | 8 | ||||
-rw-r--r-- | tests/end2end/features/hints.feature | 7 | ||||
-rw-r--r-- | tests/end2end/fixtures/quteprocess.py | 13 | ||||
-rw-r--r-- | tests/helpers/testutils.py | 22 |
17 files changed, 108 insertions, 33 deletions
diff --git a/doc/changelog.asciidoc b/doc/changelog.asciidoc index 8a5bb6ce3..f00defecf 100644 --- a/doc/changelog.asciidoc +++ b/doc/changelog.asciidoc @@ -27,6 +27,7 @@ Fixed - Setting `url.auto_search` to `dns` works correctly now with Qt 6. - Counts passed via keypresses now have a digit limit (4300) to avoid exceptions due to cats sleeping on numpads. (#7834) +- Navigating via hints to a remote URL from a file:// one works again. (#7847) [[v3.0.0]] v3.0.0 (2023-08-18) diff --git a/misc/requirements/requirements-check-manifest.txt b/misc/requirements/requirements-check-manifest.txt index e02724e12..f910d7953 100644 --- a/misc/requirements/requirements-check-manifest.txt +++ b/misc/requirements/requirements-check-manifest.txt @@ -1,7 +1,9 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -build==0.10.0 +build==1.0.0 check-manifest==0.49 +importlib-metadata==6.8.0 packaging==23.1 pyproject_hooks==1.0.0 tomli==2.0.1 +zipp==3.16.2 diff --git a/misc/requirements/requirements-dev.txt b/misc/requirements/requirements-dev.txt index 2c73d53d1..06980a280 100644 --- a/misc/requirements/requirements-dev.txt +++ b/misc/requirements/requirements-dev.txt @@ -1,7 +1,7 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py bleach==6.0.0 -build==0.10.0 +build==1.0.0 bump2version==1.0.1 certifi==2023.7.22 cffi==1.15.1 diff --git a/misc/requirements/requirements-mypy.txt b/misc/requirements/requirements-mypy.txt index 55585ad40..ba7715b14 100644 --- a/misc/requirements/requirements-mypy.txt +++ b/misc/requirements/requirements-mypy.txt @@ -16,6 +16,6 @@ types-colorama==0.4.15.12 types-docutils==0.20.0.3 types-Pygments==2.16.0.0 types-PyYAML==6.0.12.11 -types-setuptools==68.1.0.0 +types-setuptools==68.1.0.1 typing_extensions==4.7.1 zipp==3.16.2 diff --git a/misc/requirements/requirements-pyinstaller.txt b/misc/requirements/requirements-pyinstaller.txt index 8dd0ea6ec..2f0b35e0d 100644 --- a/misc/requirements/requirements-pyinstaller.txt +++ b/misc/requirements/requirements-pyinstaller.txt @@ -2,4 +2,4 @@ altgraph==0.17.3 pyinstaller @ git+https://github.com/pyinstaller/pyinstaller.git@79f62ef29822169ae00cd4271390d0e3175476ad -pyinstaller-hooks-contrib==2023.7 +pyinstaller-hooks-contrib==2023.8 diff --git a/misc/requirements/requirements-pyroma.txt b/misc/requirements/requirements-pyroma.txt index 0bed26a8d..d41367100 100644 --- a/misc/requirements/requirements-pyroma.txt +++ b/misc/requirements/requirements-pyroma.txt @@ -1,10 +1,11 @@ # This file is automatically generated by scripts/dev/recompile_requirements.py -build==0.10.0 +build==1.0.0 certifi==2023.7.22 charset-normalizer==3.2.0 docutils==0.20.1 idna==3.4 +importlib-metadata==6.8.0 packaging==23.1 Pygments==2.16.1 pyproject_hooks==1.0.0 @@ -13,3 +14,4 @@ requests==2.31.0 tomli==2.0.1 trove-classifiers==2023.8.7 urllib3==2.0.4 +zipp==3.16.2 diff --git a/misc/requirements/requirements-tests.txt b/misc/requirements/requirements-tests.txt index f49b0cf5f..1c956cc6e 100644 --- a/misc/requirements/requirements-tests.txt +++ b/misc/requirements/requirements-tests.txt @@ -10,10 +10,10 @@ click==8.1.7 coverage==7.3.0 exceptiongroup==1.1.3 execnet==2.0.2 -filelock==3.12.2 +filelock==3.12.3 Flask==2.3.3 hunter==3.6.1 -hypothesis==6.82.6 +hypothesis==6.84.2 idna==3.4 importlib-metadata==6.8.0 iniconfig==2.0.0 @@ -30,7 +30,7 @@ parse-type==0.6.2 pluggy==1.3.0 py-cpuinfo==9.0.0 Pygments==2.16.1 -pytest==7.4.0 +pytest==7.4.1 pytest-bdd==6.1.1 pytest-benchmark==4.0.0 pytest-cov==4.1.0 @@ -46,7 +46,7 @@ requests==2.31.0 requests-file==1.5.1 six==1.16.0 sortedcontainers==2.4.0 -soupsieve==2.4.1 +soupsieve==2.5 tldextract==3.4.4 toml==0.10.2 tomli==2.0.1 diff --git a/misc/requirements/requirements-tox.txt b/misc/requirements/requirements-tox.txt index ef2f11955..fab75620d 100644 --- a/misc/requirements/requirements-tox.txt +++ b/misc/requirements/requirements-tox.txt @@ -4,14 +4,15 @@ cachetools==5.3.1 chardet==5.2.0 colorama==0.4.6 distlib==0.3.7 -filelock==3.12.2 +filelock==3.12.3 packaging==23.1 pip==23.2.1 platformdirs==3.10.0 pluggy==1.3.0 -pyproject-api==1.5.4 +pyproject-api==1.6.1 setuptools==68.1.2 tomli==2.0.1 -tox==4.10.0 -virtualenv==20.24.3 +tox==4.11.1 +typing_extensions==4.7.1 +virtualenv==20.24.4 wheel==0.41.2 diff --git a/pytest.ini b/pytest.ini index 8d7cf2e95..f2f746284 100644 --- a/pytest.ini +++ b/pytest.ini @@ -59,6 +59,8 @@ qt_log_ignore = ^QObject::connect: Connecting from COMPAT signal \(QSocketNotifier::activated\(int\)\)$ # Randomly started showing up on Qt 5.15.2 ^QBackingStore::endPaint\(\) called with active painter; did you forget to destroy it or call QPainter::end\(\) on it\?$ + # Qt 6.5 after system update, from qt-qt.accessibility.atspi + Error in contacting registry: "org\.freedesktop\.DBus\.Error\.Disconnected" "Not connected to D-Bus server" xfail_strict = true filterwarnings = error @@ -66,5 +68,5 @@ filterwarnings = # Python 3.12: https://github.com/jendrikseipp/vulture/issues/314 ignore:ast\.Str is deprecated and will be removed in Python 3\.14; use ast\.Constant instead:DeprecationWarning:vulture\.core # Python 3.12: https://github.com/ionelmc/pytest-benchmark/issues/240 - ignore:datetime\.utcnow\(\) is deprecated and scheduled for removal in a future version\. Use timezone-aware objects to represent datetimes in UTC. datetime\.now\(datetime\.UTC\)\.:DeprecationWarning:pytest_benchmark\.utils + ignore:(datetime\.)?datetime\.utcnow\(\) is deprecated and scheduled for removal in a future version\. Use timezone-aware objects to represent datetimes in UTC. (datetime\.)?datetime\.now\(datetime\.UTC\)\.:DeprecationWarning:pytest_benchmark\.utils faulthandler_timeout = 90 diff --git a/qutebrowser/browser/webengine/webengineelem.py b/qutebrowser/browser/webengine/webengineelem.py index 20c3a36d4..c387ebbcf 100644 --- a/qutebrowser/browser/webengine/webengineelem.py +++ b/qutebrowser/browser/webengine/webengineelem.py @@ -215,14 +215,16 @@ class WebEngineElement(webelem.AbstractWebElement): return False # Qt 6.3+ needs a user interaction to allow navigations from qute:// to - # outside qute:// (like e.g. on qute://bookmarks). + # outside qute:// (like e.g. on qute://bookmarks), as well as from file:// to + # outside of file:// (e.g. users having a local bookmarks.html). versions = version.qtwebengine_versions() - if ( - baseurl.scheme() == "qute" and - url.scheme() != "qute" and - versions.webengine >= utils.VersionNumber(6, 3) - ): - return True + for scheme in ["qute", "file"]: + if ( + baseurl.scheme() == scheme and + url.scheme() != scheme and + versions.webengine >= utils.VersionNumber(6, 3) + ): + return True return url.scheme() not in urlutils.WEBENGINE_SCHEMES diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index 888172535..75df73ffa 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -611,6 +611,11 @@ class WebEngineVersions: # 6.5.1: Security fixes up to 112.0.5615.138 (2023-04-18) # 6.5.2: Security fixes up to 114.0.5735.133 (2023-06-13) utils.VersionNumber(6, 5): '108.0.5359.220', + + # Qt 6.6: Chromium 112 + # 112.0.5615.213 (~2023-04-18) + # 6.6.0: Security fixes up to 116.0.5845.110 (?) (2023-08-22) + utils.VersionNumber(6, 6): '112.0.5615.213', } def __post_init__(self) -> None: diff --git a/tests/conftest.py b/tests/conftest.py index 424c92c91..6e948a3c9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,19 +33,24 @@ _qute_scheme_handler = None # Set hypothesis settings +suppressed_health_checks = [ + hypothesis.HealthCheck.function_scoped_fixture, + # https://github.com/HypothesisWorks/hypothesis/issues/3733 + hypothesis.HealthCheck.differing_executors, +] hypothesis.settings.register_profile( 'default', hypothesis.settings( deadline=600, - suppress_health_check=[hypothesis.HealthCheck.function_scoped_fixture], + suppress_health_check=suppressed_health_checks, ) ) hypothesis.settings.register_profile( 'ci', hypothesis.settings( deadline=None, - suppress_health_check=[ - hypothesis.HealthCheck.function_scoped_fixture, - hypothesis.HealthCheck.too_slow, - ] + suppress_health_check=( + suppressed_health_checks + + [hypothesis.HealthCheck.too_slow] + ) ) ) hypothesis.settings.load_profile('ci' if testutils.ON_CI else 'default') diff --git a/tests/end2end/data/hints/link_inject.html b/tests/end2end/data/hints/link_inject.html new file mode 100644 index 000000000..7ef352028 --- /dev/null +++ b/tests/end2end/data/hints/link_inject.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>A link to use hints on</title> + <script> + function injectPort() { + const queryString = document.location.search; + const params = new URLSearchParams(queryString); + const port = params.get("port") + let link = document.getElementById("link"); + link.href = link.href.replace("<port>", port); + } + </script> + </head> + <body onload="injectPort()"> + <a href="http://localhost:<port>/data/hello.txt" id="link">Follow me!</a> + </body> +</html> diff --git a/tests/end2end/features/conftest.py b/tests/end2end/features/conftest.py index 9dd497c0b..089f0c42c 100644 --- a/tests/end2end/features/conftest.py +++ b/tests/end2end/features/conftest.py @@ -33,8 +33,7 @@ def _get_echo_exe_path(): Path to the "echo"-utility. """ if utils.is_windows: - return os.path.join(testutils.abs_datapath(), 'userscripts', - 'echo.bat') + return str(testutils.abs_datapath() / 'userscripts' / 'echo.bat') else: return shutil.which("echo") @@ -199,6 +198,7 @@ def open_path(quteproc, server, path): - With "... as a URL", it's opened according to new_instance_open_target. """ path = path.replace('(port)', str(server.port)) + path = testutils.substitute_testdata(path) new_tab = False new_bg_tab = False @@ -270,7 +270,7 @@ def run_command(quteproc, server, tmpdir, command): invalid = False command = command.replace('(port)', str(server.port)) - command = command.replace('(testdata)', testutils.abs_datapath()) + command = testutils.substitute_testdata(command) command = command.replace('(tmpdir)', str(tmpdir)) command = command.replace('(dirsep)', os.sep) command = command.replace('(echo-exe)', _get_echo_exe_path()) @@ -364,7 +364,7 @@ def hint(quteproc, args): @bdd.when(bdd.parsers.parse('I hint with args "{args}" and follow {letter}')) def hint_and_follow(quteproc, args, letter): - args = args.replace('(testdata)', testutils.abs_datapath()) + args = testutils.substitute_testdata(args) args = args.replace('(python-executable)', sys.executable) quteproc.send_cmd(':hint {}'.format(args)) quteproc.wait_for(message='hints: *') diff --git a/tests/end2end/features/hints.feature b/tests/end2end/features/hints.feature index 80348c908..ddf42132f 100644 --- a/tests/end2end/features/hints.feature +++ b/tests/end2end/features/hints.feature @@ -44,6 +44,13 @@ Feature: Using hints - data/hints/link_blank.html - data/hello.txt + # https://github.com/qutebrowser/qutebrowser/issues/7842 + @qtwebkit_skip + Scenario: Following a hint from a local file to a remote origin + When I open file://(testdata)/hints/link_inject.html?port=(port) + And I hint with args "links" and follow a + Then data/hello.txt should be loaded + Scenario: Following a hint to link with sub-element and force to open in current tab. When I open data/hints/link_span.html And I hint with args "links current" and follow a diff --git a/tests/end2end/fixtures/quteprocess.py b/tests/end2end/fixtures/quteprocess.py index a3929ed7e..9a093bba8 100644 --- a/tests/end2end/fixtures/quteprocess.py +++ b/tests/end2end/fixtures/quteprocess.py @@ -61,6 +61,12 @@ def is_ignored_lowlevel_message(message): # Randomly started showing up on Qt 5.15.2 'QPaintDevice: Cannot destroy paint device that is being painted', + + # Qt 6.6 on GitHub Actions + ( + 'libva error: vaGetDriverNameByIndex() failed with unknown libva error, ' + 'driver_name = (null)' + ) ] return any(testutils.pattern_match(pattern=pattern, value=message) for pattern in ignored_messages) @@ -194,6 +200,11 @@ def is_ignored_chromium_message(line): # [5464:5464:0318/024215.821650:ERROR:interface_endpoint_client.cc(687)] Message 6 rejected by interface blink.mojom.WidgetHost # [5718:5718:0318/031330.803863:ERROR:interface_endpoint_client.cc(687)] Message 3 rejected by interface blink.mojom.Widget "Message * rejected by interface blink.mojom.Widget*", + + # GitHub Actions, Qt 6.6 + # [9895:9983:0904/043039.500565:ERROR:gpu_memory_buffer_support_x11.cc(49)] + # dri3 extension not supported. + "dri3 extension not supported.", ] return any(testutils.pattern_match(pattern=pattern, value=message) for pattern in ignored_messages) @@ -393,7 +404,7 @@ class QuteProc(testprocess.Process): verbatim. """ special_schemes = ['about:', 'qute:', 'chrome:', 'view-source:', - 'data:', 'http:', 'https:'] + 'data:', 'http:', 'https:', 'file:'] server = self.request.getfixturevalue('server') server_port = server.port if port is None else port diff --git a/tests/helpers/testutils.py b/tests/helpers/testutils.py index dc6fdac32..d74c46fcb 100644 --- a/tests/helpers/testutils.py +++ b/tests/helpers/testutils.py @@ -192,8 +192,26 @@ def pattern_match(*, pattern, value): def abs_datapath(): """Get the absolute path to the end2end data directory.""" - file_abs = os.path.abspath(os.path.dirname(__file__)) - return os.path.join(file_abs, '..', 'end2end', 'data') + path = pathlib.Path(__file__).parent / '..' / 'end2end' / 'data' + return path.resolve() + + +def substitute_testdata(path): + r"""Replace the (testdata) placeholder in path with `abs_datapath()`. + + If path is starting with file://, return path as an URI with file:// removed. This + is useful if path is going to be inserted into an URI: + + >>> path = substitute_testdata("C:\Users\qute") + >>> f"file://{path}/slug # results in valid URI + 'file:///C:/Users/qute/slug' + """ + if path.startswith('file://'): + testdata_path = abs_datapath().as_uri().replace('file://', '') + else: + testdata_path = str(abs_datapath()) + + return path.replace('(testdata)', testdata_path) @contextlib.contextmanager |