summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKris Maglione <maglione.k@gmail.com>2011-02-09 14:58:35 -0500
committerKris Maglione <maglione.k@gmail.com>2011-02-09 14:58:35 -0500
commit1299fddfd30f5eb89fe7cf49a3e174310d0fca82 (patch)
tree4b9b54ca313ca39494950f29fe564140e2201829
parent36c382cdf4026049a35baa7cc19ee61911583192 (diff)
downloadpentadactyl-1299fddfd30f5eb89fe7cf49a3e174310d0fca82.tar.gz
Fix some minor bugs.
--HG-- branch : groups
-rw-r--r--common/content/contexts.js23
-rw-r--r--common/modules/util.jsm12
2 files changed, 23 insertions, 12 deletions
diff --git a/common/content/contexts.js b/common/content/contexts.js
index b1494f3f..714b45c4 100644
--- a/common/content/contexts.js
+++ b/common/content/contexts.js
@@ -17,6 +17,10 @@ var Group = Class("Group", {
cleanup: function cleanup() {
for (let hive in values(this.hives))
dactyl.trapErrors("cleanup", hive);
+
+ this.hives = [];
+ for (let hive in keys(Group.hiveMap))
+ delete this[hive];
},
destroy: function destroy() {
for (let hive in values(this.hives))
@@ -29,8 +33,6 @@ var Group = Class("Group", {
get builtin() contexts.builtinGroups.indexOf(this) >= 0,
- hives: {}
-
}, {
compileFilter: function (patterns) {
@@ -165,17 +167,22 @@ var Contexts = Module("contexts", {
if (group)
name = group.name;
- if (replace)
- this.removeGroup(name);
-
- if (!group || replace) {
- dactyl.assert(name !== "default", "Illegal group name");
-
+ if (!group) {
group = Group(name, description, filter, persist);
this.groupList.unshift(group);
this.groupMap[name] = group;
this.hiveProto.__defineGetter__(name, function () group[this._hive]);
}
+
+ if (replace) {
+ dactyl.trapErrors("cleanup", group);
+ if (description)
+ group.description = description;
+ if (filter)
+ group.filter = filter
+ group.persist = persist;
+ }
+
delete this.groups;
return group;
},
diff --git a/common/modules/util.jsm b/common/modules/util.jsm
index 5cd21681..b2d62ad4 100644
--- a/common/modules/util.jsm
+++ b/common/modules/util.jsm
@@ -770,14 +770,18 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
try {
let xmlhttp = services.Xmlhttp();
xmlhttp.mozBackgroundRequest = true;
- if (params.callback) {
- xmlhttp.onload = function handler(event) { util.trapErrors(params.callback, params, xmlhttp, event) };
- xmlhttp.onerror = xmlhttp.onload;
+
+ let async = params.callback || params.onload || params.onerror;
+ if (async) {
+ xmlhttp.onload = function handler(event) { util.trapErrors(params.onload || params.callback, params, xmlhttp, event) };
+ xmlhttp.onerror = function handler(event) { util.trapErrors(params.onerror || params.callback, params, xmlhttp, event) };
}
if (params.mimeType)
xmlhttp.overrideMimeType(params.mimeType);
- xmlhttp.open(params.method || "GET", url, !!params.callback, params.user, params.pass);
+ xmlhttp.open(params.method || "GET", url, async,
+ params.user, params.pass);
+
xmlhttp.send(null);
return xmlhttp;
}