diff options
-rw-r--r-- | qutebrowser/browser/webengine/webengineelem.py | 16 | ||||
-rw-r--r-- | tests/end2end/data/hints/link_inject.html | 19 | ||||
-rw-r--r-- | tests/end2end/features/hints.feature | 7 |
3 files changed, 35 insertions, 7 deletions
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/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/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 |