1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-03 19:05:47 +01:00

Fix Firefox freakout. Closes issue #463.

This commit is contained in:
Kris Maglione
2011-05-31 17:34:47 -04:00
parent 1632e5d594
commit 7d019560be
4 changed files with 38 additions and 25 deletions

View File

@@ -1451,11 +1451,15 @@ var Events = Module("events", {
if (elem == null && urlbar && urlbar.inputField == this._lastFocus)
util.threadYield(true); // Why? --Kris
while (modes.main.ownsFocus && !modes.topOfStack.params.holdFocus)
while (modes.main.ownsFocus && modes.topOfStack.params.ownsFocus != elem
&& !modes.topOfStack.params.holdFocus)
modes.pop(null, { fromFocus: true });
}
finally {
this._lastFocus = elem;
if (modes.main.ownsFocus)
modes.topOfStack.params.ownsFocus = elem;
}
},

View File

@@ -411,15 +411,15 @@ var Modes = Module("modes", {
prev = stack && stack.pop || this.topOfStack;
if (push)
this._modeStack.push(push);
if (stack && stack.pop)
for (let { obj, prop, value, test } in values(this.topOfStack.saved))
if (!test || !test(stack, prev))
dactyl.trapErrors(function () { obj[prop] = value });
this.show();
});
if (stack && stack.pop)
for (let { obj, prop, value, test } in values(this.topOfStack.saved))
if (!test || !test(stack, prev))
dactyl.trapErrors(function () { obj[prop] = value });
this.show();
if (this.topOfStack.params.enter && prev)
dactyl.trapErrors("enter", this.topOfStack.params,
push ? { push: push } : stack || {},

View File

@@ -500,27 +500,14 @@ else
addon = this.wrapAddon(addon);
return callback(addon);
},
wrapAddon: function wrapAddon(addon) {
addon = Object.create(addon.QueryInterface(Ci.nsIUpdateItem));
function getRdfProperty(item, property) {
let resource = services.rdf.GetResource("urn:mozilla:item:" + item.id);
let value = "";
if (resource) {
let target = services.extensionManager.datasource.GetTarget(resource,
services.rdf.GetResource("http://www.mozilla.org/2004/em-rdf#" + property), true);
if (target && target instanceof Ci.nsIRDFLiteral)
value = target.Value;
}
return value;
}
["aboutURL", "creator", "description", "developers",
"homepageURL", "installDate", "optionsURL",
"releaseNotesURI", "updateDate"].forEach(function (item) {
memoize(addon, item, function (item) getRdfProperty(this, item));
memoize(addon, item, function (item) this.getProperty(item));
});
update(addon, {
@@ -529,19 +516,33 @@ else
appDisabled: false,
getProperty: function getProperty(property) {
let resource = services.rdf.GetResource("urn:mozilla:item:" + this.id);
if (resource) {
let target = services.extensionManager.datasource.GetTarget(resource,
services.rdf.GetResource("http://www.mozilla.org/2004/em-rdf#" + property), true);
if (target && target instanceof Ci.nsIRDFLiteral)
return target.Value;
}
return "";
},
installLocation: Class.memoize(function () services.extensionManager.getInstallLocation(this.id)),
getResourceURI: function getResourceURI(path) {
let file = this.installLocation.getItemFile(this.id, path);
return services.io.newFileURI(file);
},
isActive: getRdfProperty(addon, "isDisabled") != "true",
get isActive() this.getProperty("isDisabled") != "true",
uninstall: function uninstall() {
services.extensionManager.uninstallItem(this.id);
},
get userDisabled() getRdfProperty(addon, "userDisabled") === "true",
get userDisabled() this.getProperty("userDisabled") === "true",
set userDisabled(val) {
services.extensionManager[val ? "disableItem" : "enableItem"](this.id);
}
@@ -549,6 +550,7 @@ else
return addon;
},
getAddonsByTypes: function (types, callback) {
let res = [];
for (let [, type] in Iterator(types))
@@ -560,6 +562,7 @@ else
util.timeout(function () { callback(res); });
return res;
},
getInstallForFile: function (file, callback, mimetype) {
callback({
addListener: function () {},
@@ -568,9 +571,11 @@ else
}
});
},
getInstallForURL: function (url, callback, mimetype) {
util.assert(false, _("error.unavailable", config.host, services.runtime.version));
},
observers: [],
addAddonListener: function (listener) {
observer.listener = listener;

View File

@@ -372,6 +372,7 @@ var Contexts = Module("contexts", {
let rhs = args.literalArg;
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_);
switch (type) {
case "-builtin":
let noremap = true;
@@ -385,6 +386,7 @@ var Contexts = Module("contexts", {
}
action.macro = util.compileMacro(rhs, true);
break;
case "-ex":
action = function action() modules.commands
.execute(action.macro, makeParams(this, arguments),
@@ -392,6 +394,7 @@ var Contexts = Module("contexts", {
action.macro = util.compileMacro(rhs, true);
action.context = this.context && update({}, this.context);
break;
case "-javascript":
if (callable(params))
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
@@ -402,6 +405,7 @@ var Contexts = Module("contexts", {
action.makeParams = makeParams;
break;
}
action.toString = function toString() (type === default_ ? "" : type + " ") + rhs;
args = null;
return action;