From eaa1bdcddb42b35dafb6436440e71b2f43254996 Mon Sep 17 00:00:00 2001 From: Ian Walker Date: Sat, 16 Sep 2017 17:13:16 +0900 Subject: [PATCH] Show error page when user cancels proxy authentication dialog --- qutebrowser/browser/webengine/webview.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/webengine/webview.py b/qutebrowser/browser/webengine/webview.py index 12f658be8..ee28ab2da 100644 --- a/qutebrowser/browser/webengine/webview.py +++ b/qutebrowser/browser/webengine/webview.py @@ -148,7 +148,15 @@ class WebEnginePage(QWebEnginePage): @pyqtSlot(QUrl, 'QAuthenticator*', 'QString') def _on_proxy_authentication_required(self, url, authenticator, proxyHost): - shared.authentication_required(url, authenticator, [self.shutting_down, self.loadStarted]) + answer = shared.authentication_required(url, authenticator, [self.shutting_down, self.loadStarted]) + if answer is None: + authenticator.setUser(None) + authenticator.setPassword(None) + url_string = url.toDisplayString() + error_page = jinja.render( + 'error.html', title="Error loading page: {}".format(url_string), + url=url_string, error="Proxy authentication required.", icon='') + self.setHtml(error_page) @pyqtSlot(QUrl, 'QWebEnginePage::Feature') def _on_feature_permission_requested(self, url, feature):