mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 782211 - Part 3: Make nsDesktopNotification generate unique name and cookies to prevent collision in the IPC observer and coalescing in the alerts service. r=dougt
This commit is contained in:
parent
bde7265a6d
commit
2f3483cb2d
@ -27,6 +27,8 @@ NS_IMPL_ISUPPORTS1(AlertServiceObserver, nsIObserver)
|
|||||||
/* nsDesktopNotification */
|
/* nsDesktopNotification */
|
||||||
/* ------------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------------ */
|
||||||
|
|
||||||
|
uint32_t nsDOMDesktopNotification::sCount = 0;
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsDOMDesktopNotification::PostDesktopNotification()
|
nsDOMDesktopNotification::PostDesktopNotification()
|
||||||
{
|
{
|
||||||
@ -56,11 +58,17 @@ nsDOMDesktopNotification::PostDesktopNotification()
|
|||||||
if (!alerts)
|
if (!alerts)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
|
// Generate a unique name (which will also be used as a cookie) because
|
||||||
|
// the nsIAlertsService will coalesce notifications with the same name.
|
||||||
|
// In the case of IPC, the parent process will use the cookie to map
|
||||||
|
// to nsIObservers, thus cookies must be unique to differentiate observers.
|
||||||
|
nsString uniqueName = NS_LITERAL_STRING("desktop-notification:");
|
||||||
|
uniqueName.AppendInt(sCount++);
|
||||||
return alerts->ShowAlertNotification(mIconURL, mTitle, mDescription,
|
return alerts->ShowAlertNotification(mIconURL, mTitle, mDescription,
|
||||||
true,
|
true,
|
||||||
EmptyString(),
|
uniqueName,
|
||||||
mObserver,
|
mObserver,
|
||||||
EmptyString(),
|
uniqueName,
|
||||||
NS_LITERAL_STRING("auto"),
|
NS_LITERAL_STRING("auto"),
|
||||||
EmptyString());
|
EmptyString());
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,8 @@ protected:
|
|||||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||||
bool mAllow;
|
bool mAllow;
|
||||||
bool mShowHasBeenCalled;
|
bool mShowHasBeenCalled;
|
||||||
|
|
||||||
|
static uint32_t sCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user