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 217587 b2a5dbdc4e01d2ef9cb02e4067f14f1cc6561313
parent 217586 9be51ba78646a6a7643a5aaef8fb16d194619fa7
child 217588 3d0ef0acbe88f600331d933578a8e7aa5961f69e
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal, sledru
bugs1054418
milestone33.0a2
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) {