Closed Bug 1786578 Opened 3 years ago Closed 3 years ago

Remove alerts from private browsing windows and when clearing site data

Categories

(Toolkit Graveyard :: Notifications and Alerts, task)

Tracking

(firefox106 fixed)

RESOLVED FIXED
106 Branch
Tracking Status
firefox106 --- fixed

People

(Reporter: nalexander, Assigned: nrishel)

References

Details

(Whiteboard: [fidedi-notifications])

Attachments

(1 file)

Bug 1774083 changes Windows toast notifications: they will be shunted to the Windows Action Centre rather than being removed entirely when the tab and/or Firefox are closed. To avoid user surprise, we should likely remove alerts entirely from private browsing windows and when clearing site data.

Assignee: nobody → nrishel
Whiteboard: [fidedi-notifications]

There is a service specifically for cleaning up various things due to user action or on shutdown, nsIClearDataService. We might add a cleaner for system alerts and implement it only on Windows for toast notifications. Start reading around here.

For cleaning up after closing private browsing windows, it rather looks like the relevant observer notification is last-pb-context-exited. That seems to be global, not per-window, but that might not matter.

nsIAlertService and by extension nsIWindowsAlertsService are being torn down before the last-pb-context-exited (and the currently observed quit-application) observer is called. Any pointers on how service lifetime is managed here? Or was your idea that nsIClearDataService could spin something up or increment nsIAlertService's refcount so that it remains available?

Flags: needinfo?(nalexander)

(In reply to Nick Rishel [:nrishel] from comment #2)

nsIAlertService and by extension nsIWindowsAlertsService are being torn down before the last-pb-context-exited (and the currently observed quit-application) observer is called. Any pointers on how service lifetime is managed here? Or was your idea that nsIClearDataService could spin something up or increment nsIAlertService's refcount so that it remains available?

If you open a private browsing window and then close it, last-pb-context-exited will fire. It's not tied to application shutdown (quit-application{-granted} and friends). It might be that we need to be more precise about which notifications we allow to live forever, perhaps by conditionally re-instating https://hg.mozilla.org/mozilla-central/rev/ad20680728cc4fefc9ea7254b2b594fc442721ba#l1.59 when the underlying tab is in a private browsing context, to address this.

nsIClearDataService is distinct: it's a system for cleaning things up on exit and from the about:preferences UI.

Flags: needinfo?(nalexander)

Prior to this commit the ToastNotification's observer registration doesn't work due to ToastNotification not implementing nsIWeakReference while attempting to register itself as an observer as a weak reference.

Pushed by nrishel@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a003cf00a8a1 Dismiss Windows native toast notifications when Firefox is closed in a private browsing session. r=nalexander.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 106 Branch
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: