diff --git a/modules/libjar/nsJAR.cpp b/modules/libjar/nsJAR.cpp index b50289124a3..04ecc5e519f 100644 --- a/modules/libjar/nsJAR.cpp +++ b/modules/libjar/nsJAR.cpp @@ -1331,16 +1331,6 @@ nsZipReaderCache::ReleaseZip(nsJAR* zip) return NS_OK; } -static PLDHashOperator -FindFlushableZip(const nsACString &aKey, RefPtr& aCurrent, void*) -{ - if (aCurrent->GetReleaseTime() != PR_INTERVAL_NO_TIMEOUT) { - aCurrent->SetZipReaderCache(nullptr); - return PL_DHASH_REMOVE; - } - return PL_DHASH_NEXT; -} - NS_IMETHODIMP nsZipReaderCache::Observe(nsISupports *aSubject, const char *aTopic, @@ -1348,7 +1338,13 @@ nsZipReaderCache::Observe(nsISupports *aSubject, { if (strcmp(aTopic, "memory-pressure") == 0) { MutexAutoLock lock(mLock); - mZips.Enumerate(FindFlushableZip, nullptr); + for (auto iter = mZips.Iter(); !iter.Done(); iter.Next()) { + RefPtr& current = iter.Data(); + if (current->GetReleaseTime() != PR_INTERVAL_NO_TIMEOUT) { + current->SetZipReaderCache(nullptr); + iter.Remove(); + } + } } else if (strcmp(aTopic, "chrome-flush-caches") == 0) { MutexAutoLock lock(mLock);