From cd84d64b4332f57ef9480c37297f96a2a2a809a7 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Mon, 8 Dec 2008 15:38:32 +0100 Subject: [PATCH] allow searching for std::string like strings by checking wheter \w+ is an actual protocol --- common/content/util.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/content/util.js b/common/content/util.js index cc961c54..dfcd4468 100644 --- a/common/content/util.js +++ b/common/content/util.js @@ -482,9 +482,10 @@ const util = { //{{{ url = url.replace(/^\s+|\s+$/, ""); // if the string doesn't look like a valid URL (i.e. contains a space - // or does not contain any of: .:/) try opening it with a search engine + // or starts with a known protocol try opening it with a search engine // or keyword bookmark - if (/\s/.test(url) || !/[.:\/]/.test(url)) + let proto = url.match(/^(\w+):/); + if (/\s/.test(url) || (proto && !Components.classes["@mozilla.org/network/protocol;1?name=" + proto[1]])) { // TODO: it would be clearer if the appropriate call to // getSearchURL was made based on whether or not the first word was