File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -205,12 +205,12 @@ class DomainCompleter
205205 chrome .history .onVisitRemoved .addListener (@onVisitRemoved .bind (this ))
206206 onComplete ()
207207
208- # We want each key in our domains hash to point to the most recent History entry for that domain.
209208 onPageVisited : (newPage ) ->
210209 domain = @ parseDomain (newPage .url )
211210 if domain
212211 @domains [domain] ||= { entry : newPage, referenceCount : 0 }
213212 slot = @domains [domain]
213+ # We want each entry in our domains hash to point to the most recent History entry for that domain.
214214 slot .entry = newPage if slot .entry .lastVisitTime < newPage .lastVisitTime
215215 slot .referenceCount += 1
216216
@@ -220,12 +220,8 @@ class DomainCompleter
220220 else
221221 toRemove .urls .forEach (url) =>
222222 domain = @ parseDomain (url)
223- if domain
224- previousEntry = @domains [domain]
225- if previousEntry
226- previousEntry .referenceCount -= 1
227- if previousEntry .referenceCount == 0
228- delete @domains [domain]
223+ if domain and @domains [domain] and ( @domains [domain].referenceCount -= 1 ) == 0
224+ delete @domains [domain]
229225
230226 parseDomain : (url ) -> url .split (" /" )[2 ] || " "
231227
You can’t perform that action at this time.
0 commit comments