1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-09 15:25:46 +01:00

Fix arg maps.

This commit is contained in:
Kris Maglione
2011-01-12 22:58:45 -05:00
parent 5cf58308d7
commit 0de4c844ef
4 changed files with 12 additions and 4 deletions

View File

@@ -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))));

View File

@@ -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*.