Ignore invalid URLs in acceptNavigationRequest

This commit is contained in:
Florian Bruhin 2018-07-28 09:18:50 +02:00
parent 6fa07703db
commit 7ac7ccc296
2 changed files with 10 additions and 0 deletions

View File

@ -37,6 +37,8 @@ Fixed
- Crash when using `:follow-selected` with a link which is outside of the view.
- Workaround for windows not showing as urgent with some window managers
(like i3).
- Crash when opening URLs with some unicode characters (IDNA 2008). Those URLs
still won't open though, due to missing support in Qt.
v1.4.1
------

View File

@ -242,6 +242,14 @@ 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,