mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 16:55:40 +00:00
Bug 1605997: Unregister notifications that are replaced by a new notification with the same name. r=jmathies
Showing a new notification with the same name of an existing notification replaces the old notification so we must unregister it from Windows at that point. Differential Revision: https://phabricator.services.mozilla.com/D58270 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
2ca21259af
commit
3f0c6ba8fc
@ -146,6 +146,8 @@ ToastNotification::ShowAlert(nsIAlertNotification* aAlert,
|
||||
return rv;
|
||||
}
|
||||
|
||||
RefPtr<ToastNotificationHandler> oldHandler = mActiveHandlers.Get(name);
|
||||
|
||||
RefPtr<ToastNotificationHandler> handler = new ToastNotificationHandler(
|
||||
this, aAlertListener, name, cookie, title, text, hostPort, textClickable);
|
||||
mActiveHandlers.Put(name, handler);
|
||||
@ -157,6 +159,11 @@ ToastNotification::ShowAlert(nsIAlertNotification* aAlert,
|
||||
return rv;
|
||||
}
|
||||
|
||||
// If there was a previous handler with the same name then unregister it.
|
||||
if (oldHandler) {
|
||||
oldHandler->UnregisterHandler();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user