nsIAlertsService does not notify the listener when a notification closes automatically

RESOLVED INVALID

Status

defect
P3
normal
RESOLVED INVALID
3 years ago
Last year

People

(Reporter: bsilverberg, Assigned: bsilverberg)

Tracking

(Blocks 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [notifications] triaged)

This was tested on OS X 10.11, and is perhaps platform-specific.

When an alert is displayed and then goes away on its own, the listener is not notified with the "alertfinished" topic. If the alert is explicitly closed via the `closeAlert` method then the listener is notified with the "alertfinished" topic.

This could be an issue for web extensions notifications API as an extension might wait for the onClosed event to fire, and that event will not fire if the notification closes on its own.
No longer depends on: 1190681
Flags: blocking-webextensions?
Keywords: dev-doc-needed
OS: Unspecified → Mac OS X
Priority: P1 → --
Whiteboard: [notifications]triaged → [notifications]
Version: 34 Branch → unspecified
Flags: blocking-webextensions?
Priority: -- → P3
Whiteboard: [notifications] → [notifications] triaged
Taking this for now to see how Chrome behaves. If Chrome does correctly fire the onClosed event when a notification goes away "on its own", then I will follow up with the maintainers of the nsIAlertsService to see if this behaviour is expected and whether we should try to fix it.
Assignee: nobody → bob.silverberg
Status: NEW → ASSIGNED
Iteration: --- → 49.1 - May 9
I verified that on Chrome it behaves as documented: if a notification closes on its own, without any user interaction, it does fire the `onClosed` event.

Kit, can you comment on the fact that the `alertfinished` topic is not fired when an alert created via `nsIAlertsService.showAlertNotification` is closed without user interaction? Does this seem like a bug that should be fixed?
Flags: needinfo?(kcambridge)
TL;DR: It depends on the platform. :-)

On Windows and some Linux window managers (where we don't use native notifications) `alertfinished` will fire when the notification goes away. On OS X and GNOME, notifications that go away without user interaction are still visible in the notification center.

If you clear the notification from the notification center, `alertfinished` should fire. (You can also click on the notification to fire `alertclickcallback`).

Out of curiosity, how does Chrome behave if you set chrome://flags/#enable-native-notifications?
Flags: needinfo?(kcambridge)
Hmm, when I enable notifications via chrome://flags/#enable-native-notifications it claims that it's been enabled, but it still generates its own notifications - it does not use native OS X notifications. 

It sounds like you're saying that this isn't really a bug in any case, just something that users on systems on which we use native notifications will have to deal with.
I'm guessing based on comment 3, above, that this should be closed as invalid, so I am going to do so. If anyone takes issue with that feel free to reopen.
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → INVALID
(In reply to Bob Silverberg [:bsilverberg] from comment #4)
> It sounds like you're saying that this isn't really a bug in any case, just
> something that users on systems on which we use native notifications will
> have to deal with.

I'm so sorry I forgot to respond. Yes, I think it's a quirk of how the system handles native notifications, rather than a bug. Thanks for following up!
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.