| Index: Source/devtools/front_end/resources/ResourcesPanel.js
|
| diff --git a/Source/devtools/front_end/resources/ResourcesPanel.js b/Source/devtools/front_end/resources/ResourcesPanel.js
|
| index 831ddd2091bd92bddb699d4edd0a0b06de5db35d..7a85813a004e6635ddf650dd9dfae7e5bd3105c3 100644
|
| --- a/Source/devtools/front_end/resources/ResourcesPanel.js
|
| +++ b/Source/devtools/front_end/resources/ResourcesPanel.js
|
| @@ -66,6 +66,9 @@ WebInspector.ResourcesPanel = function()
|
| this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeElement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["application-cache-storage-tree-item"]);
|
| this._sidebarTree.appendChild(this.applicationCacheListTreeElement);
|
|
|
| + this.cacheStorageListTreeElement = new WebInspector.ServiceWorkerCacheTreeElement(this);
|
| + this._sidebarTree.appendChild(this.cacheStorageListTreeElement);
|
| +
|
| if (Runtime.experiments.isEnabled("fileSystemInspection")) {
|
| this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElement(this);
|
| this._sidebarTree.appendChild(this.fileSystemListTreeElement);
|
| @@ -122,11 +125,6 @@ WebInspector.ResourcesPanel.prototype = {
|
| return;
|
| this._target = target;
|
|
|
| - if (target.isServiceWorker()) {
|
| - this.serviceWorkerCacheListTreeElement = new WebInspector.ServiceWorkerCacheTreeElement(this);
|
| - this._sidebarTree.appendChild(this.serviceWorkerCacheListTreeElement);
|
| - }
|
| -
|
| if (target.serviceWorkerManager && Runtime.experiments.isEnabled("serviceWorkersInResources")) {
|
| this.serviceWorkersTreeElement = new WebInspector.ServiceWorkersTreeElement(this);
|
| this._sidebarTree.appendChild(this.serviceWorkersTreeElement);
|
| @@ -167,14 +165,14 @@ WebInspector.ResourcesPanel.prototype = {
|
| this._databaseModel.enable();
|
| this._domStorageModel.enable();
|
| WebInspector.IndexedDBModel.fromTarget(this._target).enable();
|
| + WebInspector.ServiceWorkerCacheModel.fromTarget(this._target).enable();
|
|
|
| if (this._target.isPage())
|
| this._populateResourceTree();
|
| this._populateDOMStorageTree();
|
| this._populateApplicationCacheTree();
|
| this.indexedDBListTreeElement._initialize();
|
| - if (this.serviceWorkerCacheListTreeElement)
|
| - this.serviceWorkerCacheListTreeElement._initialize();
|
| + this.cacheStorageListTreeElement._initialize();
|
| if (Runtime.experiments.isEnabled("fileSystemInspection"))
|
| this.fileSystemListTreeElement._initialize();
|
| this._initDefaultSelection();
|
| @@ -233,8 +231,7 @@ WebInspector.ResourcesPanel.prototype = {
|
| this.localStorageListTreeElement.removeChildren();
|
| this.sessionStorageListTreeElement.removeChildren();
|
| this.cookieListTreeElement.removeChildren();
|
| - if (this.serviceWorkerCacheListTreeElement)
|
| - this.serviceWorkerCacheListTreeElement.removeChildren();
|
| + this.cacheStorageListTreeElement.removeChildren();
|
|
|
| if (this.visibleView && !(this.visibleView instanceof WebInspector.StorageCategoryView))
|
| this.visibleView.detach();
|
| @@ -1421,11 +1418,10 @@ WebInspector.DatabaseTableTreeElement.prototype = {
|
| * @constructor
|
| * @extends {WebInspector.StorageCategoryTreeElement}
|
| * @param {!WebInspector.ResourcesPanel} storagePanel
|
| - * @implements {WebInspector.TargetManager.Observer}
|
| */
|
| WebInspector.ServiceWorkerCacheTreeElement = function(storagePanel)
|
| {
|
| - WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspector.UIString("Service Worker Cache"), "ServiceWorkerCache", ["service-worker-cache-storage-tree-item"]);
|
| + WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspector.UIString("Cache Storage"), "CacheStorage", ["service-worker-cache-storage-tree-item"]);
|
| }
|
|
|
| WebInspector.ServiceWorkerCacheTreeElement.prototype = {
|
| @@ -1433,18 +1429,15 @@ WebInspector.ServiceWorkerCacheTreeElement.prototype = {
|
| {
|
| /** @type {!Array.<!WebInspector.SWCacheTreeElement>} */
|
| this._swCacheTreeElements = [];
|
| - var targets = WebInspector.targetManager.targets();
|
| - for (var i = 0; i < targets.length; ++i) {
|
| - if (!targets[i].serviceWorkerCacheModel)
|
| - continue;
|
| - var caches = targets[i].serviceWorkerCacheModel.caches();
|
| - for (var j = 0; j < caches.length; ++j)
|
| - this._addCache(targets[i].serviceWorkerCacheModel, caches[j]);
|
| + var target = WebInspector.targetManager.mainTarget();
|
| + if (target) {
|
| + var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target);
|
| + var caches = model.caches();
|
| + for (var cache of caches)
|
| + this._addCache(model, cache);
|
| }
|
| WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCacheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded, this._cacheAdded, this);
|
| WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCacheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved, this._cacheRemoved, this);
|
| - this._refreshCaches();
|
| - WebInspector.targetManager.observeTargets(this);
|
| },
|
|
|
| onattach: function()
|
| @@ -1453,22 +1446,6 @@ WebInspector.ServiceWorkerCacheTreeElement.prototype = {
|
| this.listItemElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
|
| },
|
|
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.Target} target
|
| - */
|
| - targetAdded: function(target)
|
| - {
|
| - if (target.isServiceWorker() && target.serviceWorkerCacheModel)
|
| - this._refreshCaches();
|
| - },
|
| -
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.Target} target
|
| - */
|
| - targetRemoved: function(target) {},
|
| -
|
| _handleContextMenuEvent: function(event)
|
| {
|
| var contextMenu = new WebInspector.ContextMenu(event);
|
| @@ -1478,10 +1455,10 @@ WebInspector.ServiceWorkerCacheTreeElement.prototype = {
|
|
|
| _refreshCaches: function()
|
| {
|
| - var targets = WebInspector.targetManager.targets();
|
| - for (var i = 0; i < targets.length; ++i) {
|
| - if (targets[i].serviceWorkerCacheModel)
|
| - targets[i].serviceWorkerCacheModel.refreshCacheNames();
|
| + var target = WebInspector.targetManager.mainTarget();
|
| + if (target) {
|
| + var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target);
|
| + model.refreshCacheNames();
|
| }
|
| },
|
|
|
| @@ -1554,7 +1531,7 @@ WebInspector.ServiceWorkerCacheTreeElement.prototype = {
|
| */
|
| WebInspector.SWCacheTreeElement = function(storagePanel, model, cacheId)
|
| {
|
| - WebInspector.BaseStorageTreeElement.call(this, storagePanel, cacheId.name, ["service-worker-cache-tree-item"]);
|
| + WebInspector.BaseStorageTreeElement.call(this, storagePanel, cacheId.cacheName + " - " + cacheId.securityOrigin, ["service-worker-cache-tree-item"]);
|
| this._model = model;
|
| this._cacheId = cacheId;
|
| }
|
| @@ -1563,7 +1540,7 @@ WebInspector.SWCacheTreeElement.prototype = {
|
| get itemURL()
|
| {
|
| // I don't think this will work at all.
|
| - return "swcache://" + this._cacheId.name;
|
| + return "cache://" + this._cacheId.toString();
|
| },
|
|
|
| onattach: function()
|
|
|