mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-07 09:45:45 +01:00
Fixed Array comprehensions in noscript.js
The array comprehension syntax changed in FF 46. Where before you would do, `[X for (Y in Z)]` now you do `[for (Y of Z) Y]`. I've also changed the destructuring assignment on line 314, as they aren't supported, and stop the variables from being bound. See [here] for more information on that. Now we bind to a single variable, and pull out the first and second items as needed. [here] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Array_comprehensions#SpiderMonkey-specific_implementation_notes
This commit is contained in:
@@ -243,7 +243,7 @@ prefs.complete = group => context => {
|
|||||||
context.keys = { text: "text", description: "description" };
|
context.keys = { text: "text", description: "description" };
|
||||||
context.completions = values(prefs[group]);
|
context.completions = values(prefs[group]);
|
||||||
};
|
};
|
||||||
prefs.get = function (group) { return [p.text for (p of values(this[group])) if (getPref(p.pref))]; };
|
prefs.get = function (group) { return [for (p of values(this[group])) if (getPref(p.pref)) p.text]; };
|
||||||
prefs.set = function (group, val) {
|
prefs.set = function (group, val) {
|
||||||
for (let p of values(this[group]))
|
for (let p of values(this[group]))
|
||||||
setPref(p.pref, val.indexOf(p.text) >= 0);
|
setPref(p.pref, val.indexOf(p.text) >= 0);
|
||||||
@@ -292,27 +292,27 @@ group.options.add(["script"],
|
|||||||
has: (val) => hasOwnProperty(services.noscript.jsPolicySites.sitesMap, val) &&
|
has: (val) => hasOwnProperty(services.noscript.jsPolicySites.sitesMap, val) &&
|
||||||
!hasOwnProperty(services.noscript.tempSites.sitesMap, val),
|
!hasOwnProperty(services.noscript.tempSites.sitesMap, val),
|
||||||
get set() {
|
get set() {
|
||||||
return new RealSet(k for (k in services.noscript.jsPolicySites.sitesMap))
|
return new RealSet((for (k of services.noscript.jsPolicySites.sitesMap) k))
|
||||||
.difference(new RealSet(k for (k in services.noscript.tempSites.sitesMap)))
|
.difference(new RealSet((for (k of services.noscript.tempSites.sitesMap) k)))
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
names: ["noscript-tempsites", "nst"],
|
names: ["noscript-tempsites", "nst"],
|
||||||
description: "The list of sites temporarily allowed to execute scripts",
|
description: "The list of sites temporarily allowed to execute scripts",
|
||||||
action: (add, sites) => sites.length && noscriptOverlay.safeAllow(sites, add, true, -1),
|
action: (add, sites) => sites.length && noscriptOverlay.safeAllow(sites, add, true, -1),
|
||||||
completer: (context) => completion.noscriptSites(context),
|
completer: (context) => completion.noscriptSites(context),
|
||||||
get set() { return new RealSet(k for (k in services.noscript.tempSites.sitesMap)) },
|
get set() { return new RealSet((for (k of iter(services.noscript.tempSites.sitesMap)) k)) },
|
||||||
}, {
|
}, {
|
||||||
names: ["noscript-untrusted", "nsu"],
|
names: ["noscript-untrusted", "nsu"],
|
||||||
description: "The list of untrusted sites",
|
description: "The list of untrusted sites",
|
||||||
action: (add, sites) => sites.length && services.noscript.setUntrusted(sites, add),
|
action: (add, sites) => sites.length && services.noscript.setUntrusted(sites, add),
|
||||||
completer: (context) => completion.noscriptSites(context),
|
completer: (context) => completion.noscriptSites(context),
|
||||||
get set() { return new RealSet(k for (k in services.noscript.untrustedSites.sitesMap)) },
|
get set() { return new RealSet((for (k of iter(services.noscript.untrustedSites.sitesMap)) k)) },
|
||||||
}, {
|
}, {
|
||||||
names: ["noscript-objects", "nso"],
|
names: ["noscript-objects", "nso"],
|
||||||
description: "The list of allowed objects",
|
description: "The list of allowed objects",
|
||||||
get set() { return new RealSet(array.flatten(
|
get set() { return new RealSet(array.flatten(
|
||||||
[Array.concat(v).map(function (v) { return v + "@" + this; }, k)
|
[for (wListObj of iter(services.noscript.objectWhitelist))
|
||||||
for ([k, v] of iter(services.noscript.objectWhitelist))])) },
|
Array.concat(wListObj[1]).map(function (v) { return v + "@" + this; }, wListObj[0])])) },
|
||||||
action: function (add, patterns) {
|
action: function (add, patterns) {
|
||||||
for (let pattern of values(patterns)) {
|
for (let pattern of values(patterns)) {
|
||||||
let [mime, site] = util.split(pattern, /@/, 2);
|
let [mime, site] = util.split(pattern, /@/, 2);
|
||||||
|
|||||||
Reference in New Issue
Block a user