summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-07-17 12:18:37 +0200
committerGitHub <noreply@github.com>2018-07-17 12:18:37 +0200
commitcdb690f0a35598cec49f1ebd9e6e3a0b8c220275 (patch)
tree9729598c78ef8d2b512d200f834f541e1e241196
parent8eb01c2ce4960a6a908bb2efdd48f141bf548c92 (diff)
parent70f5da857c70ffbd8282b9863b91204cd5c3c5ca (diff)
downloadUXP-cdb690f0a35598cec49f1ebd9e6e3a0b8c220275.tar
UXP-cdb690f0a35598cec49f1ebd9e6e3a0b8c220275.tar.gz
UXP-cdb690f0a35598cec49f1ebd9e6e3a0b8c220275.tar.lz
UXP-cdb690f0a35598cec49f1ebd9e6e3a0b8c220275.tar.xz
UXP-cdb690f0a35598cec49f1ebd9e6e3a0b8c220275.zip
Merge pull request #643 from janekptacijarabaci/pm_permissions_plugins_clickToPlay_vulnerable_1
Fix permissions plugins click to play UI
-rw-r--r--application/palemoon/base/content/pageinfo/permissions.js27
-rw-r--r--application/palemoon/components/permissions/aboutPermissions.js38
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", "");