From ea1627c1e69c4a0485f6f062fcad3d71b10923e1 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 26 Jan 2016 19:47:31 +0100 Subject: [PATCH] Cancel permission prompt when tab is closed. Fixes #1250. --- CHANGELOG.asciidoc | 2 ++ qutebrowser/browser/webpage.py | 1 + tests/integration/features/prompts.feature | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 165823b99..622e255f9 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -36,6 +36,8 @@ Fixed - Fixed starting with -c "". - Fixed crash when a tab is closed twice via javascript (e.g. Dropbox authentication dialogs) +- Fixed crash when a notification/geolocation prompt is answered after closing + the tab it belongs to. v0.5.1 ------ diff --git a/qutebrowser/browser/webpage.py b/qutebrowser/browser/webpage.py index 49a77cc8c..2946f4f12 100644 --- a/qutebrowser/browser/webpage.py +++ b/qutebrowser/browser/webpage.py @@ -372,6 +372,7 @@ class BrowserPage(QWebPage): q.answered_no.connect(no_action) q.cancelled.connect(no_action) + self.shutting_down.connect(q.abort) q.completed.connect(q.deleteLater) self.featurePermissionRequestCanceled.connect(functools.partial( diff --git a/tests/integration/features/prompts.feature b/tests/integration/features/prompts.feature index d3f77f6da..f00c1184d 100644 --- a/tests/integration/features/prompts.feature +++ b/tests/integration/features/prompts.feature @@ -178,6 +178,15 @@ Feature: Prompts And I run :leave-mode Then the javascript message "notification permission aborted" should be logged + Scenario: answering notification after closing tab + When I set content -> notifications to ask + And I open data/prompt/notifications.html in a new tab + And I click the button + And I wait for a prompt + And I run :tab-close + And I wait for "Leaving mode KeyMode.yesno (reason: aborted)" in the log + Then no crash should happen + # Page authentication Scenario: Successful webpage authentification