From 0de4c844ef20bc2249a7d974be7ce0d8e6912762 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Wed, 12 Jan 2011 22:58:45 -0500 Subject: [PATCH] Fix arg maps. --- common/Makefile | 2 +- common/content/events.js | 2 +- common/modules/base.jsm | 8 ++++++++ common/modules/util.jsm | 4 ++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/common/Makefile b/common/Makefile index cdbb2c62..5a2a0c10 100644 --- a/common/Makefile +++ b/common/Makefile @@ -133,7 +133,7 @@ install: fi; \ \ ext="$$profile/extensions/$(UUID)"; \ - mkdir -p "$$(dirname "$$ext")"; \ + mkdir -p "$$(dirname "$$ext")"; \ rm -rf "$$ext.xpi" "$$ext"; \ echo "Installing to $$ext"; \ if which cygpath >/dev/null 2>&1; \ diff --git a/common/content/events.js b/common/content/events.js index f14d950a..6fe35884 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -1122,7 +1122,7 @@ var Events = Module("events", { [map] = this.pendingMap || []; this.pendingMap = null; if (map && map.arg) - this.pendingArgMap = map; + this.pendingArgMap = [map, command]; } // counts must be at the start of a complete mapping (10j -> go 10 lines down) diff --git a/common/modules/base.jsm b/common/modules/base.jsm index f65e3f5d..7ef74464 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -488,6 +488,14 @@ function call(fn) { * value of the property. */ function memoize(obj, key, getter) { + if (arguments.length == 1) { + for (let prop in Object.getOwnPropertyNames(obj)) { + let get = objproto.__lookupGetter__.call(obj, prop); + if (get) + memoize(obj, prop, get); + } + return obj; + } obj.__defineGetter__(key, function g_replaceProperty() ( Class.replaceProperty(this.instance || this, key, null), Class.replaceProperty(this.instance || this, key, getter.call(this, key)))); diff --git a/common/modules/util.jsm b/common/modules/util.jsm index be9ab867..9a14d6e5 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -761,7 +761,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), isDomainURL: function isDomainURL(url, domain) util.isSubdomain(util.getHost(url), domain), /** Dactyl's notion of the current operating system platform. */ - OS: { + OS: memoize({ _arch: services.runtime.OS, /** * @property {string} The normalised name of the OS. This is one of @@ -776,7 +776,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), get isUnix() !this.isWindows && !this.isMacOSX, /** @property {RegExp} A RegExp which matches illegal characters in path components. */ get illegalCharacters() this.isWindows ? /[<>:"/\\|?*\x00-\x1f]/ : /\// - }, + }), /** * Returns true if *host* is a subdomain of *domain*.