mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 10:33:33 +00:00
Bug 1570674 - Default to "Never Allow" for notification permission prompt denials. r=Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D43081 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
c7d4860e5d
commit
e91d880e08
@ -400,6 +400,8 @@ pref("permissions.default.shortcuts", 0);
|
||||
pref("permissions.desktop-notification.postPrompt.enabled", false);
|
||||
#endif
|
||||
|
||||
pref("permissions.desktop-notification.notNow.enabled", false);
|
||||
|
||||
pref("permissions.fullscreen.allowed", false);
|
||||
|
||||
pref("permissions.postPrompt.animate", true);
|
||||
|
@ -100,6 +100,10 @@ add_task(async function setup() {
|
||||
Services.telemetry.canRecordExtended = true;
|
||||
|
||||
Services.prefs.setBoolPref("permissions.eventTelemetry.enabled", true);
|
||||
Services.prefs.setBoolPref(
|
||||
"permissions.desktop-notification.notNow.enabled",
|
||||
true
|
||||
);
|
||||
|
||||
// Add some example permissions.
|
||||
let uri = Services.io.newURI(PERMISSIONS_PAGE);
|
||||
@ -118,6 +122,9 @@ add_task(async function setup() {
|
||||
registerCleanupFunction(() => {
|
||||
Services.perms.removeAll();
|
||||
Services.prefs.clearUserPref("permissions.eventTelemetry.enabled");
|
||||
Services.prefs.clearUserPref(
|
||||
"permissions.desktop-notification.notNow.enabled"
|
||||
);
|
||||
Services.telemetry.canRecordExtended = oldCanRecord;
|
||||
});
|
||||
|
||||
|
@ -872,6 +872,11 @@ function DesktopNotificationPermissionPrompt(request) {
|
||||
"postPromptEnabled",
|
||||
"permissions.desktop-notification.postPrompt.enabled"
|
||||
);
|
||||
XPCOMUtils.defineLazyPreferenceGetter(
|
||||
this,
|
||||
"notNowEnabled",
|
||||
"permissions.desktop-notification.notNow.enabled"
|
||||
);
|
||||
}
|
||||
|
||||
DesktopNotificationPermissionPrompt.prototype = {
|
||||
@ -921,24 +926,26 @@ DesktopNotificationPermissionPrompt.prototype = {
|
||||
action: SitePermissions.ALLOW,
|
||||
scope: SitePermissions.SCOPE_PERSISTENT,
|
||||
},
|
||||
{
|
||||
];
|
||||
if (this.notNowEnabled) {
|
||||
actions.push({
|
||||
label: gBrowserBundle.GetStringFromName("webNotifications.notNow"),
|
||||
accessKey: gBrowserBundle.GetStringFromName(
|
||||
"webNotifications.notNow.accesskey"
|
||||
),
|
||||
action: SitePermissions.BLOCK,
|
||||
},
|
||||
];
|
||||
if (!PrivateBrowsingUtils.isBrowserPrivate(this.browser)) {
|
||||
actions.push({
|
||||
label: gBrowserBundle.GetStringFromName("webNotifications.never"),
|
||||
accessKey: gBrowserBundle.GetStringFromName(
|
||||
"webNotifications.never.accesskey"
|
||||
),
|
||||
action: SitePermissions.BLOCK,
|
||||
scope: SitePermissions.SCOPE_PERSISTENT,
|
||||
});
|
||||
}
|
||||
actions.push({
|
||||
label: gBrowserBundle.GetStringFromName("webNotifications.never"),
|
||||
accessKey: gBrowserBundle.GetStringFromName(
|
||||
"webNotifications.never.accesskey"
|
||||
),
|
||||
action: SitePermissions.BLOCK,
|
||||
scope: PrivateBrowsingUtils.isBrowserPrivate(this.browser)
|
||||
? SitePermissions.SCOPE_SESSION
|
||||
: SitePermissions.SCOPE_PERSISTENT,
|
||||
});
|
||||
return actions;
|
||||
},
|
||||
|
||||
|
@ -24,8 +24,15 @@ add_task(async function test_desktop_notification_permission_prompt() {
|
||||
"dom.webnotifications.requireuserinteraction",
|
||||
false
|
||||
);
|
||||
Services.prefs.setBoolPref(
|
||||
"permissions.desktop-notification.notNow.enabled",
|
||||
true
|
||||
);
|
||||
await testPrompt(PermissionUI.DesktopNotificationPermissionPrompt);
|
||||
Services.prefs.clearUserPref("dom.webnotifications.requireuserinteraction");
|
||||
Services.prefs.clearUserPref(
|
||||
"permissions.desktop-notification.notNow.enabled"
|
||||
);
|
||||
});
|
||||
|
||||
// Tests that PersistentStoragePermissionPrompt works as expected
|
||||
|
@ -96,8 +96,15 @@ add_task(async function setup() {
|
||||
"dom.webnotifications.requireuserinteraction",
|
||||
false
|
||||
);
|
||||
Services.prefs.setBoolPref(
|
||||
"permissions.desktop-notification.notNow.enabled",
|
||||
true
|
||||
);
|
||||
SimpleTest.registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref("dom.webnotifications.requireuserinteraction");
|
||||
Services.prefs.clearUserPref(
|
||||
"permissions.desktop-notification.notNow.enabled"
|
||||
);
|
||||
PermissionTestUtils.remove(ORIGIN_URI, PERMISSION_NAME);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user