Bug 480873 - Favicons missing from the places UI after cache has been cleared, r=dietrich

This commit is contained in:
Marco Bonardo 2009-04-02 01:26:16 +02:00
Родитель d37e6bf09c
Коммит 61e09b142f
3 изменённых файлов: 3 добавлений и 44 удалений

Просмотреть файл

@ -75,7 +75,7 @@
#define FAVICON_BUFFER_INCREMENT 8192
#define MAX_FAVICON_CACHE_SIZE 512
#define MAX_FAVICON_CACHE_SIZE 256
#define FAVICON_CACHE_REDUCE_COUNT 64
#define CONTENT_SNIFFING_SERVICES "content-sniffing-services"
@ -134,10 +134,9 @@ private:
nsFaviconService* nsFaviconService::gFaviconService;
NS_IMPL_ISUPPORTS2(
NS_IMPL_ISUPPORTS1(
nsFaviconService
, nsIFaviconService
, nsIObserver
)
// nsFaviconService::nsFaviconService
@ -156,14 +155,6 @@ nsFaviconService::~nsFaviconService()
{
NS_ASSERTION(gFaviconService == this, "Deleting a non-singleton favicon service");
// Remove observers
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
(void)observerService->RemoveObserver(this,
NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID);
}
if (gFaviconService == this)
gFaviconService = nsnull;
}
@ -226,19 +217,9 @@ nsFaviconService::Init()
NS_ENSURE_SUCCESS(rv, rv);
// failed favicon cache
if (! mFailedFavicons.Init(256))
if (! mFailedFavicons.Init(MAX_FAVICON_CACHE_SIZE))
return NS_ERROR_OUT_OF_MEMORY;
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService) {
// Observe empty-cache notifications so tahat clearing the disk/memory
// cache will also expire favicons.
(void)observerService->AddObserver(this,
NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID,
PR_FALSE);
}
return NS_OK;
}
@ -315,19 +296,6 @@ nsFaviconService::ExpireAllFavicons()
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
//// nsIObserver
NS_IMETHODIMP
nsFaviconService::Observe(nsISupports *aSubject, const char *aTopic,
const PRUnichar *aData)
{
if (strcmp(aTopic, NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID) == 0)
(void)ExpireAllFavicons();
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
//// nsIFaviconService

Просмотреть файл

@ -44,7 +44,6 @@
#include "mozIStorageConnection.h"
#include "mozIStorageValueArray.h"
#include "mozIStorageStatement.h"
#include "nsIObserver.h"
// Favicons bigger than this size should not be saved to the db to avoid
// bloating it with large image blobs.
@ -58,7 +57,6 @@ class mozIStorageStatementCallback;
class FaviconLoadListener;
class nsFaviconService : public nsIFaviconService
, public nsIObserver
{
public:
nsFaviconService();
@ -121,7 +119,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIFAVICONSERVICE
NS_DECL_NSIOBSERVER
private:
~nsFaviconService();

Просмотреть файл

@ -68,12 +68,6 @@ var tests = [
setup();
icons.expireAllFavicons();
},
function() {
dump("\n\nTest that clearing cache also expires favicons.\n");
setup();
cs.evictEntries(Ci.nsICache.STORE_ANYWHERE);
},
];
function setup() {