From 6f620a6a9ecae12a22d2b13882639b834604687d Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 11 May 2015 19:11:49 +0200 Subject: [PATCH] Handle title correctly for pages without title. Fixes #667. --- qutebrowser/browser/webview.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qutebrowser/browser/webview.py b/qutebrowser/browser/webview.py index 110c57be7..50635acb0 100644 --- a/qutebrowser/browser/webview.py +++ b/qutebrowser/browser/webview.py @@ -378,6 +378,8 @@ class WebView(QWebView): if url.isValid(): self.cur_url = url self.url_text_changed.emit(url.toDisplayString()) + if not self.title(): + self.titleChanged.emit(self.url().toDisplayString()) @pyqtSlot('QMouseEvent') def on_mouse_event(self, evt): @@ -396,7 +398,7 @@ class WebView(QWebView): @pyqtSlot() def on_load_finished(self): - """Handle auto-insert-mode after loading finished. + """Handle a finished page load. We don't take loadFinished's ok argument here as it always seems to be true when the QWebPage has an ErrorPageExtension implemented. @@ -409,6 +411,12 @@ class WebView(QWebView): self._set_load_status(LoadStatus.warn) else: self._set_load_status(LoadStatus.error) + if not self.title(): + self.titleChanged.emit(self.url().toDisplayString()) + self._handle_auto_insert_mode(ok) + + def _handle_auto_insert_mode(self, ok): + """Handle auto-insert-mode after loading finished.""" if not config.get('input', 'auto-insert-mode'): return mode_manager = objreg.get('mode-manager', scope='window',