Bug 1054418 - Rewrite AppCacheUtils.jsm to use HTTP Cache v2 APIs. r=michal, a=sledru
authorSteve Workman <sworkman@mozilla.com>
Tue, 19 Aug 2014 13:59:57 -0700
changeset 208354 fa7360fe9779
parent 208353 4f18903bc230
child 208355 c06efff91ed3
push id3836
push userryanvm@gmail.com
push date2014-08-20 23:01 +0000
treeherdermozilla-beta@f5d4b16203aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal, sledru
bugs1054418
milestone32.0
Bug 1054418 - Rewrite AppCacheUtils.jsm to use HTTP Cache v2 APIs. r=michal, a=sledru
browser/devtools/shared/AppCacheUtils.jsm
--- a/browser/devtools/shared/AppCacheUtils.jsm
+++ b/browser/devtools/shared/AppCacheUtils.jsm
@@ -288,17 +288,24 @@ AppCacheUtils.prototype = {
     let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
                .getService(Ci.nsIWindowMediator);
     let win = wm.getMostRecentWindow("navigator:browser");
     win.gBrowser.selectedTab = win.gBrowser.addTab(
       "about:cache-entry?storage=appcache&context=&eid=&uri=" + key);
   },
 
   clearAll: function ACU_clearAll() {
-    Services.cache.evictEntries(Ci.nsICache.STORE_OFFLINE);
+    if (!Services.prefs.getBoolPref("browser.cache.disk.enable")) {
+      throw new Error(l10n.GetStringFromName("cacheDisabled"));
+    }
+
+    let appCacheStorage = Services.cache2.appCacheStorage(LoadContextInfo.default, null);
+    appCacheStorage.asyncEvictStorage({
+      onCacheEntryDoomed: function(result) {}
+    });
   },
 
   _getManifestURI: function ACU__getManifestURI() {
     let deferred = promise.defer();
 
     let getURI = () => {
       let htmlNode = this.doc.querySelector("html[manifest]");
       if (htmlNode) {