diff options
Diffstat (limited to 'application/palemoon')
-rw-r--r-- | application/palemoon/base/content/pageinfo/permissions.js | 27 | ||||
-rw-r--r-- | application/palemoon/components/permissions/aboutPermissions.js | 38 |
2 files changed, 40 insertions, 25 deletions
diff --git a/application/palemoon/base/content/pageinfo/permissions.js b/application/palemoon/base/content/pageinfo/permissions.js index 5d25a800d..4f8382f66 100644 --- a/application/palemoon/base/content/pageinfo/permissions.js +++ b/application/palemoon/base/content/pageinfo/permissions.js @@ -217,14 +217,20 @@ function fillInPluginPermissionTemplate(aPermissionString, aPluginObject) { .cloneNode(true); permPluginTemplate.setAttribute("permString", aPermissionString); permPluginTemplate.setAttribute("tooltiptext", aPluginObject.description); - let attrs = [ - [ ".permPluginTemplateLabel", "value", aPluginObject.name ], - [ ".permPluginTemplateRadioGroup", "id", aPermissionString + "RadioGroup" ], - [ ".permPluginTemplateRadioDefault", "id", aPermissionString + "#0" ], - [ ".permPluginTemplateRadioAsk", "id", aPermissionString + "#3" ], - [ ".permPluginTemplateRadioAllow", "id", aPermissionString + "#1" ], - [ ".permPluginTemplateRadioBlock", "id", aPermissionString + "#2" ] - ]; + let attrs = []; + attrs.push([".permPluginTemplateLabel", "value", aPluginObject.name]); + attrs.push([".permPluginTemplateRadioGroup", "id", aPermissionString + "RadioGroup"]); + attrs.push([".permPluginTemplateRadioDefault", "id", aPermissionString + "#0"]); + let permPluginTemplateRadioAsk = ".permPluginTemplateRadioAsk"; + if (Services.prefs.getBoolPref("plugins.click_to_play") || + aPluginObject.vulnerable) { + attrs.push([permPluginTemplateRadioAsk, "id", aPermissionString + "#3"]); + } else { + permPluginTemplate.querySelector(permPluginTemplateRadioAsk) + .setAttribute("disabled", "true"); + } + attrs.push([".permPluginTemplateRadioAllow", "id", aPermissionString + "#1"]); + attrs.push([".permPluginTemplateRadioBlock", "id", aPermissionString + "#2"]); for (let attr of attrs) { permPluginTemplate.querySelector(attr[0]).setAttribute(attr[1], attr[2]); @@ -264,13 +270,16 @@ function initPluginsRow() { } let permString = pluginHost.getPermissionStringForType(mimeType); if (!permissionMap.has(permString)) { - var name = makeNicePluginName(plugin.name) + " " + plugin.version; + let name = makeNicePluginName(plugin.name) + " " + plugin.version; + let vulnerable = false; if (permString.startsWith("plugin-vulnerable:")) { name += " \u2014 " + vulnerableLabel; + vulnerable = true; } permissionMap.set(permString, { "name": name, "description": plugin.description, + "vulnerable": vulnerable }); } } diff --git a/application/palemoon/components/permissions/aboutPermissions.js b/application/palemoon/components/permissions/aboutPermissions.js index 750dbaac3..6a02daa29 100644 --- a/application/palemoon/components/permissions/aboutPermissions.js +++ b/application/palemoon/components/permissions/aboutPermissions.js @@ -572,13 +572,7 @@ var AboutPermissions = { permissionEntry.setAttribute("id", permString + "-entry"); // If the plugin is disabled, it makes no sense to change its // click-to-play status, so don't add it. - // If the click-to-play pref is not set and the plugin is not - // click-to-play blocklisted, again click-to-play doesn't apply, - // so don't add it. - if (plugin.disabled || - (!Services.prefs.getBoolPref("plugins.click_to_play") && - (pluginHost.getStateForType(mimeType) - != Ci.nsIPluginTag.STATE_CLICKTOPLAY))) { + if (plugin.disabled) { permissionEntry.hidden = true; } else { permissionEntry.hidden = false; @@ -588,10 +582,13 @@ var AboutPermissions = { this._noGlobalDeny.push(permString); Object.defineProperty(PermissionDefaults, permString, { get: function() { - return this.isClickToPlay() - ? PermissionDefaults.UNKNOWN - : PermissionDefaults.ALLOW; - }.bind(permissionEntry), + if ((Services.prefs.getBoolPref("plugins.click_to_play") && + plugin.clicktoplay) || + permString.startsWith("plugin-vulnerable:")) { + return PermissionDefaults.UNKNOWN; + } + return PermissionDefaults.ALLOW; + }, set: function(aValue) { this.clicktoplay = (aValue == PermissionDefaults.UNKNOWN); }.bind(plugin), @@ -1051,21 +1048,24 @@ var AboutPermissions = { // which is reserved for site-specific preferences only. document.getElementById(aType + "-9").hidden = true; } else if (aType.startsWith("plugin")) { - if (!Services.prefs.getBoolPref("plugins.click_to_play")) { - // It is reserved for site-specific preferences only. - document.getElementById(aType + "-0").disabled = true; - } pluginPermissionEntry = document.getElementById(aType + "-entry"); pluginPermissionEntry.setAttribute("vulnerable", ""); + let vulnerable = false; if (pluginPermissionEntry.isBlocklisted()) { permissionMenulist.disabled = true; permissionMenulist.setAttribute("tooltiptext", AboutPermissions._stringBundleAboutPermissions .GetStringFromName("pluginBlocklisted")); + vulnerable = true; } else { permissionMenulist.disabled = false; permissionMenulist.setAttribute("tooltiptext", ""); } + if (Services.prefs.getBoolPref("plugins.click_to_play") || vulnerable) { + document.getElementById(aType + "-0").disabled = false; + } else { + document.getElementById(aType + "-0").disabled = true; + } } } else { let _visibility = "visible"; @@ -1079,14 +1079,20 @@ var AboutPermissions = { } else if (aType == "cookie") { document.getElementById(aType + "-9").hidden = false; } else if (aType.startsWith("plugin")) { - document.getElementById(aType + "-0").disabled = false; pluginPermissionEntry = document.getElementById(aType + "-entry"); let permString = pluginPermissionEntry.getAttribute("permString"); + let vulnerable = false; if (permString.startsWith("plugin-vulnerable:")) { let nameVulnerable = " \u2014 " + AboutPermissions._stringBundleBrowser .GetStringFromName("pluginActivateVulnerable.label"); pluginPermissionEntry.setAttribute("vulnerable", nameVulnerable); + vulnerable = true; + } + if (Services.prefs.getBoolPref("plugins.click_to_play") || vulnerable) { + document.getElementById(aType + "-0").disabled = false; + } else { + document.getElementById(aType + "-0").disabled = true; } permissionMenulist.disabled = false; permissionMenulist.setAttribute("tooltiptext", ""); |