From 5231ce880fb19acecfbb7d23619bd09799483215 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 13 Apr 2009 08:42:06 -0400 Subject: [PATCH] Validate 'hinttags' and 'extendedhinttags' --- common/content/hints.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/common/content/hints.js b/common/content/hints.js index 186a3380..4ab87bff 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -779,13 +779,27 @@ function Hints() //{{{ "//input[not(@type='hidden')] | //a | //area | //iframe | //textarea | //button | //select | " + "//xhtml:input[not(@type='hidden')] | //xhtml:a | //xhtml:area | //xhtml:iframe | //xhtml:textarea | //xhtml:button | //xhtml:select"; + function checkXPath(val) { + try + { + buffer.evaluateXPath(val, document.implementation.createDocument("", "", null)); + return true; + } + catch (e) + { + return false; + } + } + options.add(["extendedhinttags", "eht"], "XPath string of hintable elements activated by ';'", - "string", DEFAULT_HINTTAGS); + "string", DEFAULT_HINTTAGS, + { validator: checkXPath }); options.add(["hinttags", "ht"], "XPath string of hintable elements activated by 'f' and 'F'", - "string", DEFAULT_HINTTAGS); + "string", DEFAULT_HINTTAGS, + { validator: checkXPath }); options.add(["hinttimeout", "hto"], "Timeout before automatically following a non-unique numerical hint",