Bug 1061990 Cache size does not update after clearing cache r=mcsmurf a=IanN
authorNeil Rashbrook <neil@parkwaycc.co.uk>
Tue, 25 Nov 2014 22:31:38 +0000
changeset 25527 8f532035badf33818e72723a56ec9b85f86e0877
parent 25526 097e1c11dc55b2f947da300119dbd851f60d60c5
child 25528 919ddae9cf988aef32cfafc0dab9b79f4c558881
push id1850
push userclokep@gmail.com
push dateWed, 08 Mar 2017 19:29:12 +0000
treeherdercomm-esr52@028df196b2d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcsmurf, IanN
bugs1061990
Bug 1061990 Cache size does not update after clearing cache r=mcsmurf a=IanN
suite/common/pref/pref-cache.js
--- a/suite/common/pref/pref-cache.js
+++ b/suite/common/pref/pref-cache.js
@@ -3,19 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
 Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
 
 function Startup()
 {
-  Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
-            .getService(Components.interfaces.nsICacheStorageService)
-            .asyncGetDiskConsumption(CacheObserver);
+  updateActualCacheSize();
 }
 
 // Needs to be global because the cache service only keeps a weak reference.
 var CacheObserver = {
   /* nsICacheStorageConsumptionObserver */
   onNetworkCacheDiskConsumption: function(aConsumption) {
     var actualSizeLabel = document.getElementById("cacheSizeInfo");
     var sizeStrings = DownloadUtils.convertByteUnits(aConsumption);
@@ -98,8 +96,14 @@ function updateCacheSizeUI(cacheSizeEnab
 
 function ReadSmartSizeEnabled()
 {
   var enabled = document.getElementById("browser.cache.disk.smart_size.enabled").value;
   updateCacheSizeUI(enabled);
   return enabled;
 }
 
+function updateActualCacheSize()
+{
+  Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
+            .getService(Components.interfaces.nsICacheStorageService)
+            .asyncGetDiskConsumption(CacheObserver);
+}