Bug 1250288 - Add a pref for showing favicons in web notifications. r=MattN

MozReview-Commit-ID: 9hxv7Ts8L8u
This commit is contained in:
Kit Cambridge 2016-02-22 13:16:27 -08:00
parent a0d55ff986
commit 7b87747344
2 changed files with 10 additions and 4 deletions

View File

@ -4519,6 +4519,8 @@ pref("dom.webnotifications.serviceworker.enabled", true);
// Alert animation effect, name is disableSlidingEffect for backwards-compat.
pref("alerts.disableSlidingEffect", false);
// Show favicons in web notifications.
pref("alerts.showFavicons", false);
// DOM full-screen API.
pref("full-screen-api.enabled", false);

View File

@ -5,6 +5,7 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/PermissionMessageUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "nsXULAppAPI.h"
@ -126,11 +127,14 @@ nsresult
ShowWithBackend(nsIAlertsService* aBackend, nsIAlertNotification* aAlert,
nsIObserver* aAlertListener)
{
nsresult rv = ShowWithIconBackend(aBackend, aAlert, aAlertListener);
if (NS_SUCCEEDED(rv)) {
return rv;
if (Preferences::GetBool("alerts.showFavicons")) {
nsresult rv = ShowWithIconBackend(aBackend, aAlert, aAlertListener);
if (NS_SUCCEEDED(rv)) {
return rv;
}
}
// If the backend doesn't support favicons, show the alert without one.
// If favicons are disabled, or the backend doesn't support them, show the
// alert without one.
return aBackend->ShowAlert(aAlert, aAlertListener);
}