summaryrefslogtreecommitdiffstats
path: root/dom/serviceworkers/test/file_js_cache_cleanup.js
blob: 5a647046a1bea415bccc54ef52a3929e00827d2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"use strict";
const { XPCOMUtils } = ChromeUtils.importESModule(
  "resource://gre/modules/XPCOMUtils.sys.mjs"
);

function clearCache() {
  const cacheStorageSrv = Cc[
    "@mozilla.org/netwerk/cache-storage-service;1"
  ].getService(Ci.nsICacheStorageService);
  cacheStorageSrv.clear();
}

addMessageListener("teardown", function() {
  clearCache();
  sendAsyncMessage("teardown-complete");
});