1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-06 10:44:13 +01:00

Fix some more CPG breakage.

This commit is contained in:
Kris Maglione
2012-12-16 21:09:41 -08:00
parent 2f0af0a3f1
commit 3e1911476b
12 changed files with 94 additions and 45 deletions

View File

@@ -113,7 +113,7 @@ var Services = Module("Services", {
},
reinit: function () {},
_create: function (name, args) {
_create: function _create(name, args) {
try {
var service = this.services[name];
@@ -130,7 +130,10 @@ var Services = Module("Services", {
}
return res;
}
catch (e if service.quiet !== false) {
catch (e) {
if (service.quiet === false)
throw e.stack ? e : Error(e);
if (typeof util !== "undefined")
util.reportError(e);
else
@@ -149,7 +152,7 @@ var Services = Module("Services", {
* @param {string} meth The name of the function used to instantiate
* the service.
*/
add: function (name, class_, ifaces, meth) {
add: function add(name, class_, ifaces, meth) {
const self = this;
this.services[name] = { method: meth, class: class_, interfaces: Array.concat(ifaces || []) };
if (name in this && ifaces && !this.__lookupGetter__(name) && !(this[name] instanceof Ci.nsISupports))
@@ -167,14 +170,14 @@ var Services = Module("Services", {
* @param {string} init Name of a property or method used to initialize the
* class.
*/
addClass: function (name, class_, ifaces, init, quiet) {
addClass: function addClass(name, class_, ifaces, init, quiet) {
const self = this;
this.services[name] = { class: class_, interfaces: Array.concat(ifaces || []), method: "createInstance", init: init, quiet: quiet };
if (init)
memoize(this.services[name], "callable",
function () callable(XPCOMShim(this.interfaces)[this.init]));
this[name] = function () self._create(name, arguments);
this[name] = function Create() self._create(name, arguments);
update.apply(null, [this[name]].concat([Ci[i] for each (i in Array.concat(ifaces))]));
return this[name];
},
@@ -198,7 +201,7 @@ var Services = Module("Services", {
*
* @param {string} name The service's cache key.
*/
has: function (name) Set.has(this.services, name) && this.services[name].class in Cc &&
has: function has(name) Set.has(this.services, name) && this.services[name].class in Cc &&
this.services[name].interfaces.every(function (iface) iface in Ci)
});