notifications: Drop Qt 5.13 support in libnotify presenter

Seems to segfault when showing the second notification, despite our
workarounds for Qt 5.14.

Partial stacktrace:

    0x00007fffeeacfdb2 in std::_Function_handler<void (std::unique_ptr<QWebEngineNotification, std::default_delete<QWebEngineNotification> >), meth_QWebEngineProfile_setNotificationPresenter::{lambda(std::unique_ptr<QWebEngineNotification, std::default_delete<QWebEngineNotification> >)#1}>::_M_invoke(std::_Any_data const&, std::unique_ptr<QWebEngineNotification, std::default_delete<QWebEngineNotification> >) ()
       from .../site-packages/PyQt5/QtWebEngineWidgets.so

    0x00007fffee89ff62 in QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController>&) ()
       from .../site-packages/PyQt5/Qt/lib/libQt5WebEngineWidgets.so.5

    0x00007fffe6f45921 in ?? () from .../site-packages/PyQt5/Qt/lib/libQt5WebEngineCore.so.5

It's unlikely this is something we can work around, so let's just
require Qt 5.14 instead.
This commit is contained in:
Florian Bruhin 2021-03-25 15:27:47 +01:00
parent 82b5f1e7a4
commit a60cafec3d
5 changed files with 29 additions and 19 deletions

View File

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

View File

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

View File

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

View File

@ -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 "&lt;&lt; &amp;&amp; &gt;&gt;"
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"

View File

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