Closed Bug 1418287 Opened 7 years ago Closed 7 years ago

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

Categories

(Toolkit Graveyard :: Notifications and Alerts, enhancement)

56 Branch
enhancement
Not set
normal

Tracking

(firefox59 fixed)

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: robwu, Assigned: robwu)

References

Details

Attachments

(1 file)

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: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Component: DOM → Notifications and Alerts
Product: Core → Toolkit
Product: Toolkit → Toolkit Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: