storage-cache.js (756B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 const { 8 TYPES: { CACHE_STORAGE }, 9 } = require("resource://devtools/shared/commands/resource/resource-command.js"); 10 11 const { Front, types } = require("resource://devtools/shared/protocol.js"); 12 13 module.exports = function ({ resource, watcherFront, targetFront }) { 14 if (!(resource instanceof Front) && watcherFront) { 15 // instantiate front for local storage 16 resource = types.getType("Cache").read(resource, targetFront); 17 resource.resourceType = CACHE_STORAGE; 18 resource.resourceKey = "Cache"; 19 } 20 21 return resource; 22 };