summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2018-07-28 11:54:58 +0200
committerFlorian Bruhin <git@the-compiler.org>2018-08-15 10:55:18 +0200
commitcb76e78faf2b0f324efd4ed742949335df1d5aa5 (patch)
treeb74b6c688de560d565f91c43e6bd5bba32660ea8
parent76a96093c795faacd424eec5e5134e07fe416397 (diff)
downloadqutebrowser-cb76e78faf2b0f324efd4ed742949335df1d5aa5.tar.gz
qutebrowser-cb76e78faf2b0f324efd4ed742949335df1d5aa5.zip
Handle invalid URLs in acceptNavigationRequest in the tab API
(cherry picked from commit ee06ba0140ef5867abaae94b8270ea12960c10a9)
-rw-r--r--qutebrowser/browser/browsertab.py20
-rw-r--r--qutebrowser/browser/webengine/webview.py8
2 files changed, 14 insertions, 14 deletions
diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py
index 9a2d13242..4bf744624 100644
--- a/qutebrowser/browser/browsertab.py
+++ b/qutebrowser/browser/browsertab.py
@@ -854,12 +854,20 @@ class AbstractTab(QWidget):
navigation.navigation_type,
navigation.is_main_frame))
- if (navigation.navigation_type == navigation.Type.link_clicked and
- not navigation.url.isValid()):
- msg = urlutils.get_errstring(navigation.url,
- "Invalid link clicked")
- message.error(msg)
- self.data.open_target = usertypes.ClickTarget.normal
+ if not navigation.url.isValid():
+ # Also a WORKAROUND for missing IDNA 2008 support in QUrl, see
+ # https://bugreports.qt.io/browse/QTBUG-60364
+
+ if navigation.navigation_type == navigation.Type.link_clicked:
+ msg = urlutils.get_errstring(navigation.url,
+ "Invalid link clicked")
+ message.error(msg)
+ self.data.open_target = usertypes.ClickTarget.normal
+
+ log.webview.debug("Ignoring invalid URL {} in "
+ "acceptNavigationRequest: {}".format(
+ navigation.url.toDisplayString(),
+ navigation.url.errorString()))
navigation.accepted = False
def handle_auto_insert_mode(self, ok):
diff --git a/qutebrowser/browser/webengine/webview.py b/qutebrowser/browser/webengine/webview.py
index 784bc57d6..b10cc5f9a 100644
--- a/qutebrowser/browser/webengine/webview.py
+++ b/qutebrowser/browser/webengine/webview.py
@@ -242,14 +242,6 @@ class WebEnginePage(QWebEnginePage):
typ: QWebEnginePage.NavigationType,
is_main_frame: bool):
"""Override acceptNavigationRequest to forward it to the tab API."""
- if not url.isValid():
- # WORKAROUND for missing IDNA 2008 support in QUrl
- # see https://bugreports.qt.io/browse/QTBUG-60364
- log.webview.debug("Ignoring invalid URL {} in "
- "acceptNavigationRequest: {}".format(
- url.toDisplayString(), url.errorString()))
- return True
-
type_map = {
QWebEnginePage.NavigationTypeLinkClicked:
usertypes.NavigationRequest.Type.link_clicked,