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.
This commit is contained in:
Florian Bruhin 2016-11-16 22:12:57 +01:00
parent 52df867030
commit 7c88fe318f
2 changed files with 15 additions and 3 deletions

View File

@ -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:

View File

@ -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