From 3fa67e8ec481c9c0b9f27bb17693c7d1f7e469b6 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 3 Oct 2011 05:10:14 -0400 Subject: [PATCH] Reject attempts to record non-letter-named macros. --- common/content/events.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/content/events.js b/common/content/events.js index 7fde5e12..e8d1080b 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -246,15 +246,15 @@ var Events = Module("events", { modes.recording = macro; - if (/[A-Z]/.test(macro)) { // uppercase (append) + if (/[A-Z]/.test(macro)) { // Append. macro = macro.toLowerCase(); this._macroKeys = DOM.Event.iterKeys((this._macros.get(macro) || { keys: "" }).keys) .toArray(); } - else if (macro) { + else if (macro) { // Record afresh. this._macroKeys = []; } - else if (this.recording) { + else if (this.recording) { // Save. this._macros.set(this.recording, { keys: this._macroKeys.join(""), timeRecorded: Date.now() @@ -1050,6 +1050,7 @@ var Events = Module("events", { mappings.add([modes.COMMAND], ["q", ""], "Record a key sequence into a macro", function ({ arg }) { + util.assert(arg == null || /^[a-z]$/i.test(arg)); events._macroKeys.pop(); events.recording = arg; },