diff --git a/doc/help/settings.asciidoc b/doc/help/settings.asciidoc index 145e66abf..c997d05fb 100644 --- a/doc/help/settings.asciidoc +++ b/doc/help/settings.asciidoc @@ -2504,11 +2504,11 @@ Default: empty [[content.notification_presenter]] === content.notification_presenter What notification presenter to use for web notifications. -Windows and macOS will always act as if this is set to `qt.` +Note that with Qt 5.14, certain JavaScript features for notifications will not work with the libnotify notification presenter (the `click` and `close` events, as well as the `tag` option to replace existing notifications). This setting requires a restart. -On QtWebEngine, this setting requires Qt 5.13 or newer. +On QtWebEngine, this setting requires Qt 5.14 or newer. On QtWebKit, this setting is unavailable. diff --git a/qutebrowser/browser/webengine/notification.py b/qutebrowser/browser/webengine/notification.py index a0bddc019..238b2ee5a 100644 --- a/qutebrowser/browser/webengine/notification.py +++ b/qutebrowser/browser/webengine/notification.py @@ -90,8 +90,8 @@ class DBusNotificationPresenter(QObject): def __init__(self, test_service: bool = False): super().__init__() - if not qtutils.version_check('5.13'): - raise Error("Notifications are not supported on this Qt version") + if not qtutils.version_check('5.14'): + raise Error("Notifications are not supported on Qt < 5.14") if utils.is_windows: # The QDBusConnection destructor seems to cause error messages (and diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index 0c1b6b2ed..fd488f2b1 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -921,12 +921,14 @@ content.notification_presenter: - libnotify: Use a libnotify-compatible presenter if DBus is available, show an error (and fall back to Qt's presenter) otherwise. backend: - QtWebEngine: Qt 5.13 + QtWebEngine: Qt 5.14 QtWebKit: false desc: >- What notification presenter to use for web notifications. - Windows and macOS will always act as if this is set to `qt.` + Note that with Qt 5.14, certain JavaScript features for notifications will not work + with the libnotify notification presenter (the `click` and `close` events, as well + as the `tag` option to replace existing notifications). content.pdfjs: default: false diff --git a/tests/end2end/features/notifications.feature b/tests/end2end/features/notifications.feature index e84bb00be..829bd9464 100644 --- a/tests/end2end/features/notifications.feature +++ b/tests/end2end/features/notifications.feature @@ -8,13 +8,11 @@ Feature: Notifications And I set content.notifications to true And I run :click-element id button - @qtwebengine_notifications Scenario: Notification is shown When I run :click-element id show-button Then the javascript message "notification shown" should be logged And a notification with id 1 should be presented - @qtwebengine_notifications Scenario: Notification containing escaped characters Given the notification server supports body markup When I run :click-element id show-symbols-button @@ -22,7 +20,6 @@ Feature: Notifications And notification 1 should have body "<< && >>" And notification 1 should have title "<< && >>" - @qtwebengine_notifications Scenario: Notification containing escaped characters with no body markup Given the notification server doesn't support body markup When I run :click-element id show-symbols-button @@ -37,7 +34,7 @@ Feature: Notifications # we try to close it, otherwise we wind up in race-condition-ish # situations. - @qtwebengine_notifications @pyqtwebengine>=5.15.0 + @pyqtwebengine>=5.15.0 Scenario: Replacing existing notifications When I run :click-element id show-multiple-button Then the javascript message "i=1 notification shown" should be logged @@ -46,7 +43,7 @@ Feature: Notifications And 1 notification should be presented And notification 1 should have title "i=3" - @qtwebengine_notifications @pyqtwebengine<5.15.0 + @pyqtwebengine<5.15.0 Scenario: Replacing existing notifications (old Qt) When I run :click-element id show-multiple-button Then the javascript message "i=1 notification shown" should be logged @@ -60,14 +57,14 @@ Feature: Notifications And notification 2 should have title "i=2" And notification 3 should have title "i=3" - @qtwebengine_notifications @pyqtwebengine>=5.15.0 + @pyqtwebengine>=5.15.0 Scenario: User closes presented notification When I run :click-element id show-button And I wait for the javascript message "notification shown" And I close the notification with id 1 Then the javascript message "notification closed" should be logged - @qtwebengine_notifications @pyqtwebengine<5.15.0 + @pyqtwebengine<5.15.0 Scenario: User closes presented notification (old Qt) When I run :click-element id show-button And I wait for the javascript message "notification shown" @@ -76,21 +73,21 @@ Feature: Notifications And the javascript message "notification closed" should not be logged And no crash should happen - @qtwebengine_notifications @pyqtwebengine>=5.15.0 + @pyqtwebengine>=5.15.0 Scenario: User closes some other application's notification When I run :click-element id show-button And I wait for the javascript message "notification shown" And I close the notification with id 1234 Then the javascript message "notification closed" should not be logged - @qtwebengine_notifications @pyqtwebengine>=5.15.0 + @pyqtwebengine>=5.15.0 Scenario: User clicks presented notification When I run :click-element id show-button And I wait for the javascript message "notification shown" And I click the notification with id 1 Then the javascript message "notification clicked" should be logged - @qtwebengine_notifications @pyqtwebengine<5.15.0 + @pyqtwebengine<5.15.0 Scenario: User clicks presented notification (old Qt) When I run :click-element id show-button And I wait for the javascript message "notification shown" @@ -99,14 +96,14 @@ Feature: Notifications Then the javascript message "notification clicked" should not be logged And no crash should happen - @qtwebengine_notifications @pyqtwebengine>=5.15.0 + @pyqtwebengine>=5.15.0 Scenario: User clicks some other application's notification When I run :click-element id show-button And I wait for the javascript message "notification shown" And I click the notification with id 1234 Then the javascript message "notification clicked" should not be logged - @qtwebengine_notifications @pyqtwebengine>=5.15.0 + @pyqtwebengine>=5.15.0 Scenario: Unknown action with some other application's notification When I run :click-element id show-button And I wait for the javascript message "notification shown" diff --git a/tests/end2end/features/test_notifications_bdd.py b/tests/end2end/features/test_notifications_bdd.py index 5c846b08d..2dd99eed0 100644 --- a/tests/end2end/features/test_notifications_bdd.py +++ b/tests/end2end/features/test_notifications_bdd.py @@ -19,10 +19,21 @@ import pytest import pytest_bdd as bdd + +from qutebrowser.utils import qtutils + + bdd.scenarios('notifications.feature') -pytestmark = pytest.mark.usefixtures('notification_server') +pytestmark = [ + pytest.mark.usefixtures('notification_server'), + pytest.mark.qtwebengine_notifications, + pytest.mark.skipif( + not qtutils.version_check('5.14'), + reason="Custom notification presenters segfault with Qt/PyQtWebEngine 5.13", + ), +] @bdd.given("the notification server supports body markup")