mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-23 15:25:45 +01:00
Fix Firefox freakout. Closes issue #463.
This commit is contained in:
@@ -1451,11 +1451,15 @@ var Events = Module("events", {
|
|||||||
if (elem == null && urlbar && urlbar.inputField == this._lastFocus)
|
if (elem == null && urlbar && urlbar.inputField == this._lastFocus)
|
||||||
util.threadYield(true); // Why? --Kris
|
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 });
|
modes.pop(null, { fromFocus: true });
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
this._lastFocus = elem;
|
this._lastFocus = elem;
|
||||||
|
|
||||||
|
if (modes.main.ownsFocus)
|
||||||
|
modes.topOfStack.params.ownsFocus = elem;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -411,15 +411,15 @@ var Modes = Module("modes", {
|
|||||||
prev = stack && stack.pop || this.topOfStack;
|
prev = stack && stack.pop || this.topOfStack;
|
||||||
if (push)
|
if (push)
|
||||||
this._modeStack.push(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)
|
if (this.topOfStack.params.enter && prev)
|
||||||
dactyl.trapErrors("enter", this.topOfStack.params,
|
dactyl.trapErrors("enter", this.topOfStack.params,
|
||||||
push ? { push: push } : stack || {},
|
push ? { push: push } : stack || {},
|
||||||
|
|||||||
@@ -500,27 +500,14 @@ else
|
|||||||
addon = this.wrapAddon(addon);
|
addon = this.wrapAddon(addon);
|
||||||
return callback(addon);
|
return callback(addon);
|
||||||
},
|
},
|
||||||
|
|
||||||
wrapAddon: function wrapAddon(addon) {
|
wrapAddon: function wrapAddon(addon) {
|
||||||
addon = Object.create(addon.QueryInterface(Ci.nsIUpdateItem));
|
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",
|
["aboutURL", "creator", "description", "developers",
|
||||||
"homepageURL", "installDate", "optionsURL",
|
"homepageURL", "installDate", "optionsURL",
|
||||||
"releaseNotesURI", "updateDate"].forEach(function (item) {
|
"releaseNotesURI", "updateDate"].forEach(function (item) {
|
||||||
memoize(addon, item, function (item) getRdfProperty(this, item));
|
memoize(addon, item, function (item) this.getProperty(item));
|
||||||
});
|
});
|
||||||
|
|
||||||
update(addon, {
|
update(addon, {
|
||||||
@@ -529,19 +516,33 @@ else
|
|||||||
|
|
||||||
appDisabled: false,
|
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)),
|
installLocation: Class.memoize(function () services.extensionManager.getInstallLocation(this.id)),
|
||||||
getResourceURI: function getResourceURI(path) {
|
getResourceURI: function getResourceURI(path) {
|
||||||
let file = this.installLocation.getItemFile(this.id, path);
|
let file = this.installLocation.getItemFile(this.id, path);
|
||||||
return services.io.newFileURI(file);
|
return services.io.newFileURI(file);
|
||||||
},
|
},
|
||||||
|
|
||||||
isActive: getRdfProperty(addon, "isDisabled") != "true",
|
get isActive() this.getProperty("isDisabled") != "true",
|
||||||
|
|
||||||
uninstall: function uninstall() {
|
uninstall: function uninstall() {
|
||||||
services.extensionManager.uninstallItem(this.id);
|
services.extensionManager.uninstallItem(this.id);
|
||||||
},
|
},
|
||||||
|
|
||||||
get userDisabled() getRdfProperty(addon, "userDisabled") === "true",
|
get userDisabled() this.getProperty("userDisabled") === "true",
|
||||||
set userDisabled(val) {
|
set userDisabled(val) {
|
||||||
services.extensionManager[val ? "disableItem" : "enableItem"](this.id);
|
services.extensionManager[val ? "disableItem" : "enableItem"](this.id);
|
||||||
}
|
}
|
||||||
@@ -549,6 +550,7 @@ else
|
|||||||
|
|
||||||
return addon;
|
return addon;
|
||||||
},
|
},
|
||||||
|
|
||||||
getAddonsByTypes: function (types, callback) {
|
getAddonsByTypes: function (types, callback) {
|
||||||
let res = [];
|
let res = [];
|
||||||
for (let [, type] in Iterator(types))
|
for (let [, type] in Iterator(types))
|
||||||
@@ -560,6 +562,7 @@ else
|
|||||||
util.timeout(function () { callback(res); });
|
util.timeout(function () { callback(res); });
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
getInstallForFile: function (file, callback, mimetype) {
|
getInstallForFile: function (file, callback, mimetype) {
|
||||||
callback({
|
callback({
|
||||||
addListener: function () {},
|
addListener: function () {},
|
||||||
@@ -568,9 +571,11 @@ else
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
getInstallForURL: function (url, callback, mimetype) {
|
getInstallForURL: function (url, callback, mimetype) {
|
||||||
util.assert(false, _("error.unavailable", config.host, services.runtime.version));
|
util.assert(false, _("error.unavailable", config.host, services.runtime.version));
|
||||||
},
|
},
|
||||||
|
|
||||||
observers: [],
|
observers: [],
|
||||||
addAddonListener: function (listener) {
|
addAddonListener: function (listener) {
|
||||||
observer.listener = listener;
|
observer.listener = listener;
|
||||||
|
|||||||
@@ -372,6 +372,7 @@ var Contexts = Module("contexts", {
|
|||||||
|
|
||||||
let rhs = args.literalArg;
|
let rhs = args.literalArg;
|
||||||
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_);
|
let type = ["-builtin", "-ex", "-javascript", "-keys"].reduce(function (a, b) args[b] ? b : a, default_);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "-builtin":
|
case "-builtin":
|
||||||
let noremap = true;
|
let noremap = true;
|
||||||
@@ -385,6 +386,7 @@ var Contexts = Module("contexts", {
|
|||||||
}
|
}
|
||||||
action.macro = util.compileMacro(rhs, true);
|
action.macro = util.compileMacro(rhs, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "-ex":
|
case "-ex":
|
||||||
action = function action() modules.commands
|
action = function action() modules.commands
|
||||||
.execute(action.macro, makeParams(this, arguments),
|
.execute(action.macro, makeParams(this, arguments),
|
||||||
@@ -392,6 +394,7 @@ var Contexts = Module("contexts", {
|
|||||||
action.macro = util.compileMacro(rhs, true);
|
action.macro = util.compileMacro(rhs, true);
|
||||||
action.context = this.context && update({}, this.context);
|
action.context = this.context && update({}, this.context);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "-javascript":
|
case "-javascript":
|
||||||
if (callable(params))
|
if (callable(params))
|
||||||
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
|
action = dactyl.userEval("(function action() { with (action.makeParams(this, arguments)) {" + args.literalArg + "} })");
|
||||||
@@ -402,6 +405,7 @@ var Contexts = Module("contexts", {
|
|||||||
action.makeParams = makeParams;
|
action.makeParams = makeParams;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
action.toString = function toString() (type === default_ ? "" : type + " ") + rhs;
|
action.toString = function toString() (type === default_ ? "" : type + " ") + rhs;
|
||||||
args = null;
|
args = null;
|
||||||
return action;
|
return action;
|
||||||
|
|||||||
Reference in New Issue
Block a user