1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 15:47:58 +01:00

Another attempt at revision 8613b76cff40.

This commit is contained in:
Kris Maglione
2011-02-03 09:48:10 -05:00
parent e470de350c
commit d48dcd8723
16 changed files with 149 additions and 111 deletions

View File

@@ -468,7 +468,7 @@ var Commands = Module("commands", {
_addCommand: function (args, replace) {
if (!args[3])
args[3] = {};
args[3].definedAt = commands.getCaller(Components.stack.caller.caller);
args[3].definedAt = Commands.getCaller(Components.stack.caller.caller);
let names = array.flatten(Command.parseSpecs(args[0]));
args.parsedSpecs = names;
@@ -659,23 +659,6 @@ var 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: io.sourcing.file[0] == "[" ? io.sourcing.file :
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*.
@@ -1179,6 +1162,23 @@ var Commands = Module("commands", {
delete this._exMap[name];
}
}, {
/**
* 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: io.sourcing.file[0] == "[" ? io.sourcing.file :
services.io.newFileURI(File(io.sourcing.file)).spec,
lineNumber: io.sourcing.line
};
return frame;
},
// returns [count, parsed_argument]
parseArg: function parseArg(str, sep, keepQuotes) {
let arg = "";
@@ -1552,7 +1552,7 @@ var Commands = Module("commands", {
});
},
javascript: function () {
JavaScript.setCompleter([this.get, this.removeUserCommand],
JavaScript.setCompleter([commands.get, commands.removeUserCommand],
[function () ([c.name, c.description] for (c in commands))]);
},
mappings: function () {