From 623f770324ae86edd3a8d1817164a79656967ade Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Fri, 15 May 2015 10:46:24 +0100 Subject: Add comment explaining why we use try/catch. --- background_scripts/completion.coffee | 11 ++++++----- 1 file 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 -- cgit v1.2.3