From 7c88fe318f7b881b79e397bcf8c1f7047e367423 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 16 Nov 2016 22:12:57 +0100 Subject: [PATCH] Handle cancelled SSL prompts correctly When the user pressed esc during an SSL prompt, the message.ask call returned None, which was handled fine by QtWebKit (which simply used an 'if') but failed with QtWebEngine (which returned the value to Qt). Fixes #2123. --- qutebrowser/browser/shared.py | 10 +++++++--- tests/end2end/features/prompts.feature | 8 ++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/shared.py b/qutebrowser/browser/shared.py index 5db2d9fa0..8536ea837 100644 --- a/qutebrowser/browser/shared.py +++ b/qutebrowser/browser/shared.py @@ -146,9 +146,13 @@ def ignore_certificate_errors(url, errors, abort_on): """.strip()) msg = err_template.render(url=url, errors=errors) - return message.ask(title="Certificate errors - continue?", text=msg, - mode=usertypes.PromptMode.yesno, default=False, - abort_on=abort_on) + ignore = message.ask(title="Certificate errors - continue?", text=msg, + mode=usertypes.PromptMode.yesno, default=False, + abort_on=abort_on) + if ignore is None: + # prompt aborted + ignore = False + return ignore elif ssl_strict is False: log.webview.debug("ssl-strict is False, only warning about errors") for err in errors: diff --git a/tests/end2end/features/prompts.feature b/tests/end2end/features/prompts.feature index 978e79406..00cb93dd9 100644 --- a/tests/end2end/features/prompts.feature +++ b/tests/end2end/features/prompts.feature @@ -197,6 +197,14 @@ Feature: Prompts And I run :prompt-accept no Then a SSL error page should be shown + Scenario: SSL error with ssl-strict = ask -> abort + When I clear SSL errors + And I set network -> ssl-strict to ask + And I load an SSL page + And I wait for a prompt + And I run :leave-mode + Then a SSL error page should be shown + # Geolocation Scenario: Always rejecting geolocation