Bug 1192458, Part 1 - Consolidate push and desktop notification permissions

This commit is contained in:
janekptacijarabaci 2018-04-26 09:54:20 +02:00 • committed by Roy Tam
commit 654e540f2d
13 changed files with 7 additions and 96 deletions

View file

@ -449,7 +449,6 @@
<box id="notification-popup-box" hidden="true" align="center"> <box id="notification-popup-box" hidden="true" align="center">
<image id="default-notification-icon" class="notification-anchor-icon" role="button"/> <image id="default-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="geo-notification-icon" class="notification-anchor-icon" role="button"/> <image id="geo-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="push-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="addons-notification-icon" class="notification-anchor-icon" role="button"/> <image id="addons-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="indexedDB-notification-icon" class="notification-anchor-icon" role="button"/> <image id="indexedDB-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="password-notification-icon" class="notification-anchor-icon" role="button"/> <image id="password-notification-icon" class="notification-anchor-icon" role="button"/>

View file

@ -1751,42 +1751,6 @@ ContentPermissionPrompt.prototype = {
} }
}, },
_promptPush : function(aRequest) {
var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var requestingURI = aRequest.principal.URI;
var message = browserBundle.formatStringFromName("push.enablePush",
[requestingURI.host], 1);
var actions = [
{
stringId: "push.alwaysAllow",
action: Ci.nsIPermissionManager.ALLOW_ACTION,
expireType: null,
callback: function() {}
},
{
stringId: "push.allowForSession",
action: Ci.nsIPermissionManager.ALLOW_ACTION,
expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
callback: function() {}
},
{
stringId: "push.alwaysBlock",
action: Ci.nsIPermissionManager.DENY_ACTION,
expireType: null,
callback: function() {}
}]
var options = {
learnMoreURL: Services.urlFormatter.formatURLPref("browser.push.warning.infoURL"),
};
this._showPrompt(aRequest, message, "push", actions, "push",
"push-notification-icon", options);
},
_promptGeo : function(aRequest) { _promptGeo : function(aRequest) {
var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties"); var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var requestingURI = aRequest.principal.URI; var requestingURI = aRequest.principal.URI;
@ -1866,9 +1830,13 @@ ContentPermissionPrompt.prototype = {
}, },
]; ];
var options = {
learnMoreURL: Services.urlFormatter.formatURLPref("browser.push.warning.infoURL"),
};
this._showPrompt(aRequest, message, "desktop-notification", actions, this._showPrompt(aRequest, message, "desktop-notification", actions,
"web-notifications", "web-notifications",
"web-notifications-notification-icon", null); "web-notifications-notification-icon", options);
}, },
_promptPointerLock: function CPP_promtPointerLock(aRequest, autoAllow) { _promptPointerLock: function CPP_promtPointerLock(aRequest, autoAllow) {
@ -1922,7 +1890,6 @@ ContentPermissionPrompt.prototype = {
const kFeatureKeys = { "geolocation" : "geo", const kFeatureKeys = { "geolocation" : "geo",
"desktop-notification" : "desktop-notification", "desktop-notification" : "desktop-notification",
"pointerLock" : "pointerLock", "pointerLock" : "pointerLock",
"push" : "push"
}; };
// Make sure that we support the request. // Make sure that we support the request.
@ -1966,10 +1933,6 @@ ContentPermissionPrompt.prototype = {
case "pointerLock": case "pointerLock":
this._promptPointerLock(request, autoAllow); this._promptPointerLock(request, autoAllow);
break; break;
case "push":
this._promptPush(request);
break;
}
}, },
}; };

View file

