| 1 |
From f7bdc9274aa6dc8efccc50d18dbb287225aa6c27 Mon Sep 17 00:00:00 2001
|
| 2 |
From: Mike Perry <mikeperry-git@torproject.org>
|
| 3 |
Date: Tue, 1 May 2012 15:02:03 -0700
|
| 4 |
Subject: [PATCH 17/17] Make nsICacheService.EvictEntries synchronous
|
| 5 |
|
| 6 |
This fixes a race condition that allows cache-based EverCookies to persist for
|
| 7 |
a brief time (on the order of minutes?) after cache clearing/"New Identity".
|
| 8 |
|
| 9 |
https://trac.torproject.org/projects/tor/ticket/5715
|
| 10 |
---
|
| 11 |
netwerk/cache/nsCacheService.cpp | 15 +++++++++++++--
|
| 12 |
1 files changed, 13 insertions(+), 2 deletions(-)
|
| 13 |
|
| 14 |
diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp
|
| 15 |
index 015e49e..1ef0db1 100644
|
| 16 |
--- a/netwerk/cache/nsCacheService.cpp
|
| 17 |
+++ b/netwerk/cache/nsCacheService.cpp
|
| 18 |
@@ -1415,10 +1415,21 @@ NS_IMETHODIMP nsCacheService::VisitEntries(nsICacheVisitor *visitor)
|
| 19 |
return NS_OK;
|
| 20 |
}
|
| 21 |
|
| 22 |
-
|
| 23 |
NS_IMETHODIMP nsCacheService::EvictEntries(nsCacheStoragePolicy storagePolicy)
|
| 24 |
{
|
| 25 |
- return EvictEntriesForClient(nsnull, storagePolicy);
|
| 26 |
+ NS_IMETHODIMP r;
|
| 27 |
+ r = EvictEntriesForClient(nsnull, storagePolicy);
|
| 28 |
+
|
| 29 |
+ // XXX: Bloody hack until we get this notifier in FF14.0:
|
| 30 |
+ // https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsICacheListener#onCacheEntryDoomed%28%29
|
| 31 |
+ if (storagePolicy == nsICache::STORE_ANYWHERE &&
|
| 32 |
+ NS_IsMainThread() && gService && gService->mInitialized) {
|
| 33 |
+ nsCacheServiceAutoLock lock;
|
| 34 |
+ gService->DoomActiveEntries();
|
| 35 |
+ gService->ClearDoomList();
|
| 36 |
+ (void) SyncWithCacheIOThread();
|
| 37 |
+ }
|
| 38 |
+ return r;
|
| 39 |
}
|
| 40 |
|
| 41 |
NS_IMETHODIMP nsCacheService::GetCacheIOTarget(nsIEventTarget * *aCacheIOTarget)
|
| 42 |
--
|
| 43 |
1.7.5.4
|
| 44 |
|