aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2015-05-29 17:06:55 +0100
committerStephen Blott2015-05-29 17:14:25 +0100
commit97bfe5f039ae9044fc634448ad3a97b1cdc05792 (patch)
treef0cac6ea63e78fe53e2e0caeb34c8bb02c294bd2 /lib
parentff44941dc8d7f504d07d51e58955250609df6684 (diff)
downloadvimium-97bfe5f039ae9044fc634448ad3a97b1cdc05792.tar.bz2
Verify keyword for custom search-engine activation.
For ... map s Vomnibar.activate keyword=g ... we verify that "g" is indeed a custom search-engine keyword before setting it. If it is not, we output a console.log message and launch a vanilla vomnibar. (An alternative would be to bail.)
Diffstat (limited to 'lib')
-rw-r--r--lib/utils.coffee10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/utils.coffee b/lib/utils.coffee
index cb7b4d5c..77e2b68d 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -245,14 +245,10 @@ SearchEngines =
tokens = line.split /\s+/
continue unless 2 <= tokens.length
keyword = tokens[0].split(":")[0]
- url = tokens[1]
+ searchUrl = tokens[1]
description = tokens[2..].join(" ") || "search (#{keyword})"
- continue unless Utils.hasFullUrlPrefix url
- engines[keyword] =
- keyword: keyword
- searchUrl: url
- description: description
- searchUrlPrefix: url.split("%s")[0]
+ continue unless Utils.hasFullUrlPrefix searchUrl
+ engines[keyword] = { keyword, searchUrl, description }
callback engines