aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-05-15 10:46:24 +0100
committerStephen Blott2015-05-15 10:46:24 +0100
commit623f770324ae86edd3a8d1817164a79656967ade (patch)
tree3ce64a3e164f762831cc0f2be2c2d209e968bdd3 /background_scripts
parentff1f7ac546d387a283a7421ba714c0d566d1f006 (diff)
downloadvimium-623f770324ae86edd3a8d1817164a79656967ade.tar.bz2
Add comment explaining why we use try/catch.
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/completion.coffee11
1 files changed, 6 insertions, 5 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 8000c62b..011fbdfb 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -235,13 +235,14 @@ class HistoryCompleter
[]
onComplete results.map (entry) =>
# If this history URL starts with the search URL, we reconstruct the original search terms, and insert
- # them into the vomnibar when this suggestion is selected.
+ # them into the vomnibar when this suggestion is selected. We use try/catch because
+ # decodeURIComponent() throw an error.
insertText =
- if entry.url.startsWith searchUrl
- try
+ try
+ if entry.url.startsWith searchUrl
entry.url[searchUrl.length..].split(searchUrlTerminator)[0].split("+").map(decodeURIComponent).join " "
- catch
- null
+ catch
+ null
new Suggestion
queryTerms: queryTerms