aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2017-04-20 14:46:28 +0100
committerStephen Blott2017-04-20 14:50:40 +0100
commit9a7b46ae59ed3a745e76e8f86c213fee631574d6 (patch)
treeeac6d7cd5daf46d3e34b843ef60eaad32d7157f3 /background_scripts
parent0f26a68a2b601df61656607227e2c2c165e77111 (diff)
downloadvimium-9a7b46ae59ed3a745e76e8f86c213fee631574d6.tar.bz2
Firefox: some history entries have no title.
This causes `o`/`O` to crash (producing no suggestions). As a workaround, set any such title to "".
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/completion.coffee4
1 files changed, 4 insertions, 0 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 66ad2e38..987ba8a4 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -763,6 +763,8 @@ HistoryCache =
return @callbacks.push(callback) if @callbacks
@callbacks = [callback]
chrome.history.search { text: "", maxResults: @size, startTime: 0 }, (history) =>
+ # On Firefox, some history entries do not have titles.
+ history.map (entry) -> entry.title ?= ""
history.sort @compareHistoryByUrl
@history = history
chrome.history.onVisited.addListener(@onPageVisited.bind(this))
@@ -778,6 +780,8 @@ HistoryCache =
# When a page we've seen before has been visited again, be sure to replace our History item so it has the
# correct "lastVisitTime". That's crucial for ranking Vomnibar suggestions.
onPageVisited: (newPage) ->
+ # On Firefox, some history entries do not have titles.
+ newPage.title ?= ""
i = HistoryCache.binarySearch(newPage, @history, @compareHistoryByUrl)
pageWasFound = (@history[i]?.url == newPage.url)
if pageWasFound