Bug 1198792 - Clear Application Cache internal hashtables on Clear Recent History, r=jduell
authorHonza Bambas <honzab.moz@firemni.cz>
Thu, 15 Oct 2015 09:56:00 +0200
changeset 303521 253a4531bd42794f58b46e390588dfcf81ec7238
parent 303520 8aa35040b3bf1a26996507b5c12da60d18a65b79
child 303522 62c613fe9297bc72b2e846757ac032cbe2a87373
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs1198792
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1198792 - Clear Application Cache internal hashtables on Clear Recent History, r=jduell
netwerk/cache/nsDiskCacheDeviceSQL.cpp
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -1909,32 +1909,40 @@ nsOfflineCacheDevice::EvictEntries(const
                               getter_AddRefs(statement));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = statement->BindUTF8StringByIndex(0, nsDependentCString(clientID));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = statement->Execute();
     NS_ENSURE_SUCCESS(rv, rv);
+
+    // TODO - Should update internal hashtables.
+    // Low priority, since this API is not widely used.
   }
   else
   {
     rv = mDB->CreateStatement(NS_LITERAL_CSTRING("DELETE FROM moz_cache;"),
                               getter_AddRefs(statement));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = statement->Execute();
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = mDB->CreateStatement(NS_LITERAL_CSTRING("DELETE FROM moz_cache_groups;"),
                               getter_AddRefs(statement));
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = statement->Execute();
     NS_ENSURE_SUCCESS(rv, rv);
+
+    MutexAutoLock lock(mLock);
+    mCaches.Clear();
+    mActiveCaches.Clear();
+    mActiveCachesByGroup.Clear();
   }
 
   evictionObserver.Apply();
 
   statement = nullptr;
   // Also evict any namespaces associated with this clientID.
   if (clientID)
   {