1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 23:27:59 +01:00

s/\bset\b/Set/g

This commit is contained in:
Kris Maglione
2011-07-16 18:51:59 -04:00
parent 328b992969
commit 9002a78d14
29 changed files with 144 additions and 129 deletions

View File

@@ -131,7 +131,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, {
*/ */
get: function (mode, lhs) { get: function (mode, lhs) {
let abbrevs = this._store[mode]; let abbrevs = this._store[mode];
return abbrevs && set.has(abbrevs, lhs) ? abbrevs[lhs] : null; return abbrevs && Set.has(abbrevs, lhs) ? abbrevs[lhs] : null;
}, },
/** /**

View File

@@ -219,7 +219,7 @@ var Bookmarks = Module("bookmarks", {
if (!alias) if (!alias)
alias = "search"; // for search engines which we can't find a suitable alias alias = "search"; // for search engines which we can't find a suitable alias
if (set.has(aliases, alias)) if (Set.has(aliases, alias))
alias += ++aliases[alias]; alias += ++aliases[alias];
else else
aliases[alias] = 0; aliases[alias] = 0;
@@ -247,7 +247,7 @@ var Bookmarks = Module("bookmarks", {
getSuggestions: function getSuggestions(engineName, query, callback) { getSuggestions: function getSuggestions(engineName, query, callback) {
const responseType = "application/x-suggestions+json"; const responseType = "application/x-suggestions+json";
let engine = set.has(this.searchEngines, engineName) && this.searchEngines[engineName]; let engine = Set.has(this.searchEngines, engineName) && this.searchEngines[engineName];
if (engine && engine.supportsResponseType(responseType)) if (engine && engine.supportsResponseType(responseType))
var queryURI = engine.getSubmission(query, responseType).uri.spec; var queryURI = engine.getSubmission(query, responseType).uri.spec;
if (!queryURI) if (!queryURI)
@@ -296,7 +296,7 @@ var Bookmarks = Module("bookmarks", {
param = query.substr(offset + 1); param = query.substr(offset + 1);
} }
var engine = set.has(bookmarks.searchEngines, keyword) && bookmarks.searchEngines[keyword]; var engine = Set.has(bookmarks.searchEngines, keyword) && bookmarks.searchEngines[keyword];
if (engine) { if (engine) {
if (engine.searchForm && !param) if (engine.searchForm && !param)
return engine.searchForm; return engine.searchForm;

View File

@@ -1552,7 +1552,7 @@ var Buffer = Module("buffer", {
tabs.getGroups(); tabs.getGroups();
tabs[visible ? "visibleTabs" : "allTabs"].forEach(function (tab, i) { tabs[visible ? "visibleTabs" : "allTabs"].forEach(function (tab, i) {
let group = (tab.tabItem || tab._tabViewTabItem || defItem).parent || defItem.parent; let group = (tab.tabItem || tab._tabViewTabItem || defItem).parent || defItem.parent;
if (!set.has(tabGroups, group.id)) if (!Set.has(tabGroups, group.id))
tabGroups[group.id] = [group.getTitle(), []]; tabGroups[group.id] = [group.getTitle(), []];
group = tabGroups[group.id]; group = tabGroups[group.id];
@@ -1779,7 +1779,7 @@ var Buffer = Module("buffer", {
if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement])) if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
return Editor.getEditor(elem.contentWindow); return Editor.getEditor(elem.contentWindow);
if (elem.readOnly || elem instanceof HTMLInputElement && !set.has(util.editableInputs, elem.type)) if (elem.readOnly || elem instanceof HTMLInputElement && !Set.has(util.editableInputs, elem.type))
return false; return false;
let computedStyle = util.computedStyle(elem); let computedStyle = util.computedStyle(elem);

View File

@@ -236,7 +236,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
let tags = services["dactyl:"].HELP_TAGS; let tags = services["dactyl:"].HELP_TAGS;
for (let obj in values(results)) { for (let obj in values(results)) {
let res = dactyl.generateHelp(obj, null, null, true); let res = dactyl.generateHelp(obj, null, null, true);
if (!set.has(tags, obj.helpTag)) if (!Set.has(tags, obj.helpTag))
res[1].@tag = obj.helpTag; res[1].@tag = obj.helpTag;
yield res; yield res;
@@ -574,7 +574,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
* @param {string} feature The feature name. * @param {string} feature The feature name.
* @returns {boolean} * @returns {boolean}
*/ */
has: function (feature) set.has(config.features, feature), has: function (feature) Set.has(config.features, feature),
/** /**
* Returns the URL of the specified help *topic* if it exists. * Returns the URL of the specified help *topic* if it exists.
@@ -875,7 +875,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
addURIEntry(file, "data:text/plain;charset=UTF-8," + encodeURI(data)); addURIEntry(file, "data:text/plain;charset=UTF-8," + encodeURI(data));
} }
let empty = set("area base basefont br col frame hr img input isindex link meta param" let empty = Set("area base basefont br col frame hr img input isindex link meta param"
.split(" ")); .split(" "));
function fix(node) { function fix(node) {
switch(node.nodeType) { switch(node.nodeType) {
@@ -890,7 +890,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
for (let { name, value } in array.iterValues(node.attributes)) { for (let { name, value } in array.iterValues(node.attributes)) {
if (name == "dactyl:highlight") { if (name == "dactyl:highlight") {
set.add(styles, value); Set.add(styles, value);
name = "class"; name = "class";
value = "hl-" + value; value = "hl-" + value;
} }
@@ -945,7 +945,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
addDataEntry(file + ".xhtml", data.join("")); addDataEntry(file + ".xhtml", data.join(""));
} }
let data = [h for (h in highlight) if (set.has(styles, h.class) || /^Help/.test(h.class))] let data = [h for (h in highlight) if (Set.has(styles, h.class) || /^Help/.test(h.class))]
.map(function (h) h.selector .map(function (h) h.selector
.replace(/^\[.*?=(.*?)\]/, ".hl-$1") .replace(/^\[.*?=(.*?)\]/, ".hl-$1")
.replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}") .replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}")

View File

@@ -867,7 +867,7 @@ var Editor = Module("editor", {
args.push(obj["file"]); args.push(obj["file"]);
return args; return args;
}, },
has: function (key) set.has(util.compileMacro(this.value).seen, key), has: function (key) Set.has(util.compileMacro(this.value).seen, key),
validator: function (value) { validator: function (value) {
this.format({}, value); this.format({}, value);
return Object.keys(util.compileMacro(value).seen).every(function (k) ["column", "file", "line"].indexOf(k) >= 0); return Object.keys(util.compileMacro(value).seen).every(function (k) ["column", "file", "line"].indexOf(k) >= 0);

View File

@@ -340,7 +340,7 @@ var EventHive = Class("EventHive", Contexts.Hive, {
[, , capture, allowUntrusted] = arguments; [, , capture, allowUntrusted] = arguments;
} }
if (set.has(events, "input") && !set.has(events, "dactyl-input")) if (Set.has(events, "input") && !Set.has(events, "dactyl-input"))
events["dactyl-input"] = events.input; events["dactyl-input"] = events.input;
for (let [event, callback] in Iterator(events)) { for (let [event, callback] in Iterator(events)) {
@@ -438,7 +438,7 @@ var Events = Module("events", {
subtract: ["Minus", "Subtract"] subtract: ["Minus", "Subtract"]
}; };
this._pseudoKeys = set(["count", "leader", "nop", "pass"]); this._pseudoKeys = Set(["count", "leader", "nop", "pass"]);
this._key_key = {}; this._key_key = {};
this._code_key = {}; this._code_key = {};
@@ -880,14 +880,14 @@ var Events = Module("events", {
} }
else { else {
let [match, modifier, keyname] = evt_str.match(/^<((?:[*12CASM]-)*)(.+?)>$/i) || [false, '', '']; let [match, modifier, keyname] = evt_str.match(/^<((?:[*12CASM]-)*)(.+?)>$/i) || [false, '', ''];
modifier = set(modifier.toUpperCase()); modifier = Set(modifier.toUpperCase());
keyname = keyname.toLowerCase(); keyname = keyname.toLowerCase();
evt_obj.dactylKeyname = keyname; evt_obj.dactylKeyname = keyname;
if (/^u[0-9a-f]+$/.test(keyname)) if (/^u[0-9a-f]+$/.test(keyname))
keyname = String.fromCharCode(parseInt(keyname.substr(1), 16)); keyname = String.fromCharCode(parseInt(keyname.substr(1), 16));
if (keyname && (unknownOk || keyname.length == 1 || /mouse$/.test(keyname) || if (keyname && (unknownOk || keyname.length == 1 || /mouse$/.test(keyname) ||
this._key_code[keyname] || set.has(this._pseudoKeys, keyname))) { this._key_code[keyname] || Set.has(this._pseudoKeys, keyname))) {
evt_obj.globKey ="*" in modifier; evt_obj.globKey ="*" in modifier;
evt_obj.ctrlKey ="C" in modifier; evt_obj.ctrlKey ="C" in modifier;
evt_obj.altKey ="A" in modifier; evt_obj.altKey ="A" in modifier;
@@ -902,7 +902,7 @@ var Events = Module("events", {
evt_obj.charCode = keyname.charCodeAt(0); evt_obj.charCode = keyname.charCodeAt(0);
evt_obj._keyCode = this._key_code[keyname.toLowerCase()]; evt_obj._keyCode = this._key_code[keyname.toLowerCase()];
} }
else if (set.has(this._pseudoKeys, keyname)) { else if (Set.has(this._pseudoKeys, keyname)) {
evt_obj.dactylString = "<" + this._key_key[keyname] + ">"; evt_obj.dactylString = "<" + this._key_key[keyname] + ">";
} }
else if (/mouse$/.test(keyname)) { // mouse events else if (/mouse$/.test(keyname)) { // mouse events
@@ -1593,7 +1593,7 @@ var Events = Module("events", {
}, },
isInputElement: function isInputElement(elem) { isInputElement: function isInputElement(elem) {
return elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type) || return elem instanceof HTMLInputElement && Set.has(util.editableInputs, elem.type) ||
isinstance(elem, [HTMLIsIndexElement, HTMLEmbedElement, isinstance(elem, [HTMLIsIndexElement, HTMLEmbedElement,
HTMLObjectElement, HTMLSelectElement, HTMLObjectElement, HTMLSelectElement,
HTMLTextAreaElement, HTMLTextAreaElement,
@@ -1738,12 +1738,12 @@ var Events = Module("events", {
"sitemap", "", { "sitemap", "", {
flush: function flush() { flush: function flush() {
memoize(this, "filters", function () this.value.filter(function (f) f(buffer.documentURI))); memoize(this, "filters", function () this.value.filter(function (f) f(buffer.documentURI)));
memoize(this, "pass", function () set(array.flatten(this.filters.map(function (f) f.keys)))); memoize(this, "pass", function () Set(array.flatten(this.filters.map(function (f) f.keys))));
memoize(this, "commandHive", function hive() Hive(this.filters, "command")); memoize(this, "commandHive", function hive() Hive(this.filters, "command"));
memoize(this, "inputHive", function hive() Hive(this.filters, "input")); memoize(this, "inputHive", function hive() Hive(this.filters, "input"));
}, },
has: function (key) set.has(this.pass, key) || set.has(this.commandHive.stack.mappings, key), has: function (key) Set.has(this.pass, key) || Set.has(this.commandHive.stack.mappings, key),
get pass() (this.flush(), this.pass), get pass() (this.flush(), this.pass),

View File

@@ -812,7 +812,7 @@ var Hints = Module("hints", {
let type = elem.type; let type = elem.type;
if (elem instanceof HTMLInputElement && set.has(util.editableInputs, elem.type)) if (elem instanceof HTMLInputElement && Set.has(util.editableInputs, elem.type))
return [elem.value, false]; return [elem.value, false];
else { else {
for (let [, option] in Iterator(options["hintinputs"])) { for (let [, option] in Iterator(options["hintinputs"])) {

View File

@@ -331,7 +331,7 @@ var Mappings = Module("mappings", {
let seen = {}; let seen = {};
for (let hive in this.hives.iterValues()) for (let hive in this.hives.iterValues())
for (let map in array(hive.getStack(mode)).iterValues()) for (let map in array(hive.getStack(mode)).iterValues())
if (!set.add(seen, map.name)) if (!Set.add(seen, map.name))
yield map; yield map;
}, },
@@ -592,7 +592,7 @@ var Mappings = Module("mappings", {
let seen = {}; let seen = {};
for (let stack in values(hive.stacks)) for (let stack in values(hive.stacks))
for (let map in array.iterValues(stack)) for (let map in array.iterValues(stack))
if (!set.add(seen, map.id)) if (!Set.add(seen, map.id))
yield map; yield map;
} }
@@ -704,7 +704,7 @@ var Mappings = Module("mappings", {
for (let hive in mappings.hives.iterValues()) for (let hive in mappings.hives.iterValues())
for (let map in array.iterValues(hive.getStack(mode))) for (let map in array.iterValues(hive.getStack(mode)))
for (let name in values(map.names)) for (let name in values(map.names))
if (!set.add(seen, name)) { if (!Set.add(seen, name)) {
yield { yield {
name: name, name: name,
columns: [ columns: [
@@ -750,7 +750,7 @@ var Mappings = Module("mappings", {
tags = services["dactyl:"].HELP_TAGS) tags = services["dactyl:"].HELP_TAGS)
({ helpTag: prefix + map.name, __proto__: map } ({ helpTag: prefix + map.name, __proto__: map }
for (map in self.iterate(args, true)) for (map in self.iterate(args, true))
if (map.hive === mappings.builtin || set.has(tags, prefix + map.name))), if (map.hive === mappings.builtin || Set.has(tags, prefix + map.name))),
description: "List all " + mode.name + " mode mappings along with their short descriptions", description: "List all " + mode.name + " mode mappings along with their short descriptions",
index: mode.char + "-map", index: mode.char + "-map",
getMode: function (args) mode, getMode: function (args) mode,

View File

@@ -506,7 +506,7 @@ var Modes = Module("modes", {
allBases: Class.memoize(function () { allBases: Class.memoize(function () {
let seen = {}, res = [], queue = this.bases.slice(); let seen = {}, res = [], queue = this.bases.slice();
for (let mode in array.iterValues(queue)) for (let mode in array.iterValues(queue))
if (!set.add(seen, mode)) { if (!Set.add(seen, mode)) {
res.push(mode); res.push(mode);
queue.push.apply(queue, mode.bases); queue.push.apply(queue, mode.bases);
} }
@@ -616,7 +616,7 @@ var Modes = Module("modes", {
return (array.nth(this.value, function (v) val.some(function (m) m.name === v.mode), 0) return (array.nth(this.value, function (v) val.some(function (m) m.name === v.mode), 0)
|| { result: default_ }).result; || { result: default_ }).result;
return set.has(this.valueMap, val) ? this.valueMap[val] : default_; return Set.has(this.valueMap, val) ? this.valueMap[val] : default_;
}, },
setter: function (vals) { setter: function (vals) {
@@ -631,7 +631,7 @@ var Modes = Module("modes", {
return vals; return vals;
}, },
validator: function validator(vals) vals.map(function (v) v.replace(/^!/, "")).every(set.has(this.values)), validator: function validator(vals) vals.map(function (v) v.replace(/^!/, "")).every(Set.has(this.values)),
get values() array.toObject([[m.name.toLowerCase(), m.description] for (m in values(modes._modes)) if (!m.hidden)]) get values() array.toObject([[m.name.toLowerCase(), m.description] for (m in values(modes._modes)) if (!m.hidden)])
}; };

View File

@@ -1075,7 +1075,7 @@ var Tabs = Module("tabs", {
values: activateGroups, values: activateGroups,
has: Option.has.toggleAll, has: Option.has.toggleAll,
setter: function (newValues) { setter: function (newValues) {
let valueSet = set(newValues); let valueSet = Set(newValues);
for (let group in values(activateGroups)) for (let group in values(activateGroups))
if (group[2]) if (group[2])
prefs.safeSet("browser.tabs." + group[2], prefs.safeSet("browser.tabs." + group[2],

View File

@@ -118,8 +118,8 @@ var actions = {
}); });
}, },
get filter() { get filter() {
let ids = set(keys(JSON.parse(prefs.get("extensions.bootstrappedAddons", "{}")))); let ids = Set(keys(JSON.parse(prefs.get("extensions.bootstrappedAddons", "{}"))));
return function ({ item }) !item.userDisabled && set.has(ids, item.id); return function ({ item }) !item.userDisabled && Set.has(ids, item.id);
}, },
perm: "disable" perm: "disable"
}, },
@@ -166,7 +166,7 @@ var Addon = Class("Addon", {
}, },
commandAllowed: function commandAllowed(cmd) { commandAllowed: function commandAllowed(cmd) {
util.assert(set.has(actions, cmd), _("addon.unknownCommand")); util.assert(Set.has(actions, cmd), _("addon.unknownCommand"));
let action = actions[cmd]; let action = actions[cmd];
if ("perm" in action && !(this.permissions & AddonManager["PERM_CAN_" + action.perm.toUpperCase()])) if ("perm" in action && !(this.permissions & AddonManager["PERM_CAN_" + action.perm.toUpperCase()]))

View File

@@ -218,7 +218,7 @@ defineModule("base", {
// sed -n 's/^(const|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt // sed -n 's/^(const|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt
exports: [ exports: [
"ErrorBase", "Cc", "Ci", "Class", "Cr", "Cu", "Module", "JSMLoader", "Object", "Runnable", "ErrorBase", "Cc", "Ci", "Class", "Cr", "Cu", "Module", "JSMLoader", "Object", "Runnable",
"Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMUtils", "XPCSafeJSObjectWrapper", "Set", "Struct", "StructBase", "Timer", "UTF8", "XPCOM", "XPCOMUtils", "XPCSafeJSObjectWrapper",
"array", "bind", "call", "callable", "ctypes", "curry", "debuggerProperties", "defineModule", "array", "bind", "call", "callable", "ctypes", "curry", "debuggerProperties", "defineModule",
"deprecated", "endModule", "forEach", "isArray", "isGenerator", "isinstance", "isObject", "deprecated", "endModule", "forEach", "isArray", "isGenerator", "isinstance", "isObject",
"isString", "isSubclass", "iter", "iterAll", "iterOwnProperties", "keys", "memoize", "octal", "isString", "isSubclass", "iter", "iterAll", "iterOwnProperties", "keys", "memoize", "octal",
@@ -273,7 +273,7 @@ function properties(obj, prototypes, debugger_) {
try { try {
if ("dactylPropertyNames" in obj && !prototypes) if ("dactylPropertyNames" in obj && !prototypes)
for (let key in values(obj.dactylPropertyNames)) for (let key in values(obj.dactylPropertyNames))
if (key in obj && !set.add(seen, key)) if (key in obj && !Set.add(seen, key))
yield key; yield key;
} }
catch (e) {} catch (e) {}
@@ -288,7 +288,7 @@ function properties(obj, prototypes, debugger_) {
iter = (prop.name.stringValue for (prop in values(debuggerProperties(obj)))); iter = (prop.name.stringValue for (prop in values(debuggerProperties(obj))));
for (let key in iter) for (let key in iter)
if (!prototypes || !set.add(seen, key) && obj != orig) if (!prototypes || !Set.add(seen, key) && obj != orig)
yield key; yield key;
} }
} }
@@ -322,14 +322,14 @@ function deprecated(alternative, fn) {
} }
deprecated.warn = function warn(func, name, alternative, frame) { deprecated.warn = function warn(func, name, alternative, frame) {
if (!func.seenCaller) if (!func.seenCaller)
func.seenCaller = set([ func.seenCaller = Set([
"resource://dactyl" + JSMLoader.suffix + "/javascript.jsm", "resource://dactyl" + JSMLoader.suffix + "/javascript.jsm",
"resource://dactyl" + JSMLoader.suffix + "/util.jsm" "resource://dactyl" + JSMLoader.suffix + "/util.jsm"
]); ]);
frame = frame || Components.stack.caller.caller; frame = frame || Components.stack.caller.caller;
let filename = util.fixURI(frame.filename || "unknown"); let filename = util.fixURI(frame.filename || "unknown");
if (!set.add(func.seenCaller, filename)) if (!Set.add(func.seenCaller, filename))
util.dactyl(func).warn([util.urlPath(filename), frame.lineNumber, " "].join(":") util.dactyl(func).warn([util.urlPath(filename), frame.lineNumber, " "].join(":")
+ require("messages")._("warn.deprecated", name, alternative)); + require("messages")._("warn.deprecated", name, alternative));
} }
@@ -373,7 +373,7 @@ var iterAll = deprecated("iter", function iterAll() iter.apply(null, arguments))
* @param {[string]} ary @optional * @param {[string]} ary @optional
* @returns {object} * @returns {object}
*/ */
function set(ary) { function Set(ary) {
let obj = {}; let obj = {};
if (ary) if (ary)
for (let val in values(ary)) for (let val in values(ary))
@@ -388,7 +388,7 @@ function set(ary) {
* @param {string} key The key to add. * @param {string} key The key to add.
* @returns boolean * @returns boolean
*/ */
set.add = curry(function set_add(set, key) { Set.add = curry(function set_add(set, key) {
let res = this.has(set, key); let res = this.has(set, key);
set[key] = true; set[key] = true;
return res; return res;
@@ -400,7 +400,7 @@ set.add = curry(function set_add(set, key) {
* @param {string} key The key to check. * @param {string} key The key to check.
* @returns {boolean} * @returns {boolean}
*/ */
set.has = curry(function set_has(set, key) hasOwnProperty.call(set, key) && Set.has = curry(function set_has(set, key) hasOwnProperty.call(set, key) &&
propertyIsEnumerable.call(set, key)); propertyIsEnumerable.call(set, key));
/** /**
* Returns a new set containing the members of the first argument which * Returns a new set containing the members of the first argument which
@@ -409,7 +409,7 @@ set.has = curry(function set_has(set, key) hasOwnProperty.call(set, key) &&
* @param {object} set The set. * @param {object} set The set.
* @returns {object} * @returns {object}
*/ */
set.subtract = function set_subtract(set) { Set.subtract = function set_subtract(set) {
set = update({}, set); set = update({}, set);
for (let i = 1; i < arguments.length; i++) for (let i = 1; i < arguments.length; i++)
for (let k in keys(arguments[i])) for (let k in keys(arguments[i]))
@@ -424,12 +424,23 @@ set.subtract = function set_subtract(set) {
* @param {string} key The key to remove. * @param {string} key The key to remove.
* @returns boolean * @returns boolean
*/ */
set.remove = curry(function set_remove(set, key) { Set.remove = curry(function set_remove(set, key) {
let res = set.has(set, key); let res = set.has(set, key);
delete set[key]; delete set[key];
return res; return res;
}); });
function set() {
deprecated.warn(set, "set", "Set");
return Set.apply(this, arguments);
}
Object.keys(Set).forEach(function (meth) {
set[meth] = function proxy() {
deprecated.warn(proxy, "set." + meth, "Set." + meth);
return Set[meth].apply(this, arguments);
};
});
/** /**
* Curries a function to the given number of arguments. Each * Curries a function to the given number of arguments. Each
* call of the resulting function returns a new function. When * call of the resulting function returns a new function. When
@@ -671,6 +682,7 @@ function update(target) {
if (typeof desc.value === "function" && target.__proto__) { if (typeof desc.value === "function" && target.__proto__) {
let func = desc.value.wrapped || desc.value; let func = desc.value.wrapped || desc.value;
if (!func.superapply) {
func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]); func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]);
func.superapply = function superapply(self, args) func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(target)[k]) let (meth = Object.getPrototypeOf(target)[k])
@@ -678,6 +690,7 @@ function update(target) {
func.supercall = function supercall(self) func.supercall = function supercall(self)
func.superapply(self, Array.slice(arguments, 1)); func.superapply(self, Array.slice(arguments, 1));
} }
}
try { try {
Object.defineProperty(target, k, desc); Object.defineProperty(target, k, desc);
} }
@@ -768,19 +781,19 @@ function Class() {
} }
if (Cu.getGlobalForObject) if (Cu.getGlobalForObject)
Class.objectGlobal = function (caller) { Class.objectGlobal = function (object) {
try { try {
return Cu.getGlobalForObject(caller); return Cu.getGlobalForObject(object);
} }
catch (e) { catch (e) {
return null; return null;
} }
}; };
else else
Class.objectGlobal = function (caller) { Class.objectGlobal = function (object) {
while (caller.__parent__) while (object.__parent__)
caller = caller.__parent__; object = object.__parent__;
return caller; return object;
}; };
/** /**
@@ -936,6 +949,7 @@ Class.prototype = {
if (typeof desc.value === "function") { if (typeof desc.value === "function") {
let func = desc.value.wrapped || desc.value; let func = desc.value.wrapped || desc.value;
if (!func.superapply) {
func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]); func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]);
func.superapply = function superapply(self, args) func.superapply = function superapply(self, args)
let (meth = Object.getPrototypeOf(self)[k]) let (meth = Object.getPrototypeOf(self)[k])
@@ -943,6 +957,7 @@ Class.prototype = {
func.supercall = function supercall(self) func.supercall = function supercall(self)
func.superapply(self, Array.slice(arguments, 1)); func.superapply(self, Array.slice(arguments, 1));
} }
}
try { try {
if ("value" in desc && i in this.localizedProperties) if ("value" in desc && i in this.localizedProperties)
this[k] = desc.value; this[k] = desc.value;
@@ -1440,7 +1455,7 @@ update(iter, {
uniq: function uniq(iter) { uniq: function uniq(iter) {
let seen = {}; let seen = {};
for (let item in iter) for (let item in iter)
if (!set.add(seen, item)) if (!Set.add(seen, item))
yield item; yield item;
}, },

View File

@@ -155,7 +155,7 @@ else
for each (let prop in Object.getOwnPropertyNames(global)) for each (let prop in Object.getOwnPropertyNames(global))
try { try {
if (!(prop in this.builtin) && if (!(prop in this.builtin) &&
["JSMLoader", "set", "EXPORTED_SYMBOLS"].indexOf(prop) < 0 && ["JSMLoader", "Set", "set", "EXPORTED_SYMBOLS"].indexOf(prop) < 0 &&
!global.__lookupGetter__(prop)) !global.__lookupGetter__(prop))
global[prop] = undefined; global[prop] = undefined;
} }

View File

@@ -296,7 +296,7 @@ var Command = Class("Command", {
explicitOpts: Class.memoize(function () ({})), explicitOpts: Class.memoize(function () ({})),
has: function AP_has(opt) set.has(this.explicitOpts, opt) || typeof opt === "number" && set.has(this, opt), has: function AP_has(opt) Set.has(this.explicitOpts, opt) || typeof opt === "number" && Set.has(this, opt),
get literalArg() this.command.literal != null && this[this.command.literal] || "", get literalArg() this.command.literal != null && this[this.command.literal] || "",
@@ -369,7 +369,7 @@ var Command = Class("Command", {
warn: function warn(context, type, message) { warn: function warn(context, type, message) {
let loc = !context ? "" : [context.file, context.line, " "].join(":"); let loc = !context ? "" : [context.file, context.line, " "].join(":");
if (!set.add(this.complained, type + ":" + (context ? context.file : "[Command Line]"))) if (!Set.add(this.complained, type + ":" + (context ? context.file : "[Command Line]")))
this.modules.dactyl.warn(loc + message); this.modules.dactyl.warn(loc + message);
} }
}, { }, {
@@ -905,7 +905,7 @@ var Commands = Module("commands", {
let matchOpts = function matchOpts(arg) { let matchOpts = function matchOpts(arg) {
// Push possible option matches into completions // Push possible option matches into completions
if (complete && !onlyArgumentsRemaining) if (complete && !onlyArgumentsRemaining)
completeOpts = options.filter(function (opt) opt.multiple || !set.has(args, opt.names[0])); completeOpts = options.filter(function (opt) opt.multiple || !Set.has(args, opt.names[0]));
}; };
let resetCompletions = function resetCompletions() { let resetCompletions = function resetCompletions() {
completeOpts = null; completeOpts = null;
@@ -1574,7 +1574,7 @@ var Commands = Module("commands", {
] ]
})), })),
iterateIndex: function (args) let (tags = services["dactyl:"].HELP_TAGS) iterateIndex: function (args) let (tags = services["dactyl:"].HELP_TAGS)
this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || set.has(tags, cmd.helpTag)), this.iterate(args).filter(function (cmd) cmd.hive === commands.builtin || Set.has(tags, cmd.helpTag)),
format: { format: {
headings: ["Command", "Group", "Description"], headings: ["Command", "Group", "Description"],
description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")), description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")),

View File

@@ -22,9 +22,9 @@ var ConfigBase = Class("ConfigBase", {
* initialization code. Must call superclass's init function. * initialization code. Must call superclass's init function.
*/ */
init: function init() { init: function init() {
this.features.push = deprecated("set.add", function push(feature) set.add(this, feature)); this.features.push = deprecated("Set.add", function push(feature) Set.add(this, feature));
if (util.haveGecko("2b")) if (util.haveGecko("2b"))
set.add(this.features, "Gecko2"); Set.add(this.features, "Gecko2");
this.timeout(function () { this.timeout(function () {
services["dactyl:"].pages.dtd = function () [null, util.makeDTD(config.dtd)]; services["dactyl:"].pages.dtd = function () [null, util.makeDTD(config.dtd)];
@@ -142,10 +142,10 @@ var ConfigBase = Class("ConfigBase", {
* @returns {string} * @returns {string}
*/ */
bestLocale: function (list) { bestLocale: function (list) {
let langs = set(list); let langs = Set(list);
return values([this.appLocale, this.appLocale.replace(/-.*/, ""), return values([this.appLocale, this.appLocale.replace(/-.*/, ""),
"en", "en-US", iter(langs).next()]) "en", "en-US", iter(langs).next()])
.nth(function (l) set.has(langs, l), 0); .nth(function (l) Set.has(langs, l), 0);
}, },
/** /**

View File

@@ -162,7 +162,7 @@ var Contexts = Module("contexts", {
{ _hive: { value: name } }))); { _hive: { value: name } })));
memoize(contexts.groupsProto, name, memoize(contexts.groupsProto, name,
function () [group[name] for (group in values(this.groups)) if (set.has(group, name))]); function () [group[name] for (group in values(this.groups)) if (Set.has(group, name))]);
}, },
get toStringParams() [this.name, this.Hive] get toStringParams() [this.name, this.Hive]
@@ -180,10 +180,10 @@ var Contexts = Module("contexts", {
0); 0);
let contextPath = file.path; let contextPath = file.path;
let self = set.has(plugins, contextPath) && plugins.contexts[contextPath]; let self = Set.has(plugins, contextPath) && plugins.contexts[contextPath];
if (self) { if (self) {
if (set.has(self, "onUnload")) if (Set.has(self, "onUnload"))
self.onUnload(); self.onUnload();
} }
else { else {
@@ -294,7 +294,7 @@ var Contexts = Module("contexts", {
initializedGroups: function (hive) initializedGroups: function (hive)
let (need = hive ? [hive] : Object.keys(this.hives)) let (need = hive ? [hive] : Object.keys(this.hives))
this.groupList.filter(function (group) need.some(set.has(group))), this.groupList.filter(function (group) need.some(Set.has(group))),
addGroup: function addGroup(name, description, filter, persist, replace) { addGroup: function addGroup(name, description, filter, persist, replace) {
let group = this.getGroup(name); let group = this.getGroup(name);
@@ -350,7 +350,7 @@ var Contexts = Module("contexts", {
getGroup: function getGroup(name, hive) { getGroup: function getGroup(name, hive) {
if (name === "default") if (name === "default")
var group = this.context && this.context.context && this.context.context.GROUP; var group = this.context && this.context.context && this.context.context.GROUP;
else if (set.has(this.groupMap, name)) else if (Set.has(this.groupMap, name))
group = this.groupMap[name]; group = this.groupMap[name];
if (group && hive) if (group && hive)
@@ -512,7 +512,7 @@ var Contexts = Module("contexts", {
util.assert(!group.builtin || util.assert(!group.builtin ||
!["-description", "-locations", "-nopersist"] !["-description", "-locations", "-nopersist"]
.some(set.has(args.explicitOpts)), .some(Set.has(args.explicitOpts)),
_("group.cantModifyBuiltin")); _("group.cantModifyBuiltin"));
}, },
{ {

View File

@@ -86,10 +86,10 @@ var Download = Class("Download", {
})), })),
command: function command(name) { command: function command(name) {
util.assert(set.has(this.allowedCommands, name), _("download.unknownCommand")); util.assert(Set.has(this.allowedCommands, name), _("download.unknownCommand"));
util.assert(this.allowedCommands[name], _("download.commandNotAllowed")); util.assert(this.allowedCommands[name], _("download.commandNotAllowed"));
if (set.has(this.commands, name)) if (Set.has(this.commands, name))
this.commands[name].call(this); this.commands[name].call(this);
else else
services.downloadManager[name + "Download"](this.id); services.downloadManager[name + "Download"](this.id);
@@ -446,7 +446,7 @@ var Downloads = Module("downloads", {
}, },
completer: function (context, extra) { completer: function (context, extra) {
let seen = set.has(set(extra.values.map(function (val) val.substr(1)))); let seen = Set.has(Set(extra.values.map(function (val) val.substr(1))));
context.completions = iter(this.values).filter(function ([k, v]) !seen(k)) context.completions = iter(this.values).filter(function ([k, v]) !seen(k))
.map(function ([k, v]) [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")], .map(function ([k, v]) [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")],
@@ -458,8 +458,8 @@ var Downloads = Module("downloads", {
validator: function (value) { validator: function (value) {
let seen = {}; let seen = {};
return value.every(function (val) /^[+-]/.test(val) && set.has(this.values, val.substr(1)) return value.every(function (val) /^[+-]/.test(val) && Set.has(this.values, val.substr(1))
&& !set.add(seen, val.substr(1)), && !Set.add(seen, val.substr(1)),
this) && value.length; this) && value.length;
} }
}); });

View File

@@ -71,22 +71,22 @@ var JavaScript = Module("javascript", {
if (obj == null) if (obj == null)
return; return;
let seen = isinstance(obj, ["Sandbox"]) ? set(JavaScript.magicalNames) : {}; let seen = isinstance(obj, ["Sandbox"]) ? Set(JavaScript.magicalNames) : {};
let globals = values(toplevel && this.window === obj ? this.globalNames : []); let globals = values(toplevel && this.window === obj ? this.globalNames : []);
if (toplevel && isObject(obj) && "wrappedJSObject" in obj) if (toplevel && isObject(obj) && "wrappedJSObject" in obj)
if (!set.add(seen, "wrappedJSObject")) if (!Set.add(seen, "wrappedJSObject"))
yield "wrappedJSObject"; yield "wrappedJSObject";
for (let key in iter(globals, properties(obj, !toplevel, true))) for (let key in iter(globals, properties(obj, !toplevel, true)))
if (!set.add(seen, key)) if (!Set.add(seen, key))
yield key; yield key;
// Properties aren't visible in an XPCNativeWrapper until // Properties aren't visible in an XPCNativeWrapper until
// they're accessed. // they're accessed.
for (let key in properties(this.getKey(obj, "wrappedJSObject"), !toplevel, true)) for (let key in properties(this.getKey(obj, "wrappedJSObject"), !toplevel, true))
try { try {
if (key in obj && !set.has(seen, key)) if (key in obj && !Set.has(seen, key))
yield key; yield key;
} }
catch (e) {} catch (e) {}

View File

@@ -45,7 +45,7 @@ var Messages = Module("messages", {
let seen = {}; let seen = {};
for (let { key } in this.iterate()) { for (let { key } in this.iterate()) {
if (!set.add(seen, key)) if (!Set.add(seen, key))
this._[key] = this[key] = { this._[key] = this[key] = {
__noSuchMethod__: function __(prop, args) self._.apply(self, [prop].concat(args)) __noSuchMethod__: function __(prop, args) self._.apply(self, [prop].concat(args))
}; };
@@ -95,7 +95,7 @@ var Messages = Module("messages", {
return { configurable: true, enumerable: true, value: this.default, writable: true }; return { configurable: true, enumerable: true, value: this.default, writable: true };
*/ */
if (!set.has(obj, "localizedProperties")) if (!Set.has(obj, "localizedProperties"))
obj.localizedProperties = { __proto__: obj.localizedProperties }; obj.localizedProperties = { __proto__: obj.localizedProperties };
obj.localizedProperties[prop] = true; obj.localizedProperties[prop] = true;

View File

@@ -54,7 +54,7 @@ var Option = Class("Option", {
if (extraInfo) if (extraInfo)
this.update(extraInfo); this.update(extraInfo);
if (set.has(this.modules.config.defaults, this.name)) if (Set.has(this.modules.config.defaults, this.name))
defaultValue = this.modules.config.defaults[this.name]; defaultValue = this.modules.config.defaults[this.name];
if (defaultValue !== undefined) { if (defaultValue !== undefined) {
@@ -621,7 +621,7 @@ var Option = Class("Option", {
function uniq(ary) { function uniq(ary) {
let seen = {}; let seen = {};
return ary.filter(function (elem) !set.add(seen, elem)); return ary.filter(function (elem) !Set.add(seen, elem));
} }
switch (operator) { switch (operator) {
@@ -631,11 +631,11 @@ var Option = Class("Option", {
// NOTE: Vim doesn't prepend if there's a match in the current value // NOTE: Vim doesn't prepend if there's a match in the current value
return uniq(Array.concat(values, this.value), true); return uniq(Array.concat(values, this.value), true);
case "-": case "-":
return this.value.filter(function (item) !set.has(this, item), set(values)); return this.value.filter(function (item) !Set.has(this, item), Set(values));
case "=": case "=":
if (invert) { if (invert) {
let keepValues = this.value.filter(function (item) !set.has(this, item), set(values)); let keepValues = this.value.filter(function (item) !Set.has(this, item), Set(values));
let addValues = values.filter(function (item) !set.has(this, item), set(this.value)); let addValues = values.filter(function (item) !Set.has(this, item), Set(this.value));
return addValues.concat(keepValues); return addValues.concat(keepValues);
} }
return values; return values;
@@ -689,12 +689,12 @@ var Option = Class("Option", {
} }
if (isArray(acceptable)) if (isArray(acceptable))
acceptable = set(acceptable.map(function ([k]) k)); acceptable = Set(acceptable.map(function ([k]) k));
if (this.type === "regexpmap" || this.type === "sitemap") if (this.type === "regexpmap" || this.type === "sitemap")
return Array.concat(values).every(function (re) set.has(acceptable, re.result)); return Array.concat(values).every(function (re) Set.has(acceptable, re.result));
return Array.concat(values).every(set.has(acceptable)); return Array.concat(values).every(Set.has(acceptable));
}, },
types: {} types: {}
@@ -1026,12 +1026,12 @@ var Options = Module("options", {
let list = []; let list = [];
function flushList() { function flushList() {
let names = set(list.map(function (opt) opt.option ? opt.option.name : "")); let names = Set(list.map(function (opt) opt.option ? opt.option.name : ""));
if (list.length) if (list.length)
if (list.some(function (opt) opt.all)) if (list.some(function (opt) opt.all))
options.list(function (opt) !(list[0].onlyNonDefault && opt.isDefault), list[0].scope); options.list(function (opt) !(list[0].onlyNonDefault && opt.isDefault), list[0].scope);
else else
options.list(function (opt) set.has(names, opt.name), list[0].scope); options.list(function (opt) Set.has(names, opt.name), list[0].scope);
list = []; list = [];
} }
@@ -1200,12 +1200,12 @@ var Options = Module("options", {
// Fill in the current values if we're removing // Fill in the current values if we're removing
if (opt.operator == "-" && isArray(opt.values)) { if (opt.operator == "-" && isArray(opt.values)) {
let have = set([i.text for (i in values(context.allItems.items))]); let have = Set([i.text for (i in values(context.allItems.items))]);
context = context.fork("current-values", 0); context = context.fork("current-values", 0);
context.anchored = optcontext.anchored; context.anchored = optcontext.anchored;
context.maxItems = optcontext.maxItems; context.maxItems = optcontext.maxItems;
context.filters.push(function (i) !set.has(have, i.text)); context.filters.push(function (i) !Set.has(have, i.text));
modules.completion.optionValue(context, opt.name, opt.operator, null, modules.completion.optionValue(context, opt.name, opt.operator, null,
function (context) { function (context) {
context.generate = function () option.value.map(function (o) [o, ""]); context.generate = function () option.value.map(function (o) [o, ""]);
@@ -1251,7 +1251,7 @@ var Options = Module("options", {
util.assert(scope == "g:" || scope == null, util.assert(scope == "g:" || scope == null,
_("command.let.illegalVar", scope + name)); _("command.let.illegalVar", scope + name));
util.assert(set.has(globalVariables, name) || (expr && !op), util.assert(Set.has(globalVariables, name) || (expr && !op),
_("command.let.undefinedVar", fullName)); _("command.let.undefinedVar", fullName));
if (!expr) if (!expr)
@@ -1349,7 +1349,7 @@ var Options = Module("options", {
function (args) { function (args) {
for (let [, name] in args) { for (let [, name] in args) {
name = name.replace(/^g:/, ""); // throw away the scope prefix name = name.replace(/^g:/, ""); // throw away the scope prefix
if (!set.has(dactyl._globalVariables, name)) { if (!Set.has(dactyl._globalVariables, name)) {
if (!args.bang) if (!args.bang)
dactyl.echoerr(_("command.let.noSuch", name)); dactyl.echoerr(_("command.let.noSuch", name));
return; return;

View File

@@ -206,8 +206,8 @@ var Overlay = Module("Overlay", {
const start = Date.now(); const start = Date.now();
const deferredInit = { load: {} }; const deferredInit = { load: {} };
const seen = set(); const seen = Set();
const loaded = set(); const loaded = Set();
modules.loaded = loaded; modules.loaded = loaded;
function load(module, prereq, frame) { function load(module, prereq, frame) {
@@ -222,7 +222,7 @@ var Overlay = Module("Overlay", {
return; return;
if (module.className in seen) if (module.className in seen)
throw Error("Module dependency loop."); throw Error("Module dependency loop.");
set.add(seen, module.className); Set.add(seen, module.className);
for (let dep in values(module.requires)) for (let dep in values(module.requires))
load(Module.constructors[dep], module.className); load(Module.constructors[dep], module.className);
@@ -275,9 +275,9 @@ var Overlay = Module("Overlay", {
}); });
} }
defineModule.modules.forEach(function defModule(mod) { defineModule.modules.forEach(function defModule(mod) {
let names = set(Object.keys(mod.INIT)); let names = Set(Object.keys(mod.INIT));
if ("init" in mod.INIT) if ("init" in mod.INIT)
set.add(names, "init"); Set.add(names, "init");
keys(names).forEach(function (name) { deferInit(name, mod.INIT, mod); }); keys(names).forEach(function (name) { deferInit(name, mod.INIT, mod); });
}); });

View File

@@ -245,7 +245,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
if (!("value" in prop) || !callable(prop.value) && !(k in item)) if (!("value" in prop) || !callable(prop.value) && !(k in item))
Object.defineProperty(item, k, prop); Object.defineProperty(item, k, prop);
let names = set([name].concat(params.contains || []).map(function (e) "clear-" + e)); let names = Set([name].concat(params.contains || []).map(function (e) "clear-" + e));
if (params.action) if (params.action)
storage.addObserver("sanitizer", storage.addObserver("sanitizer",
function (key, event, arg) { function (key, event, arg) {
@@ -595,7 +595,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
get values() values(sanitizer.itemMap).toArray(), get values() values(sanitizer.itemMap).toArray(),
has: modules.Option.has.toggleAll, has: modules.Option.has.toggleAll,
validator: function (values) values.length && validator: function (values) values.length &&
values.every(function (val) val === "all" || set.has(sanitizer.itemMap, val)) values.every(function (val) val === "all" || Set.has(sanitizer.itemMap, val))
}); });
options.add(["sanitizeshutdown", "ss"], options.add(["sanitizeshutdown", "ss"],
@@ -613,10 +613,10 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef
sanitizer.runAtShutdown = false; sanitizer.runAtShutdown = false;
else { else {
sanitizer.runAtShutdown = true; sanitizer.runAtShutdown = true;
let have = set(value); let have = Set(value);
for (let item in values(sanitizer.itemMap)) for (let item in values(sanitizer.itemMap))
prefs.set(item.shutdownPref, prefs.set(item.shutdownPref,
Boolean(set.has(have, item.name) ^ set.has(have, "all"))); Boolean(Set.has(have, item.name) ^ Set.has(have, "all")));
} }
return value; return value;
} }

View File

@@ -174,7 +174,7 @@ var Services = Module("Services", {
* *
* @param {string} name The service's cache key. * @param {string} name The service's cache key.
*/ */
has: function (name) set.has(this.services, name) && this.services[name].class in Cc && has: function (name) Set.has(this.services, name) && this.services[name].class in Cc &&
this.services[name].interfaces.every(function (iface) iface in Ci) this.services[name].interfaces.every(function (iface) iface in Ci)
}, { }, {
}, { }, {

View File

@@ -256,7 +256,7 @@ var Styles = Module("Styles", {
services["dactyl:"].providers["style"] = function styleProvider(uri) { services["dactyl:"].providers["style"] = function styleProvider(uri) {
let id = /^\/(\d*)/.exec(uri.path)[1]; let id = /^\/(\d*)/.exec(uri.path)[1];
if (set.has(styles.allSheets, id)) if (Set.has(styles.allSheets, id))
return ["text/css", styles.allSheets[id].fullCSS]; return ["text/css", styles.allSheets[id].fullCSS];
return null; return null;
}; };

View File

@@ -119,7 +119,7 @@ var Template = Module("Template", {
"click": function onClick(event) { "click": function onClick(event) {
event.preventDefault(); event.preventDefault();
if (this.commandAllowed) { if (this.commandAllowed) {
if (set.has(this.target.commands || {}, this.command)) if (Set.has(this.target.commands || {}, this.command))
this.target.commands[this.command].call(this.target); this.target.commands[this.command].call(this.target);
else else
this.target.command(this.command); this.target.command(this.command);
@@ -128,7 +128,7 @@ var Template = Module("Template", {
}, },
get commandAllowed() { get commandAllowed() {
if (set.has(this.target.allowedCommands || {}, this.command)) if (Set.has(this.target.allowedCommands || {}, this.command))
return this.target.allowedCommands[this.command]; return this.target.allowedCommands[this.command];
if ("commandAllowed" in this.target) if ("commandAllowed" in this.target)
return this.target.commandAllowed(this.command); return this.target.commandAllowed(this.command);
@@ -213,7 +213,7 @@ var Template = Module("Template", {
else if (/^n_/.test(topic)) else if (/^n_/.test(topic))
topic = topic.slice(2); topic = topic.slice(2);
if (services["dactyl:"].initialized && !set.has(services["dactyl:"].HELP_TAGS, topic)) if (services["dactyl:"].initialized && !Set.has(services["dactyl:"].HELP_TAGS, topic))
return <span highlight={type || ""}>{text || token}</span>; return <span highlight={type || ""}>{text || token}</span>;
XML.ignoreWhitespace = false; XML.prettyPrinting = false; XML.ignoreWhitespace = false; XML.prettyPrinting = false;
@@ -233,7 +233,7 @@ var Template = Module("Template", {
else if (/^n_/.test(topic)) else if (/^n_/.test(topic))
topic = topic.slice(2); topic = topic.slice(2);
if (services["dactyl:"].initialized && !set.has(services["dactyl:"].HELP_TAGS, topic)) if (services["dactyl:"].initialized && !Set.has(services["dactyl:"].HELP_TAGS, topic))
return <>{token}</>; return <>{token}</>;
XML.ignoreWhitespace = false; XML.prettyPrinting = false; XML.ignoreWhitespace = false; XML.prettyPrinting = false;

View File

@@ -120,7 +120,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
obj.observers = obj.observe; obj.observers = obj.observe;
function register(meth) { function register(meth) {
for (let target in set(["dactyl-cleanup-modules", "quit-application"].concat(Object.keys(obj.observers)))) for (let target in Set(["dactyl-cleanup-modules", "quit-application"].concat(Object.keys(obj.observers))))
try { try {
services.observer[meth](obj, target, true); services.observer[meth](obj, target, true);
} }
@@ -404,7 +404,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
} }
else { else {
let [, flags, name] = /^((?:[a-z]-)*)(.*)/.exec(macro); let [, flags, name] = /^((?:[a-z]-)*)(.*)/.exec(macro);
flags = set(flags); flags = Set(flags);
let quote = util.identity; let quote = util.identity;
if (flags.q) if (flags.q)
@@ -412,18 +412,18 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (flags.e) if (flags.e)
quote = function quote(obj) ""; quote = function quote(obj) "";
if (set.has(defaults, name)) if (Set.has(defaults, name))
stack.top.elements.push(quote(defaults[name])); stack.top.elements.push(quote(defaults[name]));
else { else {
if (idx) { if (idx) {
idx = Number(idx) - 1; idx = Number(idx) - 1;
stack.top.elements.push(update( stack.top.elements.push(update(
function (obj) obj[name] != null && idx in obj[name] ? quote(obj[name][idx]) : set.has(obj, name) ? "" : unknown(full), function (obj) obj[name] != null && idx in obj[name] ? quote(obj[name][idx]) : Set.has(obj, name) ? "" : unknown(full),
{ test: function (obj) obj[name] != null && idx in obj[name] && obj[name][idx] !== false && (!flags.e || obj[name][idx] != "") })); { test: function (obj) obj[name] != null && idx in obj[name] && obj[name][idx] !== false && (!flags.e || obj[name][idx] != "") }));
} }
else { else {
stack.top.elements.push(update( stack.top.elements.push(update(
function (obj) obj[name] != null ? quote(obj[name]) : set.has(obj, name) ? "" : unknown(full), function (obj) obj[name] != null ? quote(obj[name]) : Set.has(obj, name) ? "" : unknown(full),
{ test: function (obj) obj[name] != null && obj[name] !== false && (!flags.e || obj[name] != "") })); { test: function (obj) obj[name] != null && obj[name] !== false && (!flags.e || obj[name] != "") }));
} }
@@ -678,7 +678,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
* The set of input element type attribute values that mark the element as * The set of input element type attribute values that mark the element as
* an editable field. * an editable field.
*/ */
editableInputs: set(["date", "datetime", "datetime-local", "email", "file", editableInputs: Set(["date", "datetime", "datetime-local", "email", "file",
"month", "number", "password", "range", "search", "month", "number", "password", "range", "search",
"tel", "text", "time", "url", "week"]), "tel", "text", "time", "url", "week"]),
@@ -1451,7 +1451,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
elems.push(encode(field.name, field.value)); elems.push(encode(field.name, field.value));
for (let [, elem] in iter(form.elements)) { for (let [, elem] in iter(form.elements)) {
if (set.has(util.editableInputs, elem.type) if (Set.has(util.editableInputs, elem.type)
|| /^(?:hidden|textarea)$/.test(elem.type) || /^(?:hidden|textarea)$/.test(elem.type)
|| elem.checked && /^(?:checkbox|radio)$/.test(elem.type)) || elem.checked && /^(?:checkbox|radio)$/.test(elem.type))
elems.push(encode(elem.name, elem.value, elem === field)); elems.push(encode(elem.name, elem.value, elem === field));
@@ -1545,7 +1545,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
// Replace replacement <tokens>. // Replace replacement <tokens>.
if (tokens) if (tokens)
expr = String.replace(expr, /(\(?P)?<(\w+)>/g, function (m, n1, n2) !n1 && set.has(tokens, n2) ? tokens[n2].dactylSource || tokens[n2].source || tokens[n2] : m); expr = String.replace(expr, /(\(?P)?<(\w+)>/g, function (m, n1, n2) !n1 && Set.has(tokens, n2) ? tokens[n2].dactylSource || tokens[n2].source || tokens[n2] : m);
// Strip comments and white space. // Strip comments and white space.
if (/x/.test(flags)) if (/x/.test(flags))
@@ -1962,7 +1962,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
catch (e) {} catch (e) {}
Array.forEach(frame.frames, rec); Array.forEach(frame.frames, rec);
})(win); })(win);
return res.filter(function (h) !set.add(seen, h)); return res.filter(function (h) !Set.add(seen, h));
}, },
/** /**
@@ -1981,7 +1981,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
catch (e) {} catch (e) {}
Array.forEach(frame.frames, rec); Array.forEach(frame.frames, rec);
})(win); })(win);
return res.filter(function (h) !set.add(seen, h.spec)); return res.filter(function (h) !Set.add(seen, h.spec));
}, },
/** /**

View File

@@ -133,7 +133,7 @@ const Config = Module("config", ConfigBase, {
}, },
/*** optional options, there are checked for existence and a fallback provided ***/ /*** optional options, there are checked for existence and a fallback provided ***/
features: set(["bookmarks", "hints", "marks", "history", "quickmarks", "session", "tabs", "player"]), features: Set(["bookmarks", "hints", "marks", "history", "quickmarks", "session", "tabs", "player"]),
defaults: { defaults: {
guioptions: "bCmprs", guioptions: "bCmprs",

View File

@@ -132,7 +132,7 @@ var Config = Module("config", ConfigBase, {
titlestring: "Pentadactyl" titlestring: "Pentadactyl"
}, },
features: set([ features: Set([
"bookmarks", "hints", "history", "marks", "quickmarks", "sanitizer", "bookmarks", "hints", "history", "marks", "quickmarks", "sanitizer",
"session", "tabs", "tabs_undo", "windows" "session", "tabs", "tabs_undo", "windows"
]), ]),

View File

@@ -137,7 +137,7 @@ const Config = Module("config", ConfigBase, {
}, },
/*** optional options, there are checked for existence and a fallback provided ***/ /*** optional options, there are checked for existence and a fallback provided ***/
features: Class.memoize(function () set( features: Class.memoize(function () Set(
this.isComposeWindow ? ["addressbook"] this.isComposeWindow ? ["addressbook"]
: ["hints", "mail", "marks", "addressbook", "tabs"])), : ["hints", "mail", "marks", "addressbook", "tabs"])),