зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1520436 - part1 : add another tooltip text for non-promptable permission. r=flod,johannh
As non-promptable permission won't prompt user to ask for their approval, we should use different texts for the cancel button of promptable permissions. Differential Revision: https://phabricator.services.mozilla.com/D16770 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2494d88b1d
Коммит
b15aaa43f8
|
@ -1134,7 +1134,9 @@ var gIdentityHandler = {
|
|||
|
||||
let button = document.createXULElement("button");
|
||||
button.setAttribute("class", "identity-popup-permission-remove-button");
|
||||
let tooltiptext = gNavigatorBundle.getString("permissions.remove.tooltip");
|
||||
let tooltiptext = aPermission.isPromptable ?
|
||||
gNavigatorBundle.getString("permissions.remove.tooltip") :
|
||||
gNavigatorBundle.getString("permissions.remove.tooltip.noPrompt");
|
||||
button.setAttribute("tooltiptext", tooltiptext);
|
||||
button.addEventListener("command", () => {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
|
|
|
@ -974,6 +974,7 @@ captivePortal.infoMessage3 = You must log in to this network before you can acce
|
|||
captivePortal.showLoginPage2 = Open Network Login Page
|
||||
|
||||
permissions.remove.tooltip = Clear this permission and ask again
|
||||
permissions.remove.tooltip.noPrompt = Clear this permission
|
||||
|
||||
# LOCALIZATION NOTE (aboutDialog.architecture.*):
|
||||
# The sixtyFourBit and thirtyTwoBit strings describe the architecture of the
|
||||
|
|
|
@ -322,10 +322,11 @@ var SitePermissions = {
|
|||
* - scope: a constant representing how long the permission will
|
||||
* be kept.
|
||||
* - label: the localized label, or null if none is available.
|
||||
* - isPromptable: would permission prompt user or not
|
||||
*/
|
||||
getAllPermissionDetailsForBrowser(browser) {
|
||||
return this.getAllForBrowser(browser).map(({id, scope, state}) =>
|
||||
({id, scope, state, label: this.getPermissionLabel(id)}));
|
||||
({id, scope, state, label: this.getPermissionLabel(id), isPromptable: this.getIsPromptable(id)}));
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -620,6 +621,28 @@ var SitePermissions = {
|
|||
return gStringBundle.GetStringFromName("permission." + labelID + ".label");
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a boolean value which indicates whether this permission would
|
||||
* prompt user. If permission doesn't mention it explicitly, it would be
|
||||
* promptable.
|
||||
*
|
||||
* @param {string} permissionID
|
||||
* The permission to get the label for.
|
||||
*
|
||||
* @return {boolean} the value of `isPromptable` attribute of permission.
|
||||
*/
|
||||
getIsPromptable(permissionID) {
|
||||
if (!(permissionID in gPermissionObject)) {
|
||||
// Permission can't be found.
|
||||
return false;
|
||||
}
|
||||
if (!("isPromptable" in gPermissionObject[permissionID])) {
|
||||
// 'isPromptable' is true by default, if permission doesn't mention it.
|
||||
return true;
|
||||
}
|
||||
return gPermissionObject[permissionID].isPromptable;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the localized label for the given permission state, to be used in
|
||||
* a UI for managing permissions.
|
||||
|
@ -710,10 +733,15 @@ var gPermissionObject = {
|
|||
* Defaults to ALLOW, BLOCK and the default state (see getDefault).
|
||||
* The PROMPT_HIDE state is deliberately excluded from "plugin:flash" since we
|
||||
* don't want to expose a "Hide Prompt" button to the user through pageinfo.
|
||||
*
|
||||
* - isPromptable
|
||||
* indicates whether the permission would prompt user for the approval, it
|
||||
* would be true by default if permission doesn't explicitly mention.
|
||||
*/
|
||||
|
||||
"autoplay-media": {
|
||||
exactHostMatch: true,
|
||||
isPromptable: false,
|
||||
getDefault() {
|
||||
let state = Services.prefs.getIntPref("media.autoplay.default",
|
||||
Ci.nsIAutoplay.BLOCKED);
|
||||
|
|
Загрузка…
Ссылка в новой задаче