1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 12:42:26 +01:00

Fix some minor bugs.

--HG--
branch : groups
This commit is contained in:
Kris Maglione
2011-02-09 14:58:35 -05:00
parent 36c382cdf4
commit 1299fddfd3
2 changed files with 23 additions and 12 deletions

View File

@@ -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;
},

View File

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