1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-02 16:45: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 = {};
for (let bookmark of this)
if (bookmark.keyword)
res[bookmark.keyword] = res;
res[bookmark.keyword] = bookmark;
return res;
}),

View File

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

View File

@@ -153,7 +153,8 @@ ProtocolBase.prototype = {
function LocaleChannel(pkg, locale, path, orig) {
for (let locale of [locale, "en-US"])
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)
return channel;
}
@@ -163,6 +164,7 @@ function LocaleChannel(pkg, locale, path, orig) {
function StringChannel(data, contentType, uri) {
let channel = services.StreamChannel(uri);
channel.contentStream = services.CharsetConv("UTF-8").convertToInputStream(data);
if (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`
^ ([^]*?)
(?:
(<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^"]*)" | ((?:[^[>\s]|\s[^[])*))
(<!DOCTYPE \s+ \S+ \s+) (?:SYSTEM \s+ "([^\"]*)" | ((?:[^[>\s]|\s[^[])*))
(\s+ \[)?
([^]*)
)?

View File

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