summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2023-08-10 16:32:24 +0200
committerFlorian Bruhin <me@the-compiler.org>2023-08-10 16:37:40 +0200
commit216a9f9a9b7386823decf3c2c8a6124a86e2cad8 (patch)
treebc8f7f9bdb9d0a7517ec742e005a8d72ec59c723
parent8defe1ae44c1c524e937ae08ed16052ee0724e0f (diff)
downloadqutebrowser-216a9f9a9b7386823decf3c2c8a6124a86e2cad8.tar.gz
qutebrowser-216a9f9a9b7386823decf3c2c8a6124a86e2cad8.zip
Make qute://start search work with QtWebEngine 6.3+
Until we look at #7220 proper (thus splitting this into a qute-start:// which could probably have more permissions to do remote requests), we'll need to do with somewhat of a hack to allow this even if QtWebEngine does not. Given the very limited scope (only from qute://start, only opening the search engine URL, only with a form submitted request), this should be acceptable without compromsing security in any way. Fixes #7790
-rw-r--r--qutebrowser/browser/browsertab.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py
index b6cc303cf..82ef84a3d 100644
--- a/qutebrowser/browser/browsertab.py
+++ b/qutebrowser/browser/browsertab.py
@@ -30,7 +30,7 @@ if TYPE_CHECKING:
from qutebrowser.keyinput import modeman
from qutebrowser.config import config, websettings
from qutebrowser.utils import (utils, objreg, usertypes, log, qtutils,
- urlutils, message, jinja)
+ urlutils, message, jinja, version)
from qutebrowser.misc import miscwidgets, objects, sessions
from qutebrowser.browser import eventfilter, inspector
from qutebrowser.qt import sip
@@ -1169,6 +1169,23 @@ class AbstractTab(QWidget):
navigation.url.errorString()))
navigation.accepted = False
+ # WORKAROUND for QtWebEngine >= 6.3 not allowing form requests from
+ # qute:// to outside domains.
+ if (
+ self.url() == QUrl("qute://start/") and
+ navigation.navigation_type == navigation.Type.form_submitted and
+ navigation.url.matches(
+ QUrl(config.val.url.searchengines['DEFAULT']),
+ QUrl.UrlFormattingOption.RemoveQuery) and
+ objects.backend == usertypes.Backend.QtWebEngine and
+ version.qtwebengine_versions().webengine >= utils.VersionNumber(6, 3)
+ ):
+ log.webview.debug(
+ "Working around qute://start 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