Bug 1413622 - Del with zero during logging. r=mayhemer
authorDragana Damjanovic dd.mozilla@gmail.com
Thu, 02 Nov 2017 02:31:00 -0400
changeset 443156 c773790077bf23429361cb34df73ca21c7f2bc37
parent 443142 ecf551e606ddf88d3052f9351b81abc6bbf926b6
child 443157 b34ad88764a90f17ac65a7f648ea3809025c802f
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmayhemer
bugs1413622
milestone58.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 1413622 - Del with zero during logging. r=mayhemer
netwerk/cache/nsCacheService.cpp
--- a/netwerk/cache/nsCacheService.cpp
+++ b/netwerk/cache/nsCacheService.cpp
@@ -3059,18 +3059,21 @@ void nsCacheService::GetAppCacheDirector
 
     directory.forget(result);
 }
 
 
 void
 nsCacheService::LogCacheStatistics()
 {
-    uint32_t hitPercentage = (uint32_t)((((double)mCacheHits) /
-        ((double)(mCacheHits + mCacheMisses))) * 100);
+    uint32_t hitPercentage = 0;
+    if (!mCacheHits || !mCacheMisses) {
+        hitPercentage = (uint32_t)((((double)mCacheHits) /
+            ((double)(mCacheHits + mCacheMisses))) * 100);
+    }
     CACHE_LOG_INFO(("\nCache Service Statistics:\n\n"));
     CACHE_LOG_INFO(("    TotalEntries   = %d\n", mTotalEntries));
     CACHE_LOG_INFO(("    Cache Hits     = %d\n", mCacheHits));
     CACHE_LOG_INFO(("    Cache Misses   = %d\n", mCacheMisses));
     CACHE_LOG_INFO(("    Cache Hit %%    = %d%%\n", hitPercentage));
     CACHE_LOG_INFO(("    Max Key Length = %d\n", mMaxKeyLength));
     CACHE_LOG_INFO(("    Max Meta Size  = %d\n", mMaxMetaSize));
     CACHE_LOG_INFO(("    Max Data Size  = %d\n", mMaxDataSize));