diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-07-16 18:51:59 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-07-16 18:51:59 -0400 |
commit | 9002a78d14854692a7ca36cbe9e8a9a92ea31636 (patch) | |
tree | a61e195ec4ea373f650b9f6692bede831c7b84df | |
parent | 328b992969057cb643ac6e68ad76f7a98b064ba2 (diff) | |
download | pentadactyl-9002a78d14854692a7ca36cbe9e8a9a92ea31636.tar.gz |
s/\bset\b/Set/g
29 files changed, 144 insertions, 129 deletions
diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index 77634b05..e079cc05 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -131,7 +131,7 @@ var AbbrevHive = Class("AbbrevHive", Contexts.Hive, { */ get: function (mode, lhs) { let abbrevs = this._store[mode]; - return abbrevs && set.has(abbrevs, lhs) ? abbrevs[lhs] : null; + return abbrevs && Set.has(abbrevs, lhs) ? abbrevs[lhs] : null; }, /** diff --git a/common/content/bookmarks.js b/common/content/bookmarks.js index 65691e1f..1ce6ee11 100644 --- a/common/content/bookmarks.js +++ b/common/content/bookmarks.js @@ -219,7 +219,7 @@ var Bookmarks = Module("bookmarks", { if (!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]; else aliases[alias] = 0; @@ -247,7 +247,7 @@ var Bookmarks = Module("bookmarks", { getSuggestions: function getSuggestions(engineName, query, callback) { 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)) var queryURI = engine.getSubmission(query, responseType).uri.spec; if (!queryURI) @@ -296,7 +296,7 @@ var Bookmarks = Module("bookmarks", { 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.searchForm && !param) return engine.searchForm; diff --git a/common/content/buffer.js b/common/content/buffer.js index 68867029..f4f618a1 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1552,7 +1552,7 @@ var Buffer = Module("buffer", { tabs.getGroups(); tabs[visible ? "visibleTabs" : "allTabs"].forEach(function (tab, i) { 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(), []]; group = tabGroups[group.id]; @@ -1779,7 +1779,7 @@ var Buffer = Module("buffer", { if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement])) 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; let computedStyle = util.computedStyle(elem); diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 11e5532d..d3314b47 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -236,7 +236,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { let tags = services["dactyl:"].HELP_TAGS; for (let obj in values(results)) { 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; yield res; @@ -574,7 +574,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * @param {string} feature The feature name. * @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. @@ -875,7 +875,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { 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(" ")); function fix(node) { switch(node.nodeType) { @@ -890,7 +890,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { for (let { name, value } in array.iterValues(node.attributes)) { if (name == "dactyl:highlight") { - set.add(styles, value); + Set.add(styles, value); name = "class"; value = "hl-" + value; } @@ -945,7 +945,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { 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 .replace(/^\[.*?=(.*?)\]/, ".hl-$1") .replace(/html\|/g, "") + "\t" + "{" + h.cssText + "}") diff --git a/common/content/editor.js b/common/content/editor.js index 555c99b0..852b464a 100644 --- a/common/content/editor.js +++ b/common/content/editor.js @@ -867,7 +867,7 @@ var Editor = Module("editor", { args.push(obj["file"]); 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) { this.format({}, value); return Object.keys(util.compileMacro(value).seen).every(function (k) ["column", "file", "line"].indexOf(k) >= 0); diff --git a/common/content/events.js b/common/content/events.js index 2da11d9d..59e88472 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -340,7 +340,7 @@ var EventHive = Class("EventHive", Contexts.Hive, { [, , 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; for (let [event, callback] in Iterator(events)) { @@ -438,7 +438,7 @@ var Events = Module("events", { subtract: ["Minus", "Subtract"] }; - this._pseudoKeys = set(["count", "leader", "nop", "pass"]); + this._pseudoKeys = Set(["count", "leader", "nop", "pass"]); this._key_key = {}; this._code_key = {}; @@ -880,14 +880,14 @@ var Events = Module("events", { } else { let [match, modifier, keyname] = evt_str.match(/^<((?:[*12CASM]-)*)(.+?)>$/i) || [false, '', '']; - modifier = set(modifier.toUpperCase()); + modifier = Set(modifier.toUpperCase()); keyname = keyname.toLowerCase(); evt_obj.dactylKeyname = keyname; if (/^u[0-9a-f]+$/.test(keyname)) keyname = String.fromCharCode(parseInt(keyname.substr(1), 16)); 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.ctrlKey ="C" in modifier; evt_obj.altKey ="A" in modifier; @@ -902,7 +902,7 @@ var Events = Module("events", { evt_obj.charCode = keyname.charCodeAt(0); 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] + ">"; } else if (/mouse$/.test(keyname)) { // mouse events @@ -1593,7 +1593,7 @@ var Events = Module("events", { }, 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, HTMLObjectElement, HTMLSelectElement, HTMLTextAreaElement, @@ -1738,12 +1738,12 @@ var Events = Module("events", { "sitemap", "", { flush: function flush() { 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, "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), diff --git a/common/content/hints.js b/common/content/hints.js index f262075f..7a8f09cc 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -812,7 +812,7 @@ var Hints = Module("hints", { 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]; else { for (let [, option] in Iterator(options["hintinputs"])) { diff --git a/common/content/mappings.js b/common/content/mappings.js index 107b5ec2..cae1ccc1 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -331,7 +331,7 @@ var Mappings = Module("mappings", { let seen = {}; for (let hive in this.hives.iterValues()) for (let map in array(hive.getStack(mode)).iterValues()) - if (!set.add(seen, map.name)) + if (!Set.add(seen, map.name)) yield map; }, @@ -592,7 +592,7 @@ var Mappings = Module("mappings", { let seen = {}; for (let stack in values(hive.stacks)) for (let map in array.iterValues(stack)) - if (!set.add(seen, map.id)) + if (!Set.add(seen, map.id)) yield map; } @@ -704,7 +704,7 @@ var Mappings = Module("mappings", { for (let hive in mappings.hives.iterValues()) for (let map in array.iterValues(hive.getStack(mode))) for (let name in values(map.names)) - if (!set.add(seen, name)) { + if (!Set.add(seen, name)) { yield { name: name, columns: [ @@ -750,7 +750,7 @@ var Mappings = Module("mappings", { tags = services["dactyl:"].HELP_TAGS) ({ helpTag: prefix + map.name, __proto__: map } 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", index: mode.char + "-map", getMode: function (args) mode, diff --git a/common/content/modes.js b/common/content/modes.js index 0e16b009..3f1b997b 100644 --- a/common/content/modes.js +++ b/common/content/modes.js @@ -506,7 +506,7 @@ var Modes = Module("modes", { allBases: Class.memoize(function () { let seen = {}, res = [], queue = this.bases.slice(); for (let mode in array.iterValues(queue)) - if (!set.add(seen, mode)) { + if (!Set.add(seen, mode)) { res.push(mode); 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) || { 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) { @@ -631,7 +631,7 @@ var Modes = Module("modes", { 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)]) }; diff --git a/common/content/tabs.js b/common/content/tabs.js index 65147f8e..9ac9e3c5 100644 --- a/common/content/tabs.js +++ b/common/content/tabs.js @@ -1075,7 +1075,7 @@ var Tabs = Module("tabs", { values: activateGroups, has: Option.has.toggleAll, setter: function (newValues) { - let valueSet = set(newValues); + let valueSet = Set(newValues); for (let group in values(activateGroups)) if (group[2]) prefs.safeSet("browser.tabs." + group[2], diff --git a/common/modules/addons.jsm b/common/modules/addons.jsm index 1cd67317..6f43950c 100644 --- a/common/modules/addons.jsm +++ b/common/modules/addons.jsm @@ -118,8 +118,8 @@ var actions = { }); }, get filter() { - let ids = set(keys(JSON.parse(prefs.get("extensions.bootstrappedAddons", "{}")))); - return function ({ item }) !item.userDisabled && set.has(ids, item.id); + let ids = Set(keys(JSON.parse(prefs.get("extensions.bootstrappedAddons", "{}")))); + return function ({ item }) !item.userDisabled && Set.has(ids, item.id); }, perm: "disable" }, @@ -166,7 +166,7 @@ var Addon = Class("Addon", { }, commandAllowed: function commandAllowed(cmd) { - util.assert(set.has(actions, cmd), _("addon.unknownCommand")); + util.assert(Set.has(actions, cmd), _("addon.unknownCommand")); let action = actions[cmd]; if ("perm" in action && !(this.permissions & AddonManager["PERM_CAN_" + action.perm.toUpperCase()])) diff --git a/common/modules/base.jsm b/common/modules/base.jsm index c4c60167..0d03a214 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -218,7 +218,7 @@ defineModule("base", { // sed -n 's/^(const|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt exports: [ "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", "deprecated", "endModule", "forEach", "isArray", "isGenerator", "isinstance", "isObject", "isString", "isSubclass", "iter", "iterAll", "iterOwnProperties", "keys", "memoize", "octal", @@ -273,7 +273,7 @@ function properties(obj, prototypes, debugger_) { try { if ("dactylPropertyNames" in obj && !prototypes) 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; } catch (e) {} @@ -288,7 +288,7 @@ function properties(obj, prototypes, debugger_) { iter = (prop.name.stringValue for (prop in values(debuggerProperties(obj)))); for (let key in iter) - if (!prototypes || !set.add(seen, key) && obj != orig) + if (!prototypes || !Set.add(seen, key) && obj != orig) yield key; } } @@ -322,14 +322,14 @@ function deprecated(alternative, fn) { } deprecated.warn = function warn(func, name, alternative, frame) { if (!func.seenCaller) - func.seenCaller = set([ + func.seenCaller = Set([ "resource://dactyl" + JSMLoader.suffix + "/javascript.jsm", "resource://dactyl" + JSMLoader.suffix + "/util.jsm" ]); frame = frame || Components.stack.caller.caller; 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(":") + require("messages")._("warn.deprecated", name, alternative)); } @@ -373,7 +373,7 @@ var iterAll = deprecated("iter", function iterAll() iter.apply(null, arguments)) * @param {[string]} ary @optional * @returns {object} */ -function set(ary) { +function Set(ary) { let obj = {}; if (ary) for (let val in values(ary)) @@ -388,7 +388,7 @@ function set(ary) { * @param {string} key The key to add. * @returns boolean */ -set.add = curry(function set_add(set, key) { +Set.add = curry(function set_add(set, key) { let res = this.has(set, key); set[key] = true; return res; @@ -400,7 +400,7 @@ set.add = curry(function set_add(set, key) { * @param {string} key The key to check. * @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)); /** * 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. * @returns {object} */ -set.subtract = function set_subtract(set) { +Set.subtract = function set_subtract(set) { set = update({}, set); for (let i = 1; i < arguments.length; 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. * @returns boolean */ -set.remove = curry(function set_remove(set, key) { +Set.remove = curry(function set_remove(set, key) { let res = set.has(set, key); delete set[key]; 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 * call of the resulting function returns a new function. When @@ -671,12 +682,14 @@ function update(target) { if (typeof desc.value === "function" && target.__proto__) { let func = desc.value.wrapped || desc.value; - func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]); - func.superapply = function superapply(self, args) - let (meth = Object.getPrototypeOf(target)[k]) - meth && meth.apply(self, args); - func.supercall = function supercall(self) - func.superapply(self, Array.slice(arguments, 1)); + if (!func.superapply) { + func.__defineGetter__("super", function () Object.getPrototypeOf(target)[k]); + func.superapply = function superapply(self, args) + let (meth = Object.getPrototypeOf(target)[k]) + meth && meth.apply(self, args); + func.supercall = function supercall(self) + func.superapply(self, Array.slice(arguments, 1)); + } } try { Object.defineProperty(target, k, desc); @@ -768,19 +781,19 @@ function Class() { } if (Cu.getGlobalForObject) - Class.objectGlobal = function (caller) { + Class.objectGlobal = function (object) { try { - return Cu.getGlobalForObject(caller); + return Cu.getGlobalForObject(object); } catch (e) { return null; } }; else - Class.objectGlobal = function (caller) { - while (caller.__parent__) - caller = caller.__parent__; - return caller; + Class.objectGlobal = function (object) { + while (object.__parent__) + object = object.__parent__; + return object; }; /** @@ -936,12 +949,14 @@ Class.prototype = { if (typeof desc.value === "function") { let func = desc.value.wrapped || desc.value; - func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]); - func.superapply = function superapply(self, args) - let (meth = Object.getPrototypeOf(self)[k]) - meth && meth.apply(self, args); - func.supercall = function supercall(self) - func.superapply(self, Array.slice(arguments, 1)); + if (!func.superapply) { + func.__defineGetter__("super", function () Object.getPrototypeOf(self)[k]); + func.superapply = function superapply(self, args) + let (meth = Object.getPrototypeOf(self)[k]) + meth && meth.apply(self, args); + func.supercall = function supercall(self) + func.superapply(self, Array.slice(arguments, 1)); + } } try { if ("value" in desc && i in this.localizedProperties) @@ -1440,7 +1455,7 @@ update(iter, { uniq: function uniq(iter) { let seen = {}; for (let item in iter) - if (!set.add(seen, item)) + if (!Set.add(seen, item)) yield item; }, diff --git a/common/modules/bootstrap.jsm b/common/modules/bootstrap.jsm index 18f2de79..43810ffe 100644 --- a/common/modules/bootstrap.jsm +++ b/common/modules/bootstrap.jsm @@ -155,7 +155,7 @@ else for each (let prop in Object.getOwnPropertyNames(global)) try { if (!(prop in this.builtin) && - ["JSMLoader", "set", "EXPORTED_SYMBOLS"].indexOf(prop) < 0 && + ["JSMLoader", "Set", "set", "EXPORTED_SYMBOLS"].indexOf(prop) < 0 && !global.__lookupGetter__(prop)) global[prop] = undefined; } diff --git a/common/modules/commands.jsm b/common/modules/commands.jsm index 7760bda8..4e21e477 100644 --- a/common/modules/commands.jsm +++ b/common/modules/commands.jsm @@ -296,7 +296,7 @@ var Command = Class("Command", { 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] || "", @@ -369,7 +369,7 @@ var Command = Class("Command", { warn: function warn(context, type, message) { 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); } }, { @@ -905,7 +905,7 @@ var Commands = Module("commands", { let matchOpts = function matchOpts(arg) { // Push possible option matches into completions 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() { completeOpts = null; @@ -1574,7 +1574,7 @@ var Commands = Module("commands", { ] })), 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: { headings: ["Command", "Group", "Description"], description: function (cmd) template.linkifyHelp(cmd.description + (cmd.replacementText ? ": " + cmd.action : "")), diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 95110c2d..33568d76 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -22,9 +22,9 @@ var ConfigBase = Class("ConfigBase", { * initialization code. Must call superclass's init function. */ 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")) - set.add(this.features, "Gecko2"); + Set.add(this.features, "Gecko2"); this.timeout(function () { services["dactyl:"].pages.dtd = function () [null, util.makeDTD(config.dtd)]; @@ -142,10 +142,10 @@ var ConfigBase = Class("ConfigBase", { * @returns {string} */ bestLocale: function (list) { - let langs = set(list); + let langs = Set(list); return values([this.appLocale, this.appLocale.replace(/-.*/, ""), "en", "en-US", iter(langs).next()]) - .nth(function (l) set.has(langs, l), 0); + .nth(function (l) Set.has(langs, l), 0); }, /** diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index d4df4a8f..95939716 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -162,7 +162,7 @@ var Contexts = Module("contexts", { { _hive: { value: 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] @@ -180,10 +180,10 @@ var Contexts = Module("contexts", { 0); 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 (set.has(self, "onUnload")) + if (Set.has(self, "onUnload")) self.onUnload(); } else { @@ -294,7 +294,7 @@ var Contexts = Module("contexts", { initializedGroups: function (hive) 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) { let group = this.getGroup(name); @@ -350,7 +350,7 @@ var Contexts = Module("contexts", { getGroup: function getGroup(name, hive) { if (name === "default") 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]; if (group && hive) @@ -512,7 +512,7 @@ var Contexts = Module("contexts", { util.assert(!group.builtin || !["-description", "-locations", "-nopersist"] - .some(set.has(args.explicitOpts)), + .some(Set.has(args.explicitOpts)), _("group.cantModifyBuiltin")); }, { diff --git a/common/modules/downloads.jsm b/common/modules/downloads.jsm index 5e8bcebf..faee6e22 100644 --- a/common/modules/downloads.jsm +++ b/common/modules/downloads.jsm @@ -86,10 +86,10 @@ var Download = Class("Download", { })), 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")); - if (set.has(this.commands, name)) + if (Set.has(this.commands, name)) this.commands[name].call(this); else services.downloadManager[name + "Download"](this.id); @@ -446,7 +446,7 @@ var Downloads = Module("downloads", { }, 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)) .map(function ([k, v]) [["+" + k, [v, " (", _("sort.ascending"), ")"].join("")], @@ -458,8 +458,8 @@ var Downloads = Module("downloads", { validator: function (value) { let seen = {}; - return value.every(function (val) /^[+-]/.test(val) && set.has(this.values, val.substr(1)) - && !set.add(seen, val.substr(1)), + return value.every(function (val) /^[+-]/.test(val) && Set.has(this.values, val.substr(1)) + && !Set.add(seen, val.substr(1)), this) && value.length; } }); diff --git a/common/modules/javascript.jsm b/common/modules/javascript.jsm index d1098247..c96a35dd 100644 --- a/common/modules/javascript.jsm +++ b/common/modules/javascript.jsm @@ -71,22 +71,22 @@ var JavaScript = Module("javascript", { if (obj == null) 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 : []); if (toplevel && isObject(obj) && "wrappedJSObject" in obj) - if (!set.add(seen, "wrappedJSObject")) + if (!Set.add(seen, "wrappedJSObject")) yield "wrappedJSObject"; for (let key in iter(globals, properties(obj, !toplevel, true))) - if (!set.add(seen, key)) + if (!Set.add(seen, key)) yield key; // Properties aren't visible in an XPCNativeWrapper until // they're accessed. for (let key in properties(this.getKey(obj, "wrappedJSObject"), !toplevel, true)) try { - if (key in obj && !set.has(seen, key)) + if (key in obj && !Set.has(seen, key)) yield key; } catch (e) {} diff --git a/common/modules/messages.jsm b/common/modules/messages.jsm index 546c1a40..e5b03faf 100644 --- a/common/modules/messages.jsm +++ b/common/modules/messages.jsm @@ -45,7 +45,7 @@ var Messages = Module("messages", { let seen = {}; for (let { key } in this.iterate()) { - if (!set.add(seen, key)) + if (!Set.add(seen, key)) this._[key] = this[key] = { __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 }; */ - if (!set.has(obj, "localizedProperties")) + if (!Set.has(obj, "localizedProperties")) obj.localizedProperties = { __proto__: obj.localizedProperties }; obj.localizedProperties[prop] = true; diff --git a/common/modules/options.jsm b/common/modules/options.jsm index df90c379..a8e392ec 100644 --- a/common/modules/options.jsm +++ b/common/modules/options.jsm @@ -54,7 +54,7 @@ var Option = Class("Option", { if (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]; if (defaultValue !== undefined) { @@ -621,7 +621,7 @@ var Option = Class("Option", { function uniq(ary) { let seen = {}; - return ary.filter(function (elem) !set.add(seen, elem)); + return ary.filter(function (elem) !Set.add(seen, elem)); } switch (operator) { @@ -631,11 +631,11 @@ var Option = Class("Option", { // NOTE: Vim doesn't prepend if there's a match in the current value return uniq(Array.concat(values, this.value), true); 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 "=": if (invert) { - 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 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)); return addValues.concat(keepValues); } return values; @@ -689,12 +689,12 @@ var Option = Class("Option", { } if (isArray(acceptable)) - acceptable = set(acceptable.map(function ([k]) k)); + acceptable = Set(acceptable.map(function ([k]) k)); 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: {} @@ -1026,12 +1026,12 @@ var Options = Module("options", { let list = []; 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.some(function (opt) opt.all)) options.list(function (opt) !(list[0].onlyNonDefault && opt.isDefault), list[0].scope); 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 = []; } @@ -1200,12 +1200,12 @@ var Options = Module("options", { // Fill in the current values if we're removing 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.anchored = optcontext.anchored; 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, function (context) { context.generate = function () option.value.map(function (o) [o, ""]); @@ -1251,7 +1251,7 @@ var Options = Module("options", { util.assert(scope == "g:" || scope == null, _("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)); if (!expr) @@ -1349,7 +1349,7 @@ var Options = Module("options", { function (args) { for (let [, name] in args) { name = name.replace(/^g:/, ""); // throw away the scope prefix - if (!set.has(dactyl._globalVariables, name)) { + if (!Set.has(dactyl._globalVariables, name)) { if (!args.bang) dactyl.echoerr(_("command.let.noSuch", name)); return; diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm index 8365ce03..08c2829d 100644 --- a/common/modules/overlay.jsm +++ b/common/modules/overlay.jsm @@ -206,8 +206,8 @@ var Overlay = Module("Overlay", { const start = Date.now(); const deferredInit = { load: {} }; - const seen = set(); - const loaded = set(); + const seen = Set(); + const loaded = Set(); modules.loaded = loaded; function load(module, prereq, frame) { @@ -222,7 +222,7 @@ var Overlay = Module("Overlay", { return; if (module.className in seen) throw Error("Module dependency loop."); - set.add(seen, module.className); + Set.add(seen, module.className); for (let dep in values(module.requires)) load(Module.constructors[dep], module.className); @@ -275,9 +275,9 @@ var Overlay = Module("Overlay", { }); } 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) - set.add(names, "init"); + Set.add(names, "init"); keys(names).forEach(function (name) { deferInit(name, mod.INIT, mod); }); }); diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index f51100a9..e90d7d11 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -245,7 +245,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef if (!("value" in prop) || !callable(prop.value) && !(k in item)) 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) storage.addObserver("sanitizer", function (key, event, arg) { @@ -595,7 +595,7 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef get values() values(sanitizer.itemMap).toArray(), has: modules.Option.has.toggleAll, 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"], @@ -613,10 +613,10 @@ var Sanitizer = Module("sanitizer", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakRef sanitizer.runAtShutdown = false; else { sanitizer.runAtShutdown = true; - let have = set(value); + let have = Set(value); for (let item in values(sanitizer.itemMap)) 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; } diff --git a/common/modules/services.jsm b/common/modules/services.jsm index 1afe3fcd..fb506166 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -174,7 +174,7 @@ var Services = Module("Services", { * * @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) }, { }, { diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index d5a4df98..b8f8fcbe 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -256,7 +256,7 @@ var Styles = Module("Styles", { services["dactyl:"].providers["style"] = function styleProvider(uri) { 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 null; }; diff --git a/common/modules/template.jsm b/common/modules/template.jsm index ddc98007..28bf8ffc 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -119,7 +119,7 @@ var Template = Module("Template", { "click": function onClick(event) { event.preventDefault(); 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); else this.target.command(this.command); @@ -128,7 +128,7 @@ var Template = Module("Template", { }, get commandAllowed() { - if (set.has(this.target.allowedCommands || {}, this.command)) + if (Set.has(this.target.allowedCommands || {}, this.command)) return this.target.allowedCommands[this.command]; if ("commandAllowed" in this.target) return this.target.commandAllowed(this.command); @@ -213,7 +213,7 @@ var Template = Module("Template", { else if (/^n_/.test(topic)) 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>; XML.ignoreWhitespace = false; XML.prettyPrinting = false; @@ -233,7 +233,7 @@ var Template = Module("Template", { else if (/^n_/.test(topic)) 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}</>; XML.ignoreWhitespace = false; XML.prettyPrinting = false; diff --git a/common/modules/util.jsm b/common/modules/util.jsm index e9648160..3d646e05 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -120,7 +120,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), obj.observers = obj.observe; 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 { services.observer[meth](obj, target, true); } @@ -404,7 +404,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), } else { let [, flags, name] = /^((?:[a-z]-)*)(.*)/.exec(macro); - flags = set(flags); + flags = Set(flags); let quote = util.identity; if (flags.q) @@ -412,18 +412,18 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (flags.e) quote = function quote(obj) ""; - if (set.has(defaults, name)) + if (Set.has(defaults, name)) stack.top.elements.push(quote(defaults[name])); else { if (idx) { idx = Number(idx) - 1; 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] != "") })); } else { 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] != "") })); } @@ -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 * an editable field. */ - editableInputs: set(["date", "datetime", "datetime-local", "email", "file", + editableInputs: Set(["date", "datetime", "datetime-local", "email", "file", "month", "number", "password", "range", "search", "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)); 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) || elem.checked && /^(?:checkbox|radio)$/.test(elem.type)) 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>. 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. if (/x/.test(flags)) @@ -1962,7 +1962,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), catch (e) {} Array.forEach(frame.frames, rec); })(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) {} Array.forEach(frame.frames, rec); })(win); - return res.filter(function (h) !set.add(seen, h.spec)); + return res.filter(function (h) !Set.add(seen, h.spec)); }, /** diff --git a/melodactyl/content/config.js b/melodactyl/content/config.js index 02702037..0213a574 100644 --- a/melodactyl/content/config.js +++ b/melodactyl/content/config.js @@ -133,7 +133,7 @@ const Config = Module("config", ConfigBase, { }, /*** 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: { guioptions: "bCmprs", diff --git a/pentadactyl/content/config.js b/pentadactyl/content/config.js index 6b067005..0bba7a36 100644 --- a/pentadactyl/content/config.js +++ b/pentadactyl/content/config.js @@ -132,7 +132,7 @@ var Config = Module("config", ConfigBase, { titlestring: "Pentadactyl" }, - features: set([ + features: Set([ "bookmarks", "hints", "history", "marks", "quickmarks", "sanitizer", "session", "tabs", "tabs_undo", "windows" ]), diff --git a/teledactyl/content/config.js b/teledactyl/content/config.js index 67586e81..054ab0a4 100644 --- a/teledactyl/content/config.js +++ b/teledactyl/content/config.js @@ -137,7 +137,7 @@ const Config = Module("config", ConfigBase, { }, /*** optional options, there are checked for existence and a fallback provided ***/ - features: Class.memoize(function () set( + features: Class.memoize(function () Set( this.isComposeWindow ? ["addressbook"] : ["hints", "mail", "marks", "addressbook", "tabs"])), |