diff --git a/common/modules/base.jsm b/common/modules/base.jsm index bbc3e47a..20874c8f 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -489,6 +489,7 @@ function call(fn) { */ function memoize(obj, key, getter) { if (arguments.length == 1) { + obj = update({}, obj); for (let prop in Object.getOwnPropertyNames(obj)) { let get = objproto.__lookupGetter__.call(obj, prop); if (get) diff --git a/common/modules/config.jsm b/common/modules/config.jsm index 0c86d3d9..98ff6ab5 100644 --- a/common/modules/config.jsm +++ b/common/modules/config.jsm @@ -41,9 +41,11 @@ var ConfigBase = Class("ConfigBase", { this.timeout(function () { services["dactyl:"].pages.dtd = function () [null, - iter(config.dtdExtra, (["dactyl." + s, config[s]] for each (s in config.dtdStrings))) - .map(function ([k, v]) [""].join("")) - .join("\n")] + iter(config.dtdExtra, + (["dactyl." + k, v] for ([k, v] in iter(config.dtd))), + (["dactyl." + s, config[s]] for each (s in config.dtdStrings))) + .map(function ([k, v]) [""].join("")) + .join("\n")] }); }, @@ -119,17 +121,20 @@ var ConfigBase = Class("ConfigBase", { return version; }), - // TODO: DTD properties. Cleanup. - get home() "http://dactyl.sourceforge.net/", - get apphome() this.home + this.name, - code: "http://code.google.com/p/dactyl/", - get issues() this.home + "bug/" + this.name, - get plugins() "http://dactyl.sf.net/" + this.name + "/plugins", - get faq() this.home + this.name + "/faq", - "list.mailto": Class.memoize(function () config.name + "@googlegroups.com"), - "list.href": Class.memoize(function () "http://groups.google.com/group/" + config.name), - "hg.latest": Class.memoize(function () config.code + "source/browse/"), // XXX - "irc": "irc://irc.oftc.net/#pentadactyl", + dtd: memoize({ + get home() "http://dactyl.sourceforge.net/", + get apphome() this.home + this.name, + code: "http://code.google.com/p/dactyl/", + get issues() this.home + "bug/" + this.name, + get plugins() "http://dactyl.sf.net/" + this.name + "/plugins", + get faq() this.home + this.name + "/faq", + + "list.mailto": Class.memoize(function () config.name + "@googlegroups.com"), + "list.href": Class.memoize(function () "http://groups.google.com/group/" + config.name), + + "hg.latest": Class.memoize(function () this.code + "source/browse/"), // XXX + "irc": "irc://irc.oftc.net/#pentadactyl", + }), dtdExtra: { "xmlns.dactyl": "http://vimperator.org/namespaces/liberator", @@ -142,21 +147,11 @@ var ConfigBase = Class("ConfigBase", { dtdStrings: [ "appName", - "apphome", - "code", - "faq", "fileExt", - "hg.latest", - "home", "host", "hostbin", "idName", - "irc", - "issues", - "list.href", - "list.mailto", "name", - "plugins", "version" ],