1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-30 23:15:45 +01:00

Replace util.isOS with a platform queryable util.OS object.

--HG--
extra : rebase_source : 2a00dd4e3a023c9de11818bb95d86d9901341c6a
This commit is contained in:
Doug Kearns
2010-11-08 05:34:57 +11:00
parent 7787f0a2ce
commit a8b16ec635
6 changed files with 29 additions and 25 deletions

View File

@@ -528,16 +528,20 @@ const Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference])
*/
isDomainURL: function isDomainURL(url, domain) util.isSubdomain(util.getHost(url), domain),
/**
* Returns true if *os* matches Dactyl's notion of the current operating
* system platform. This is one of "WINNT", "Darwin" or "Unix".
*
* @param {string} os The OS platform to test.
* @returns {boolean}
*/
isOS: function isOS(os) {
let OS = services.get("runtime").OS;
return (OS == "WINNT" || OS == "Darwin") ? os == OS : os == "Unix";
/** Dactyl's notion of the current operating system platform. */
OS: {
_arch: services.get("runtime").OS,
/**
* @property {string} The normalised name of the OS. This is one of
* "Windows", "Mac OS X" or "Unix".
*/
get name() this.isWindows ? "Windows" : this.isMacOSX ? "Mac OS X" : "Unix",
/** @property {boolean} True if the OS is Windows. */
get isWindows() this._arch == "WINNT",
/** @property {boolean} True if the OS is Mac OS X. */
get isMacOSX() this._arch == "Darwin",
/** @property {boolean} True if the OS is some other *nix variant. */
get isUnix() !this.isWindows && !this.isMacOSX
},
/**