1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-24 10:05:47 +01:00
This commit is contained in:
Kris Maglione
2015-12-20 19:10:52 -08:00
parent 916ea412a5
commit 174f4ec636
4 changed files with 15 additions and 13 deletions

View File

@@ -97,7 +97,7 @@ var BookmarkCache = Module("BookmarkCache", XPCOM(Ci.nsINavBookmarkObserver), {
let res = {}; let res = {};
for (let bookmark of this) for (let bookmark of this)
if (bookmark.keyword) if (bookmark.keyword)
res[bookmark.keyword] = res; res[bookmark.keyword] = bookmark;
return res; return res;
}), }),

View File

@@ -95,7 +95,7 @@ var Help = Module("Help", {
update(services["dactyl:"].providers, { update(services["dactyl:"].providers, {
"help": Loop((uri, path) => help.files[path]), "help": Loop((uri, path) => help.files[path]),
"help-overlay": Loop((uri, path) => help.overlays[path]), "help-overlay": Loop((uri, path) => help.overlays[path]),
"help-tag": Loop(function (uri, path) { "help-tag": Loop((uri, path) => {
let tag = decodeURIComponent(path); let tag = decodeURIComponent(path);
if (tag in help.files) if (tag in help.files)
return RedirectChannel("dactyl://help/" + tag, uri); return RedirectChannel("dactyl://help/" + tag, uri);

View File

@@ -153,7 +153,8 @@ ProtocolBase.prototype = {
function LocaleChannel(pkg, locale, path, orig) { function LocaleChannel(pkg, locale, path, orig) {
for (let locale of [locale, "en-US"]) for (let locale of [locale, "en-US"])
for (let sep of "-/") { for (let sep of "-/") {
var channel = Channel(["resource:/", pkg + sep + locale, path].join("/"), orig, true, true); var channel = Channel(["resource:/", pkg + sep + locale, path].join("/"),
orig, true, true);
if (channel) if (channel)
return channel; return channel;
} }
@@ -163,6 +164,7 @@ function LocaleChannel(pkg, locale, path, orig) {
function StringChannel(data, contentType, uri) { function StringChannel(data, contentType, uri) {
let channel = services.StreamChannel(uri); let channel = services.StreamChannel(uri);
channel.contentStream = services.CharsetConv("UTF-8").convertToInputStream(data); channel.contentStream = services.CharsetConv("UTF-8").convertToInputStream(data);
if (contentType) if (contentType)
channel.contentType = contentType; channel.contentType = contentType;
@@ -201,7 +203,7 @@ function XMLChannel(uri, contentType, noErrorChannel, unprivileged) {
let [, pre, doctype, url, extra, open, post] = util.regexp(String.raw` let [, pre, doctype, url, extra, open, post] = util.regexp(String.raw`
^ ([^]*?) ^ ([^]*?)
(?: (?:
(<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^"]*)" | ((?:[^[>\s]|\s[^[])*)) (<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^\"]*)" | ((?:[^[>\s]|\s[^[])*))
(\s+ \[)? (\s+ \[)?
([^]*) ([^]*)
)? )?

View File

@@ -22,7 +22,7 @@ function getSites() {
const ns = services.noscript; const ns = services.noscript;
const global = options["script"]; const global = options["script"];
const groups = { allowed: ns.jsPolicySites, temp: ns.tempSites, untrusted: ns.untrustedSites }; const groups = { allowed: ns.jsPolicySites, temp: ns.tempSites, untrusted: ns.untrustedSites };
const show = RealSet(options["noscript-list"]); const show = new RealSet(options["noscript-list"]);
const sites = window.noscriptOverlay.getSites(); const sites = window.noscriptOverlay.getSites();
const blockUntrusted = global && ns.alwaysBlockUntrustedContent; const blockUntrusted = global && ns.alwaysBlockUntrustedContent;
@@ -76,7 +76,7 @@ function getSites() {
res = res.concat(ary); res = res.concat(ary);
} }
let seen = RealSet(); let seen = new RealSet();
return res.filter(function (h) { return res.filter(function (h) {
let res = !seen.has(h); let res = !seen.has(h);
seen.add(h); seen.add(h);
@@ -100,7 +100,7 @@ function getObjects() {
if (sites.some(s => s == host)) if (sites.some(s => s == host))
specific.push(filter); specific.push(filter);
} }
let seen = RealSet(); let seen = new RealSet();
return specific.concat(general).filter(function (site) { return specific.concat(general).filter(function (site) {
let res = !seen.has(site); let res = !seen.has(site);
seen.add(site); seen.add(site);
@@ -292,25 +292,25 @@ 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 RealSet(k for (k in services.noscript.jsPolicySites.sitesMap)) return new RealSet(k for (k in services.noscript.jsPolicySites.sitesMap))
.difference(RealSet(k for (k in services.noscript.tempSites.sitesMap))) .difference(new RealSet(k for (k in services.noscript.tempSites.sitesMap)))
} }
}, { }, {
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 RealSet(k for (k in services.noscript.tempSites.sitesMap)) }, get set() { return new RealSet(k for (k in services.noscript.tempSites.sitesMap)) },
}, { }, {
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 RealSet(k for (k in services.noscript.untrustedSites.sitesMap)) }, get set() { return new RealSet(k for (k in services.noscript.untrustedSites.sitesMap)) },
}, { }, {
names: ["noscript-objects", "nso"], names: ["noscript-objects", "nso"],
description: "The list of allowed objects", description: "The list of allowed objects",
get set() { return RealSet(array.flatten( get set() { return new RealSet(array.flatten(
[Array.concat(v).map(function (v) { return v + "@" + this; }, k) [Array.concat(v).map(function (v) { return v + "@" + this; }, k)
for ([k, v] of iter(services.noscript.objectWhitelist))])) }, for ([k, v] of iter(services.noscript.objectWhitelist))])) },
action: function (add, patterns) { action: function (add, patterns) {
@@ -354,7 +354,7 @@ group.options.add(["script"],
initialValue: true, initialValue: true,
getter: params.getter || (() => Array.from(params.set)), getter: params.getter || (() => Array.from(params.set)),
setter: function (values) { setter: function (values) {
let newset = RealSet(values); let newset = new RealSet(values);
let current = params.set; let current = params.set;
let value = this.value; let value = this.value;
params.action(true, values.filter(site => !current.has(site))) params.action(true, values.filter(site => !current.has(site)))