summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-08-17 23:00:04 +0200
committerFlorian Bruhin <me@the-compiler.org>2023-08-17 23:00:04 +0200
commita2697feb48e95f8f7491ba7a3db825b5cc520710 (patch)
tree93ef9a9f9e56cd7c32db65445ca68b99066cfe7b
parent051b0d6087ac70a5d7b6c8116b112a616966ed77 (diff)
downloadqutebrowser-a2697feb48e95f8f7491ba7a3db825b5cc520710.tar.gz
qutebrowser-a2697feb48e95f8f7491ba7a3db825b5cc520710.zip
Work around back/forward navigation from qute://bookmark
With Qt 6.3+, user interaction is required to navigate outside of qute:// from a qute:// page. Follow-up to 8defe1ae44c1c524e937ae08ed16052ee0724e0f. Also see 216a9f9a9b7386823decf3c2c8a6124a86e2cad8 Fixes #7815 See #7220 - should be revisited once we have a qute-bookmarks:// instead where we can adjust permissions when registering the URL handler.
-rw-r--r--qutebrowser/browser/browsertab.py29
-rw-r--r--tests/end2end/features/urlmarks.feature11
2 files changed, 33 insertions, 7 deletions
diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py
index 495d4325d..1312275dc 100644
--- a/qutebrowser/browser/browsertab.py
+++ b/qutebrowser/browser/browsertab.py
@@ -1148,10 +1148,11 @@ class AbstractTab(QWidget):
) -> None:
"""Handle common acceptNavigationRequest code."""
url = utils.elide(navigation.url.toDisplayString(), 100)
- log.webview.debug("navigation request: url {}, type {}, is_main_frame "
- "{}".format(url,
- navigation.navigation_type,
- navigation.is_main_frame))
+ log.webview.debug(
+ f"navigation request: url {url} (current {self.url().toDisplayString()}), "
+ f"type {navigation.navigation_type.name}, "
+ f"is_main_frame {navigation.is_main_frame}"
+ )
if navigation.is_main_frame:
self.data.last_navigation = navigation
@@ -1171,14 +1172,17 @@ class AbstractTab(QWidget):
# WORKAROUND for QtWebEngine >= 6.2 not allowing form requests from
# qute:// to outside domains.
+ needs_load_workarounds = (
+ objects.backend == usertypes.Backend.QtWebEngine and
+ version.qtwebengine_versions().webengine >= utils.VersionNumber(6, 2)
+ )
if (
+ needs_load_workarounds and
self.url() == QUrl("qute://start/") and
navigation.navigation_type == navigation.Type.form_submitted and
navigation.url.matches(
QUrl(config.val.url.searchengines['DEFAULT']),
- urlutils.FormatOption.REMOVE_QUERY) and
- objects.backend == usertypes.Backend.QtWebEngine and
- version.qtwebengine_versions().webengine >= utils.VersionNumber(6, 2)
+ urlutils.FormatOption.REMOVE_QUERY)
):
log.webview.debug(
"Working around qute://start loading issue for "
@@ -1186,6 +1190,17 @@ class AbstractTab(QWidget):
navigation.accepted = False
self.load_url(navigation.url)
+ if (
+ needs_load_workarounds and
+ self.url() == QUrl("qute://bookmarks/") and
+ navigation.navigation_type == navigation.Type.back_forward
+ ):
+ log.webview.debug(
+ "Working around qute://bookmarks loading issue for "
+ f"{navigation.url.toDisplayString()}")
+ navigation.accepted = False
+ self.load_url(navigation.url)
+
@pyqtSlot(bool)
def _on_load_finished(self, ok: bool) -> None:
assert self._widget is not None
diff --git a/tests/end2end/features/urlmarks.feature b/tests/end2end/features/urlmarks.feature
index 05d07ae98..70962d2d1 100644
--- a/tests/end2end/features/urlmarks.feature
+++ b/tests/end2end/features/urlmarks.feature
@@ -271,3 +271,14 @@ Feature: quickmarks and bookmarks
And I open qute://bookmarks
And I hint with args "links current" and follow a
Then data/numbers/1.txt should be loaded
+
+ Scenario: Following a bookmark and going back/forward
+ When I open data/numbers/1.txt in a new tab
+ And I run :bookmark-add
+ And I open qute://bookmarks
+ And I hint with args "links current" and follow a
+ And I wait until data/numbers/1.txt is loaded
+ And I run :back
+ And I wait until qute://bookmarks is loaded
+ And I run :forward
+ Then data/numbers/1.txt should be loaded