Add preference to disable native notifications (and use XUL notifications instead)

RESOLVED FIXED in Firefox 59

Status

()

enhancement
RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: robwu, Assigned: robwu)

Tracking

56 Branch
mozilla59
Points:
---

Firefox Tracking Flags

(firefox59 fixed)

Details

Attachments

(1 attachment)

Bug 858919 brought native desktop notification support through libnotify to Linux.
I did not like the UX back then and created and add-on to revert back to XUL notifications: https://addons.mozilla.org/en-US/firefox/addon/no-native-notifications/

With Firefox 57, this add-on does not work any more.
I tried to give native notifications another go, but was disappointed by the buggy behavior:

bug 1418281 (onclick is not fired at all, onclose is fired too early)
bug 1417846 (requireInteraction is not supported)

I want an option to revert back to XUL notifications, to be able to continue using desktop notifications until the above issues are resolved.
I manually tested that the patch works, as follows:

1. Build Firefox with the patch.
2. Run:
Notification.requestPermission().then(() => new Notification('hello'));
3. Confirm that a system notification is shown (=current default behavior).
4. Visit about:config, search for the name of the pref (alerts.useSystemBackend) and flip it (to false).
5. Repeat step 2, and confirm that a XUL notification is shown.
6. Repeat step 4 to flip the pref back to true.
7. Repeat step 2, and confirm that a system notification is shown.
Comment on attachment 8929414 [details]
Bug 1418287 - Add preference to disable the system notification service

https://reviewboard.mozilla.org/r/200740/#review205950

::: toolkit/components/alerts/nsAlertsService.cpp:177
(Diff revision 1)
> +bool nsAlertsService::ShouldUseSystemBackend()
> +{
> +  if (!mBackend) {
> +    return false;
> +  }
> +  return Preferences::GetBool("alerts.useSystemBackend", true);

AddBoolVarCache instead.
Attachment #8929414 - Flags: review?(amarchesini) → review+
Comment on attachment 8929414 [details]
Bug 1418287 - Add preference to disable the system notification service

https://reviewboard.mozilla.org/r/200740/#review205952

I want to see it again with AddBoolVarCache.
Attachment #8929414 - Flags: review+ → review-
Comment on attachment 8929414 [details]
Bug 1418287 - Add preference to disable the system notification service

https://reviewboard.mozilla.org/r/200740/#review205980
Attachment #8929414 - Flags: review?(amarchesini) → review+
Pushed by rob@robwu.nl:
https://hg.mozilla.org/integration/autoland/rev/490462a74289
Add preference to disable the system notification service r=baku
https://hg.mozilla.org/mozilla-central/rev/490462a74289
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Component: DOM → Notifications and Alerts
Product: Core → Toolkit
You need to log in before you can comment on or make changes to this bug.