mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-15 13:03:31 +01:00
Minor refactoring of last commit.
This commit is contained in:
@@ -669,13 +669,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
|||||||
let body = XML();
|
let body = XML();
|
||||||
for (let [, context] in Iterator(plugins.contexts))
|
for (let [, context] in Iterator(plugins.contexts))
|
||||||
try {
|
try {
|
||||||
let info;
|
let info = contexts.getDocs(context);
|
||||||
if (isinstance(context, ["Sandbox"]))
|
if (info instanceof XML) {
|
||||||
info = "INFO" in context && XML(dactyl.userEval("this.INFO instanceof XML && this.INFO.toXMLString()", context));
|
|
||||||
else if (context && context.INFO instanceof XML)
|
|
||||||
info = context.INFO;
|
|
||||||
|
|
||||||
if (info) {
|
|
||||||
if (info.*.@lang.length()) {
|
if (info.*.@lang.length()) {
|
||||||
let lang = config.bestLocale(String(a) for each (a in info.*.@lang));
|
let lang = config.bestLocale(String(a) for each (a in info.*.@lang));
|
||||||
|
|
||||||
|
|||||||
@@ -216,11 +216,12 @@ var Contexts = Module("contexts", {
|
|||||||
contexts.removeGroup(this.GROUP);
|
contexts.removeGroup(this.GROUP);
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
if (group !== this.user)
|
if (group !== this.user)
|
||||||
Class.replaceProperty(plugins, file.path, self);
|
Class.replaceProperty(plugins, file.path, self);
|
||||||
|
|
||||||
// This belongs elsewhere
|
// This belongs elsewhere
|
||||||
if (isPlugin && args)
|
if (isPlugin)
|
||||||
Object.defineProperty(plugins, self.NAME, {
|
Object.defineProperty(plugins, self.NAME, {
|
||||||
configurable: true,
|
configurable: true,
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
@@ -357,6 +358,19 @@ var Contexts = Module("contexts", {
|
|||||||
return group;
|
return group;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDocs: function getDocs(context) {
|
||||||
|
try {
|
||||||
|
if (isinstance(context, ["Sandbox"])) {
|
||||||
|
let info = "INFO" in context && Cu.evalInSandbox("this.INFO instanceof XML && INFO.toXMLString()", context);
|
||||||
|
return info && XML(info);
|
||||||
|
}
|
||||||
|
if (typeof context.INFO == "xml")
|
||||||
|
return context.INFO;
|
||||||
|
}
|
||||||
|
catch (e) {}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
bindMacro: function (args, default_, params) {
|
bindMacro: function (args, default_, params) {
|
||||||
const { dactyl, events, modules } = this.modules;
|
const { dactyl, events, modules } = this.modules;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user