michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: const gcli = require("gcli/index"); michael@0: michael@0: loader.lazyImporter(this, "AppCacheUtils", "resource:///modules/devtools/AppCacheUtils.jsm"); michael@0: michael@0: exports.items = [ michael@0: { michael@0: name: "appcache", michael@0: description: gcli.lookup("appCacheDesc") michael@0: }, michael@0: { michael@0: name: "appcache validate", michael@0: description: gcli.lookup("appCacheValidateDesc"), michael@0: manual: gcli.lookup("appCacheValidateManual"), michael@0: returnType: "appcacheerrors", michael@0: params: [{ michael@0: group: "options", michael@0: params: [ michael@0: { michael@0: type: "string", michael@0: name: "uri", michael@0: description: gcli.lookup("appCacheValidateUriDesc"), michael@0: defaultValue: null, michael@0: } michael@0: ] michael@0: }], michael@0: exec: function(args, context) { michael@0: let utils; michael@0: let deferred = context.defer(); michael@0: michael@0: if (args.uri) { michael@0: utils = new AppCacheUtils(args.uri); michael@0: } else { michael@0: utils = new AppCacheUtils(context.environment.document); michael@0: } michael@0: michael@0: utils.validateManifest().then(function(errors) { michael@0: deferred.resolve([errors, utils.manifestURI || "-"]); michael@0: }); michael@0: michael@0: return deferred.promise; michael@0: } michael@0: }, michael@0: { michael@0: item: "converter", michael@0: from: "appcacheerrors", michael@0: to: "view", michael@0: exec: function([errors, manifestURI], context) { michael@0: if (errors.length == 0) { michael@0: return context.createView({ michael@0: html: "" + gcli.lookup("appCacheValidatedSuccessfully") + "" michael@0: }); michael@0: } michael@0: michael@0: return context.createView({ michael@0: html: michael@0: "
" + gcli.lookup("appCacheListKey") + " | " + michael@0: "${entry.key} | " + michael@0: "
" + gcli.lookup("appCacheListFetchCount") + " | " + michael@0: "${entry.fetchCount} | " + michael@0: "
" + gcli.lookup("appCacheListLastFetched") + " | " + michael@0: "${entry.lastFetched} | " + michael@0: "
" + gcli.lookup("appCacheListLastModified") + " | " + michael@0: "${entry.lastModified} | " + michael@0: "
" + gcli.lookup("appCacheListExpirationTime") + " | " + michael@0: "${entry.expirationTime} | " + michael@0: "
" + gcli.lookup("appCacheListDataSize") + " | " + michael@0: "${entry.dataSize} | " + michael@0: "
" + gcli.lookup("appCacheListDeviceID") + " | " + michael@0: "${entry.deviceID} " + gcli.lookup("appCacheListViewEntry") + "" + michael@0: " | " + michael@0: "