@ -449,19 +449,6 @@ var PermissionDefaults = {
let value = (aValue != this.DENY); let value = (aValue != this.DENY);
Services.prefs.setBoolPref("full-screen-api.pointer-lock.enabled", value); Services.prefs.setBoolPref("full-screen-api.pointer-lock.enabled", value);
}, },
get push() {
if (!Services.prefs.getBoolPref("dom.push.enabled")) {
return this.DENY;
}
// We always ask for permission to push with a specific site,
// so there is no global ALLOW.
return this.UNKNOWN;
},
set push(aValue) {
let value = (aValue != this.DENY);
Services.prefs.setBoolPref("dom.push.enabled", value);
},
} }
/** /**
@ -509,13 +496,13 @@ var AboutPermissions = {
*/ */
_supportedPermissions: ["password", "image", "popup", "cookie", _supportedPermissions: ["password", "image", "popup", "cookie",
"desktop-notification", "install", "geo", "indexedDB", "desktop-notification", "install", "geo", "indexedDB",
"fullscreen", "pointerLock", "push"], "fullscreen", "pointerLock"],
/** /**
* Permissions that don't have a global "Allow" option. * Permissions that don't have a global "Allow" option.
*/ */
_noGlobalAllow: ["desktop-notification", "geo", "indexedDB", "fullscreen", _noGlobalAllow: ["desktop-notification", "geo", "indexedDB", "fullscreen",
"pointerLock", "push"], "pointerLock"],
/** /**
* Permissions that don't have a global "Deny" option. * Permissions that don't have a global "Deny" option.

View file

@ -305,15 +305,6 @@ webNotifications.neverShow=Always Block Notifications
webNotifications.neverShow.accesskey=N webNotifications.neverShow.accesskey=N
webNotifications.showFromSite=Would you like to show notifications from %S? webNotifications.showFromSite=Would you like to show notifications from %S?
# Push Notifications
push.allowForSession=Allow for Session
push.allowForSession.accesskey=S
push.alwaysAllow=Always Allow Push Notifications
push.alwaysAllow.accesskey=A
push.alwaysBlock=Always Block Push Notifications
push.alwaysBlock.accesskey=B
push.enablePush=Would you like to allow Push Notifications for %S?
# Pointer lock UI # Pointer lock UI
pointerLock.allow2=Hide pointer pointerLock.allow2=Hide pointer

View file

@ -55,6 +55,4 @@
<!ENTITY pointerLock.label "Hide the Mouse Pointer"> <!ENTITY pointerLock.label "Hide the Mouse Pointer">
<!ENTITY push.label "Receive Push Notifications">
<!ENTITY focusSearch.key "f"> <!ENTITY focusSearch.key "f">

View file

@ -23,8 +23,6 @@ browser.jar:
* skin/classic/browser/engineManager.css * skin/classic/browser/engineManager.css
skin/classic/browser/Geolocation-16.png skin/classic/browser/Geolocation-16.png
skin/classic/browser/Geolocation-64.png skin/classic/browser/Geolocation-64.png
skin/classic/browser/Push-16.png
skin/classic/browser/Push-64.png
skin/classic/browser/Go-arrow.png skin/classic/browser/Go-arrow.png
skin/classic/browser/identity.png skin/classic/browser/identity.png
skin/classic/browser/imagedocument.png skin/classic/browser/imagedocument.png

View file

@ -98,9 +98,6 @@
.pref-icon[type="geo"] { .pref-icon[type="geo"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png); list-style-image: url(chrome://browser/skin/Geolocation-64.png);
} }
.pref-icon[type="push"] {
list-style-image: url(chrome://browser/skin/Push-64.png);
}
.pref-icon[type="indexedDB"] { .pref-icon[type="indexedDB"] {
list-style-image: url(chrome://global/skin/icons/question-64.png); list-style-image: url(chrome://global/skin/icons/question-64.png);
} }

View file

@ -1848,10 +1848,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png); list-style-image: url(chrome://browser/skin/Geolocation-64.png);
} }
.popup-notification-icon[popupid="push"] {
list-style-image: url(chrome://browser/skin/Push-64.png);
}
.popup-notification-icon[popupid="xpinstall-disabled"], .popup-notification-icon[popupid="xpinstall-disabled"],
.popup-notification-icon[popupid="addon-progress"], .popup-notification-icon[popupid="addon-progress"],
.popup-notification-icon[popupid="addon-install-cancelled"], .popup-notification-icon[popupid="addon-install-cancelled"],

View file

@ -24,8 +24,6 @@ browser.jar:
* skin/classic/browser/engineManager.css * skin/classic/browser/engineManager.css
skin/classic/browser/Geolocation-16.png skin/classic/browser/Geolocation-16.png
skin/classic/browser/Geolocation-64.png skin/classic/browser/Geolocation-64.png
skin/classic/browser/Push-16.png
skin/classic/browser/Push-64.png
skin/classic/browser/Info.png skin/classic/browser/Info.png
skin/classic/browser/identity.png skin/classic/browser/identity.png
skin/classic/browser/imagedocument.png skin/classic/browser/imagedocument.png

View file

@ -101,9 +101,6 @@
.pref-icon[type="geo"] { .pref-icon[type="geo"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png); list-style-image: url(chrome://browser/skin/Geolocation-64.png);
} }
.pref-icon[type="push"] {
list-style-image: url(chrome://browser/skin/Push-64.png);
}
.pref-icon[type="indexedDB"] { .pref-icon[type="indexedDB"] {
list-style-image: url(chrome://global/skin/icons/question-64.png); list-style-image: url(chrome://global/skin/icons/question-64.png);
} }

View file

@ -2337,10 +2337,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png); list-style-image: url(chrome://browser/skin/Geolocation-64.png);
} }
.popup-notification-icon[popupid="push"] {
list-style-image: url(chrome://browser/skin/Push-64.png);
}
.popup-notification-icon[popupid="xpinstall-disabled"], .popup-notification-icon[popupid="xpinstall-disabled"],
.popup-notification-icon[popupid="addon-progress"], .popup-notification-icon[popupid="addon-progress"],
.popup-notification-icon[popupid="addon-install-cancelled"], .popup-notification-icon[popupid="addon-install-cancelled"],
@ -2466,10 +2462,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/Geolocation-16.png); list-style-image: url(chrome://browser/skin/Geolocation-16.png);
} }
#push-notification-icon {
list-style-image: url(chrome://browser/skin/Push-16.png);
}
#addons-notification-icon { #addons-notification-icon {
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png); list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
} }

View file

@ -25,8 +25,6 @@ browser.jar:
* skin/classic/browser/engineManager.css * skin/classic/browser/engineManager.css
skin/classic/browser/Geolocation-16.png skin/classic/browser/Geolocation-16.png
skin/classic/browser/Geolocation-64.png skin/classic/browser/Geolocation-64.png
skin/classic/browser/Push-16.png
skin/classic/browser/Push-64.png
skin/classic/browser/Info.png skin/classic/browser/Info.png
skin/classic/browser/identity.png skin/classic/browser/identity.png
skin/classic/browser/imagedocument.png skin/classic/browser/imagedocument.png

View file

@ -101,9 +101,6 @@
.pref-icon[type="geo"] { .pref-icon[type="geo"] {
list-style-image: url(chrome://browser/skin/Geolocation-64.png); list-style-image: url(chrome://browser/skin/Geolocation-64.png);
} }
.pref-icon[type="push"] {
list-style-image: url(chrome://browser/skin/Push-64.png);
}
.pref-icon[type="indexedDB"] { .pref-icon[type="indexedDB"] {
list-style-image: url(chrome://global/skin/icons/question-48.png); list-style-image: url(chrome://global/skin/icons/question-48.png);
} }