mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 10:08:00 +01:00
Do something sensible for items defined from :map/:com/... in :*usage!.
This commit is contained in:
@@ -453,7 +453,7 @@ const Commands = Module("commands", {
|
||||
_addCommand: function (args, replace) {
|
||||
if (!args[3])
|
||||
args[3] = {};
|
||||
args[3].definedAt = Components.stack.caller.caller;
|
||||
args[3].definedAt = commands.getCaller(Components.stack.caller.caller);
|
||||
|
||||
let names = array.flatten(Command.parseSpecs(args[0]));
|
||||
dactyl.assert(!names.some(function (name) name in this._exMap && !this._exMap[name].user, this),
|
||||
@@ -636,6 +636,22 @@ const Commands = Module("commands", {
|
||||
return this._exCommands.filter(function (cmd) cmd.user);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a frame object describing the currently executing
|
||||
* command, if applicable, otherwise returns the passed frame.
|
||||
*
|
||||
* @param {nsIStackFrame} frame
|
||||
*/
|
||||
getCaller: function (frame) {
|
||||
if (io.sourcing)
|
||||
return {
|
||||
__proto__: frame,
|
||||
filename: services.io.newFileURI(File(io.sourcing.file)).spec,
|
||||
lineNumber: io.sourcing.line
|
||||
};
|
||||
return frame;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns true if a command invocation contains a URL referring to the
|
||||
* domain *host*.
|
||||
|
||||
Reference in New Issue
Block a user