From b238149e1e0ced6dde2378876f7161febd7f3936 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 8 Oct 2014 21:22:43 +0200 Subject: [PATCH] Fix closing tabs with invalid URLs. Fixes #163. --- qutebrowser/widgets/tabbedbrowser.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qutebrowser/widgets/tabbedbrowser.py b/qutebrowser/widgets/tabbedbrowser.py index 6b69d1bc2..6d1661c16 100644 --- a/qutebrowser/widgets/tabbedbrowser.py +++ b/qutebrowser/widgets/tabbedbrowser.py @@ -248,9 +248,17 @@ class TabbedBrowser(tabwidget.TabWidget): history_data = qtutils.serialize(tab.history()) entry = UndoEntry(tab.cur_url, history_data) self._undo_stack.append(entry) + elif tab.cur_url.isEmpty(): + # There are some good reasons why an URL could be empty + # (target="_blank" with a download, see [1]), so we silently ignore + # this. + # [1] https://github.com/The-Compiler/qutebrowser/issues/163 + pass else: + # We display a warnings for URLs which are not empty but invalid - + # but we don't return here because we want the tab to close either + # way. urlutils.invalid_url_error(self._win_id, tab.cur_url, "saving tab") - return tab.shutdown() self.removeTab(idx) tab.deleteLater()