Bug 1576455 - Initialize the flash plugin row in Page Info. r=frg

This commit is contained in:
Ian Neal 2019-10-01 16:39:56 +02:00
Родитель 44dd6126df
Коммит 4070417ea8
3 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -77,6 +77,13 @@ function initRow(aPartId)
var {state} = SitePermissions.get(gPermURI, aPartId);
let defaultState = SitePermissions.getDefault(aPartId);
// When flash permission state is "Hide", we show it as "Always Ask"
// in page info.
if (aPartId.startsWith("plugin") && state == SitePermissions.PROMPT_HIDE) {
defaultState == SitePermissions.UNKNOWN ? state = defaultState :
state = SitePermissions.PROMPT;
}
if (state != defaultState) {
checkbox.checked = false;
command.removeAttribute("disabled");

Просмотреть файл

@ -6,7 +6,8 @@
# state.current.allowedForSession,
# state.current.allowedTemporarily,
# state.current.blockedTemporarily,
# state.current.blocked):
# state.current.blocked,
# state.current.hide):
# This label is used to display active permission states in the site
# identity popup (which does not have a lot of screen space).
state.current.allowed = Allowed
@ -15,6 +16,7 @@ state.current.allowedTemporarily = Allowed Temporarily
state.current.blockedTemporarily = Blocked Temporarily
state.current.blocked = Blocked
state.current.prompt = Always Ask
state.current.hide = Hide Prompt
# LOCALIZATION NOTE (state.multichoice.alwaysAsk,
# state.multichoice.allow,
@ -40,3 +42,4 @@ permission.geo.label = Access Your Location
permission.indexedDB.label = Maintain Offline Storage
permission.focus-tab-by-prompt.label = Switch to this Tab
permission.persistent-storage.label = Store Data in Persistent Storage
permission.flash-plugin.label = Run Adobe Flash

Просмотреть файл

@ -138,11 +138,14 @@ var TemporaryBlockedPermissions = {
*/
var SitePermissions = {
// Permission states.
// PROMPT_HIDE state is only used to show the "Hide Prompt" state in the
// identity panel for the "plugin:flash" permission and not in pageinfo.
UNKNOWN: Services.perms.UNKNOWN_ACTION,
ALLOW: Services.perms.ALLOW_ACTION,
BLOCK: Services.perms.DENY_ACTION,
PROMPT: Services.perms.PROMPT_ACTION,
ALLOW_COOKIES_FOR_SESSION: Ci.nsICookiePermission.ACCESS_SESSION,
PROMPT_HIDE: Ci.nsIObjectLoadingContent.PLUGIN_PERMISSION_PROMPT_ACTION_QUIET,
// Permission scopes.
SCOPE_REQUEST: "{SitePermissions.SCOPE_REQUEST}",
@ -543,13 +546,21 @@ var SitePermissions = {
*
* @param {SitePermissions state} state
* The state to get the label for.
* @param {string} id
* The permission to get the state label for.
* @param {SitePermissions scope} scope (optional)
* The scope to get the label for.
*
* @return {String|null} the localized label or null if an
* unknown state was passed.
*/
getCurrentStateLabel(state, scope = null) {
getCurrentStateLabel(state, id, scope = null) {
// We try to avoid a collision between SitePermissions.PROMPT_HIDE and
// SitePermissions.ALLOW_COOKIES_FOR_SESSION which share the same const
// value.
if (id.startsWith("plugin") && state == SitePermissions.PROMPT_HIDE) {
return gStringBundle.GetStringFromName("state.current.hide");
}
switch (state) {
case this.PROMPT:
return gStringBundle.GetStringFromName("state.current.prompt");
@ -590,6 +601,9 @@ var gPermissionObject = {
* - states
* Array of permission states to be exposed to the user.
* 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.
*
* - getMultichoiceStateLabel
* Allows for custom logic for getting its default value
@ -670,8 +684,14 @@ var gPermissionObject = {
exactHostMatch: true,
states: [ SitePermissions.UNKNOWN, SitePermissions.ALLOW ],
},
"persistent-storage": {
exactHostMatch: true
},
"plugin:flash": {
labelID: "flash-plugin",
states: [ SitePermissions.UNKNOWN, SitePermissions.ALLOW, SitePermissions.BLOCK ],
}
};