diff --git a/common/locale/en-US/options.xml b/common/locale/en-US/options.xml index 189e283c..73217611 100644 --- a/common/locale/en-US/options.xml +++ b/common/locale/en-US/options.xml @@ -77,6 +77,13 @@ the form of <e-name>, its value is never shown but may be used to test whether the given parameter is empty.

+

+ Array elements, such as in the the <args> parameter + of :command macros, may be accessed by appending + [n], where n is the one-based array + index, to the macro name. The first argument of a command is + therefore accessed with <args[1]<. +

Any substring enclosed by <{ and }> is automatically elided if any of the contained macros aren't currently diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 8b451b24..ded0ab18 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -716,18 +716,28 @@ function Class() { if (callable(args[0])) superclass = args.shift(); - var Constructor = eval(String.replace(, - "constructor", (name || superclass.className).replace(/\W/g, "_")) - .replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1] - .replace(/\b(self|res|Constructor)\b/g, "$1_"))); + }; + else + var Constructor = eval(String.replace(, + "constructor", (name || superclass.className).replace(/\W/g, "_")) + .replace("PARAMS", /^function .*?\((.*?)\)/.exec(args[0] && args[0].init || Class.prototype.init)[1] + .replace(/\b(self|res|Constructor)\b/g, "$1_"))); Constructor.className = name || superclass.className || superclass.name; diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 6d6868e8..f5ce09d0 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -356,14 +356,14 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), ([^]*?) // 1 (?: (<\{) | // 2 - (< ((?:[a-z]-)?[a-z-]+?) >) | // 3 4 - (\}>) // 5 + (< ((?:[a-z]-)?[a-z-]+?) (?:\[([0-9]+)\])? >) | // 3 4 5 + (\}>) // 6 ) ]]>, "gixy"); macro = String(macro); let end = 0; for (let match in re.iterate(macro)) { - let [, prefix, open, full, macro, close] = match; + let [, prefix, open, full, macro, idx, close] = match; end += match[0].length; if (prefix) @@ -390,9 +390,17 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (set.has(defaults, name)) stack.top.elements.push(quote(defaults[name])); else { - stack.top.elements.push(update( - 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] != "") })); + 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), + { 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), + { test: function (obj) obj[name] != null && obj[name] !== false && (!flags.e || obj[name] != "") })); + } for (let elem in array.iterValues(stack)) elem.seen[name] = true; @@ -1252,7 +1260,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), delete desc.writable; desc.get = function get() value; desc.set = function set(val) { - if (String(val).indexOf(sentinel) < 0) + if (!callable(val) || Function.prototype.toString(val).indexOf(sentinel) < 0) Class.replaceProperty(this, k, val); else { let package_ = util.newURI(util.fixURI(Components.stack.caller.filename)).host; diff --git a/pentadactyl/install.rdf b/pentadactyl/install.rdf index 341c0e6d..71433f61 100644 --- a/pentadactyl/install.rdf +++ b/pentadactyl/install.rdf @@ -32,7 +32,7 @@ + em:maxVersion="7.*"/>