From 05a699dc5379aee49c0b5f692ac3dd1922e15797 Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Thu, 13 Nov 2008 23:19:13 +0000 Subject: [PATCH] changed horrible history cache code --- content/bookmarks.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/content/bookmarks.js b/content/bookmarks.js index b69f047b..460d335e 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -750,22 +750,18 @@ function History() //{{{ // so just update our cached history here add: function (url, title) { - if (!placesHistory) - load(); - let filter = function (h) h[0] != url; + // don't let cachedHistory grow too large - if (cachedHistory.length > 1000) + if (placesHistory && cachedHistory.length > 1000) { placesHistory = cachedHistory.concat(placesHistory); + placesHistory = placesHistory.filter(filter); cachedHistory = []; } else cachedHistory = cachedHistory.filter(filter); - if (placesHistory.some(function (h) h[0] == url)) - placesHistory = placesHistory.filter(filter); - cachedHistory.unshift({ url: url, title: title, get icon() function() bookmarks.getFavicon(this.url) }); return true; },