From d99720ce10b415ce3162290fa66fc2d38232ad82 Mon Sep 17 00:00:00 2001 From: Ted Pavlic Date: Fri, 23 Jan 2009 16:31:55 -0500 Subject: [PATCH] In delmarks, change let variable name to prevent namespace-related error (bug #126). See http://vimperator.org/trac/ticket/126 Using... function (args) { let args = args.string; ... was causing Firefox to complain that args was undefined. Changing the "let" to "var" or changing the names of the variables (e.g., changing "function (args)" to "function (arg)") fixes the problem. IMO, this appears to be a bug in Firefox. The short fix would be to change the formal argument from "args" to "arg." However, that would make delmarks' implementation different from all the rest. So changed "let args" to "let argstring" and adjusted throughout the function. --- common/content/buffer.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/content/buffer.js b/common/content/buffer.js index c08ca04b..631aab8d 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -1614,20 +1614,20 @@ function Marks() //{{{ function (args) { let special = args.bang; - let args = args.string; + let argstring = args.string; - if (!special && !args) + if (!special && !argstring) { liberator.echoerr("E471: Argument required"); return; } - if (special && args) + if (special && argstring) { liberator.echoerr("E474: Invalid argument"); return; } let matches; - if (matches = args.match(/(?:(?:^|[^a-zA-Z0-9])-|-(?:$|[^a-zA-Z0-9])|[^a-zA-Z0-9 -]).*/)) + if (matches = argstring.match(/(?:(?:^|[^a-zA-Z0-9])-|-(?:$|[^a-zA-Z0-9])|[^a-zA-Z0-9 -]).*/)) { // NOTE: this currently differs from Vim's behavior which // deletes any valid marks in the arg list, up to the first @@ -1636,7 +1636,7 @@ function Marks() //{{{ return; } // check for illegal ranges - only allow a-z A-Z 0-9 - if (matches = args.match(/[a-zA-Z0-9]-[a-zA-Z0-9]/g)) + if (matches = argstring.match(/[a-zA-Z0-9]-[a-zA-Z0-9]/g)) { for (let i = 0; i < matches.length; i++) { @@ -1647,13 +1647,13 @@ function Marks() //{{{ /[0-9]/.test(start) != /[0-9]/.test(end) || start > end) { - liberator.echoerr("E475: Invalid argument: " + args.match(matches[i] + ".*")[0]); + liberator.echoerr("E475: Invalid argument: " + argstring.match(matches[i] + ".*")[0]); return; } } } - marks.remove(args, special); + marks.remove(argstring, special); }, { bang: true,