diff options
| author | Phil Crosby | 2012-06-04 22:01:41 -0700 | 
|---|---|---|
| committer | Phil Crosby | 2012-06-04 22:01:41 -0700 | 
| commit | 7be56a178d69abcc0d27c7d28d832128596a0f88 (patch) | |
| tree | f86e1558eabe2100504e0a48e6fc23de1c8b21fe /background_scripts/completion.coffee | |
| parent | 79fc51ab7ba61ef836f5a208dbf3a4c1dcdb4c53 (diff) | |
| download | vimium-7be56a178d69abcc0d27c7d28d832128596a0f88.tar.bz2 | |
Don't use a closure for the onPageVisited handler.
I'm worried about keeping around a reference to history forever, unnecessarily.
Diffstat (limited to 'background_scripts/completion.coffee')
| -rw-r--r-- | background_scripts/completion.coffee | 8 | 
1 files changed, 5 insertions, 3 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee index f76b0fe9..040b1fdb 100644 --- a/background_scripts/completion.coffee +++ b/background_scripts/completion.coffee @@ -257,12 +257,14 @@ HistoryCache =        # sorting in ascending order. We will push new items on to the end as the user navigates to new pages.        history.sort((a, b) -> (a.lastVisitTime || 0) - (b.lastVisitTime || 0))        @history = history -      chrome.history.onVisited.addListener (newSite) => -        firstTimeVisit = (newSite.visitedCount == 1) -        @history.push(newSite) if firstTimeVisit +      chrome.history.onVisited.addListener(@onPageVisited.proxy(this))        callback(@history) for callback in @callbacks        @callbacks = null +  onPageVisited: (newPage) -> +    firstTimeVisit = (newSite.visitedCount == 1) +    @history.push(newSite) if firstTimeVisit +  root = exports ? window  root.Suggestion = Suggestion  root.BookmarkCompleter = BookmarkCompleter  | 
