Bug 814157 - Need additional security checks for the "desktop-notification" permission. r=fabrice

This commit is contained in:
Gregor Wagner 2012-12-20 11:06:42 -08:00
parent a8f9e85501
commit e705855918
2 changed files with 12 additions and 3 deletions

View File

@ -741,10 +741,16 @@ var AlertsHelper = {
uid, name, null);
},
receiveMessage: function alert_receiveMessage(message) {
let data = message.data;
receiveMessage: function alert_receiveMessage(aMessage) {
if (!aMessage.target.assertPermission("desktop-notification")) {
Cu.reportError("Desktop-notification message " + aMessage.name +
" from a content process with no desktop-notification privileges.");
return null;
}
let data = aMessage.data;
let listener = {
mm: message.target,
mm: aMessage.target,
title: data.title,
text: data.text,
manifestURL: data.manifestURL,

View File

@ -1810,6 +1810,9 @@ ContentParent::RecvShowAlertNotification(const nsString& aImageUrl, const nsStri
const nsString& aText, const bool& aTextClickable,
const nsString& aCookie, const nsString& aName)
{
if (!AssertAppProcessPermission(this, "desktop-notification")) {
return false;
}
nsCOMPtr<nsIAlertsService> sysAlerts(do_GetService(NS_ALERTSERVICE_CONTRACTID));
if (sysAlerts) {
sysAlerts->ShowAlertNotification(aImageUrl, aTitle, aText, aTextClickable,