diff options
author | Doug Kearns <dougkearns@gmail.com> | 2011-01-03 21:18:12 +1100 |
---|---|---|
committer | Doug Kearns <dougkearns@gmail.com> | 2011-01-03 21:18:12 +1100 |
commit | 2649952ef21c5932fc36eb9859dcedec19082332 (patch) | |
tree | fa51504397c1a1f94c6f8f84e86d71986524d819 | |
parent | 27e3681673e025b71e39167921f2d166cee9fcb4 (diff) | |
download | pentadactyl-2649952ef21c5932fc36eb9859dcedec19082332.tar.gz |
Add argument validation to state changing :ext* commands.
-rw-r--r-- | common/content/dactyl.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 1c6dfb88..4d268317 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1696,10 +1696,13 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { dactyl.assert(name, "E471: Argument required"); AddonManager.getAddonsByTypes(["extension"], dactyl.wrapCallback(function (list) { - if (!args.bang) + if (!args.bang) { list = list.filter(function (extension) extension.name == name); - if (!args.bang && !list.every(ok)) - return dactyl.echoerr("Permission denied"); + if (list.length == 0) + return void dactyl.echoerr("E475: Invalid argument: " + name); + if (!list.every(ok)) + return void dactyl.echoerr("Permission denied"); + } if (command.actions) command.actions(list); else |