mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-15 12:03:32 +01:00
changed horrible history cache code
This commit is contained in:
@@ -750,22 +750,18 @@ function History() //{{{
|
|||||||
// so just update our cached history here
|
// so just update our cached history here
|
||||||
add: function (url, title)
|
add: function (url, title)
|
||||||
{
|
{
|
||||||
if (!placesHistory)
|
|
||||||
load();
|
|
||||||
|
|
||||||
let filter = function (h) h[0] != url;
|
let filter = function (h) h[0] != url;
|
||||||
|
|
||||||
// don't let cachedHistory grow too large
|
// don't let cachedHistory grow too large
|
||||||
if (cachedHistory.length > 1000)
|
if (placesHistory && cachedHistory.length > 1000)
|
||||||
{
|
{
|
||||||
placesHistory = cachedHistory.concat(placesHistory);
|
placesHistory = cachedHistory.concat(placesHistory);
|
||||||
|
placesHistory = placesHistory.filter(filter);
|
||||||
cachedHistory = [];
|
cachedHistory = [];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cachedHistory = cachedHistory.filter(filter);
|
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) });
|
cachedHistory.unshift({ url: url, title: title, get icon() function() bookmarks.getFavicon(this.url) });
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user