From 72566412882c938662f44c37d5ccfd5383dedc57 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 4 Nov 2016 13:21:22 +0100 Subject: [PATCH] Prevent questions from being aborted twice When we abort a question (e.g. by closing a tab with SSL errors) while another prompt is queued, the right prompt gets closed by the question being aborted, but that in turn aborts the question again, affecting the next prompt. --- qutebrowser/utils/usertypes.py | 3 +++ tests/end2end/features/prompts.feature | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/qutebrowser/utils/usertypes.py b/qutebrowser/utils/usertypes.py index 40ec1c4a6..4e67a2eac 100644 --- a/qutebrowser/utils/usertypes.py +++ b/qutebrowser/utils/usertypes.py @@ -407,6 +407,9 @@ class Question(QObject): @pyqtSlot() def abort(self): """Abort the question.""" + if self.is_aborted: + log.misc.debug("Question was already aborted") + return self.is_aborted = True try: self.aborted.emit() diff --git a/tests/end2end/features/prompts.feature b/tests/end2end/features/prompts.feature index 9853b6176..fe39a90be 100644 --- a/tests/end2end/features/prompts.feature +++ b/tests/end2end/features/prompts.feature @@ -452,3 +452,18 @@ Feature: Prompts "authenticated": true, "user": "user2" } + + # https://github.com/The-Compiler/qutebrowser/issues/1249#issuecomment-175205531 + # https://github.com/The-Compiler/qutebrowser/pull/2054#issuecomment-258285544 + Scenario: Interrupting SSL prompt during a notification prompt + When I set content -> notifications to ask + And I set network -> ssl-strict to ask + And I open data/prompt/notifications.html in a new tab + And I run :click-element id button + And I wait for a prompt + And I open about:blank in a new tab + And I load an SSL page + And I wait for a prompt + And I run :tab-close + And I run :prompt-accept yes + Then the javascript message "notification permission granted" should be logged