diff --git a/b2g/chrome/content/shell.js b/b2g/chrome/content/shell.js index b989b707fe62..db959efe3968 100644 --- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -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, diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 6e364125a47f..88f0db741368 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -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 sysAlerts(do_GetService(NS_ALERTSERVICE_CONTRACTID)); if (sysAlerts) { sysAlerts->ShowAlertNotification(aImageUrl, aTitle, aText, aTextClickable,