diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index f1857327b..6206a7774 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -706,7 +706,9 @@ class WebEngineTab(browsertab.AbstractTab): self._widget.shutdown() def reload(self, *, force=False): - self.predicted_navigation.emit(self.url()) + if self.url().isValid(): + self.predicted_navigation.emit(self.url()) + if force: action = QWebEnginePage.ReloadAndBypassCache else: @@ -931,6 +933,7 @@ class WebEngineTab(browsertab.AbstractTab): @pyqtSlot(QUrl) def _on_predicted_navigation(self, url): """If we know we're going to visit an URL soon, change the settings.""" + qtutils.ensure_valid(url) self.settings.update_for_url(url) @pyqtSlot(usertypes.NavigationRequest) diff --git a/qutebrowser/browser/webkit/webkittab.py b/qutebrowser/browser/webkit/webkittab.py index 422645e61..934fdb3c3 100644 --- a/qutebrowser/browser/webkit/webkittab.py +++ b/qutebrowser/browser/webkit/webkittab.py @@ -701,7 +701,9 @@ class WebKitTab(browsertab.AbstractTab): self._widget.shutdown() def reload(self, *, force=False): - self.predicted_navigation.emit(self.url()) + if self.url().isValid(): + self.predicted_navigation.emit(self.url()) + if force: action = QWebPage.ReloadAndBypassCache else: diff --git a/qutebrowser/config/websettings.py b/qutebrowser/config/websettings.py index c069f7d56..cfb53e658 100644 --- a/qutebrowser/config/websettings.py +++ b/qutebrowser/config/websettings.py @@ -22,7 +22,7 @@ from PyQt5.QtGui import QFont from qutebrowser.config import config, configutils -from qutebrowser.utils import log, usertypes, urlmatch +from qutebrowser.utils import log, usertypes, urlmatch, qtutils from qutebrowser.misc import objects UNSET = object() @@ -141,6 +141,7 @@ class AbstractSettings: Return: A set of settings which actually changed. """ + qtutils.ensure_valid(url) changed_settings = set() for values in config.instance: if not values.opt.supports_pattern: