| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeEle
ment(this, WebInspector.UIString("Session Storage"), "SessionStorage", ["domstor
age-storage-tree-item", "session-storage"]); | 60 this.sessionStorageListTreeElement = new WebInspector.StorageCategoryTreeEle
ment(this, WebInspector.UIString("Session Storage"), "SessionStorage", ["domstor
age-storage-tree-item", "session-storage"]); |
| 61 this._sidebarTree.appendChild(this.sessionStorageListTreeElement); | 61 this._sidebarTree.appendChild(this.sessionStorageListTreeElement); |
| 62 | 62 |
| 63 this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(thi
s, WebInspector.UIString("Cookies"), "Cookies", ["cookie-storage-tree-item"]); | 63 this.cookieListTreeElement = new WebInspector.StorageCategoryTreeElement(thi
s, WebInspector.UIString("Cookies"), "Cookies", ["cookie-storage-tree-item"]); |
| 64 this._sidebarTree.appendChild(this.cookieListTreeElement); | 64 this._sidebarTree.appendChild(this.cookieListTreeElement); |
| 65 | 65 |
| 66 this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeE
lement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["a
pplication-cache-storage-tree-item"]); | 66 this.applicationCacheListTreeElement = new WebInspector.StorageCategoryTreeE
lement(this, WebInspector.UIString("Application Cache"), "ApplicationCache", ["a
pplication-cache-storage-tree-item"]); |
| 67 this._sidebarTree.appendChild(this.applicationCacheListTreeElement); | 67 this._sidebarTree.appendChild(this.applicationCacheListTreeElement); |
| 68 | 68 |
| 69 this.cacheStorageListTreeElement = new WebInspector.ServiceWorkerCacheTreeEl
ement(this); |
| 70 this._sidebarTree.appendChild(this.cacheStorageListTreeElement); |
| 71 |
| 69 if (Runtime.experiments.isEnabled("fileSystemInspection")) { | 72 if (Runtime.experiments.isEnabled("fileSystemInspection")) { |
| 70 this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElem
ent(this); | 73 this.fileSystemListTreeElement = new WebInspector.FileSystemListTreeElem
ent(this); |
| 71 this._sidebarTree.appendChild(this.fileSystemListTreeElement); | 74 this._sidebarTree.appendChild(this.fileSystemListTreeElement); |
| 72 } | 75 } |
| 73 | 76 |
| 74 var mainView = new WebInspector.VBox(); | 77 var mainView = new WebInspector.VBox(); |
| 75 this.storageViews = mainView.element.createChild("div", "vbox flex-auto"); | 78 this.storageViews = mainView.element.createChild("div", "vbox flex-auto"); |
| 76 this._storageViewToolbar = new WebInspector.Toolbar(mainView.element); | 79 this._storageViewToolbar = new WebInspector.Toolbar(mainView.element); |
| 77 this._storageViewToolbar.element.classList.add("resources-toolbar"); | 80 this._storageViewToolbar.element.classList.add("resources-toolbar"); |
| 78 this.splitView().setMainView(mainView); | 81 this.splitView().setMainView(mainView); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 /** | 118 /** |
| 116 * @override | 119 * @override |
| 117 * @param {!WebInspector.Target} target | 120 * @param {!WebInspector.Target} target |
| 118 */ | 121 */ |
| 119 targetAdded: function(target) | 122 targetAdded: function(target) |
| 120 { | 123 { |
| 121 if (this._target) | 124 if (this._target) |
| 122 return; | 125 return; |
| 123 this._target = target; | 126 this._target = target; |
| 124 | 127 |
| 125 if (target.isServiceWorker()) { | |
| 126 this.serviceWorkerCacheListTreeElement = new WebInspector.ServiceWor
kerCacheTreeElement(this); | |
| 127 this._sidebarTree.appendChild(this.serviceWorkerCacheListTreeElement
); | |
| 128 } | |
| 129 | |
| 130 if (target.serviceWorkerManager && Runtime.experiments.isEnabled("servic
eWorkersInResources")) { | 128 if (target.serviceWorkerManager && Runtime.experiments.isEnabled("servic
eWorkersInResources")) { |
| 131 this.serviceWorkersTreeElement = new WebInspector.ServiceWorkersTree
Element(this); | 129 this.serviceWorkersTreeElement = new WebInspector.ServiceWorkersTree
Element(this); |
| 132 this._sidebarTree.appendChild(this.serviceWorkersTreeElement); | 130 this._sidebarTree.appendChild(this.serviceWorkersTreeElement); |
| 133 } | 131 } |
| 134 | 132 |
| 135 this._databaseModel = WebInspector.DatabaseModel.fromTarget(target); | 133 this._databaseModel = WebInspector.DatabaseModel.fromTarget(target); |
| 136 this._domStorageModel = WebInspector.DOMStorageModel.fromTarget(target); | 134 this._domStorageModel = WebInspector.DOMStorageModel.fromTarget(target); |
| 137 | 135 |
| 138 if (target.resourceTreeModel.cachedResourcesLoaded()) | 136 if (target.resourceTreeModel.cachedResourcesLoaded()) |
| 139 this._initialize(); | 137 this._initialize(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 163 }, | 161 }, |
| 164 | 162 |
| 165 _initialize: function() | 163 _initialize: function() |
| 166 { | 164 { |
| 167 this._databaseModel.enable(); | 165 this._databaseModel.enable(); |
| 168 this._domStorageModel.enable(); | 166 this._domStorageModel.enable(); |
| 169 var indexedDBModel = WebInspector.IndexedDBModel.fromTarget(this._target
); | 167 var indexedDBModel = WebInspector.IndexedDBModel.fromTarget(this._target
); |
| 170 if (indexedDBModel) | 168 if (indexedDBModel) |
| 171 indexedDBModel.enable(); | 169 indexedDBModel.enable(); |
| 172 | 170 |
| 171 var cacheStorageModel = WebInspector.ServiceWorkerCacheModel.fromTarget(
this._target); |
| 172 if (cacheStorageModel) |
| 173 cacheStorageModel.enable(); |
| 174 |
| 173 if (this._target.isPage()) | 175 if (this._target.isPage()) |
| 174 this._populateResourceTree(); | 176 this._populateResourceTree(); |
| 175 this._populateDOMStorageTree(); | 177 this._populateDOMStorageTree(); |
| 176 this._populateApplicationCacheTree(); | 178 this._populateApplicationCacheTree(); |
| 177 this.indexedDBListTreeElement._initialize(); | 179 this.indexedDBListTreeElement._initialize(); |
| 178 if (this.serviceWorkerCacheListTreeElement) | 180 this.cacheStorageListTreeElement._initialize(); |
| 179 this.serviceWorkerCacheListTreeElement._initialize(); | |
| 180 if (Runtime.experiments.isEnabled("fileSystemInspection")) | 181 if (Runtime.experiments.isEnabled("fileSystemInspection")) |
| 181 this.fileSystemListTreeElement._initialize(); | 182 this.fileSystemListTreeElement._initialize(); |
| 182 this._initDefaultSelection(); | 183 this._initDefaultSelection(); |
| 183 this._initialized = true; | 184 this._initialized = true; |
| 184 }, | 185 }, |
| 185 | 186 |
| 186 _loadEventFired: function() | 187 _loadEventFired: function() |
| 187 { | 188 { |
| 188 this._initDefaultSelection(); | 189 this._initDefaultSelection(); |
| 189 }, | 190 }, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 this._databaseQueryViews.clear(); | 229 this._databaseQueryViews.clear(); |
| 229 this._databaseTreeElements.clear(); | 230 this._databaseTreeElements.clear(); |
| 230 this._domStorageViews.clear(); | 231 this._domStorageViews.clear(); |
| 231 this._domStorageTreeElements.clear(); | 232 this._domStorageTreeElements.clear(); |
| 232 this._cookieViews = {}; | 233 this._cookieViews = {}; |
| 233 | 234 |
| 234 this.databasesListTreeElement.removeChildren(); | 235 this.databasesListTreeElement.removeChildren(); |
| 235 this.localStorageListTreeElement.removeChildren(); | 236 this.localStorageListTreeElement.removeChildren(); |
| 236 this.sessionStorageListTreeElement.removeChildren(); | 237 this.sessionStorageListTreeElement.removeChildren(); |
| 237 this.cookieListTreeElement.removeChildren(); | 238 this.cookieListTreeElement.removeChildren(); |
| 238 if (this.serviceWorkerCacheListTreeElement) | 239 this.cacheStorageListTreeElement.removeChildren(); |
| 239 this.serviceWorkerCacheListTreeElement.removeChildren(); | |
| 240 | 240 |
| 241 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora
geCategoryView)) | 241 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora
geCategoryView)) |
| 242 this.visibleView.detach(); | 242 this.visibleView.detach(); |
| 243 | 243 |
| 244 this._storageViewToolbar.removeToolbarItems(); | 244 this._storageViewToolbar.removeToolbarItems(); |
| 245 | 245 |
| 246 if (this._sidebarTree.selectedTreeElement) | 246 if (this._sidebarTree.selectedTreeElement) |
| 247 this._sidebarTree.selectedTreeElement.deselect(); | 247 this._sidebarTree.selectedTreeElement.deselect(); |
| 248 }, | 248 }, |
| 249 | 249 |
| (...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 }, | 1418 }, |
| 1419 | 1419 |
| 1420 __proto__: WebInspector.BaseStorageTreeElement.prototype | 1420 __proto__: WebInspector.BaseStorageTreeElement.prototype |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 | 1423 |
| 1424 /** | 1424 /** |
| 1425 * @constructor | 1425 * @constructor |
| 1426 * @extends {WebInspector.StorageCategoryTreeElement} | 1426 * @extends {WebInspector.StorageCategoryTreeElement} |
| 1427 * @param {!WebInspector.ResourcesPanel} storagePanel | 1427 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 1428 * @implements {WebInspector.TargetManager.Observer} | |
| 1429 */ | 1428 */ |
| 1430 WebInspector.ServiceWorkerCacheTreeElement = function(storagePanel) | 1429 WebInspector.ServiceWorkerCacheTreeElement = function(storagePanel) |
| 1431 { | 1430 { |
| 1432 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto
r.UIString("Service Worker Cache"), "ServiceWorkerCache", ["service-worker-cache
-storage-tree-item"]); | 1431 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto
r.UIString("Cache Storage"), "CacheStorage", ["service-worker-cache-storage-tree
-item"]); |
| 1433 } | 1432 } |
| 1434 | 1433 |
| 1435 WebInspector.ServiceWorkerCacheTreeElement.prototype = { | 1434 WebInspector.ServiceWorkerCacheTreeElement.prototype = { |
| 1436 _initialize: function() | 1435 _initialize: function() |
| 1437 { | 1436 { |
| 1438 /** @type {!Array.<!WebInspector.SWCacheTreeElement>} */ | 1437 /** @type {!Array.<!WebInspector.SWCacheTreeElement>} */ |
| 1439 this._swCacheTreeElements = []; | 1438 this._swCacheTreeElements = []; |
| 1440 var targets = WebInspector.targetManager.targets(); | 1439 var target = this._storagePanel._target; |
| 1441 for (var i = 0; i < targets.length; ++i) { | 1440 if (target) { |
| 1442 if (!targets[i].serviceWorkerCacheModel) | 1441 var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target); |
| 1443 continue; | 1442 var caches = model.caches(); |
| 1444 var caches = targets[i].serviceWorkerCacheModel.caches(); | 1443 for (var cache of caches) |
| 1445 for (var j = 0; j < caches.length; ++j) | 1444 this._addCache(model, cache); |
| 1446 this._addCache(targets[i].serviceWorkerCacheModel, caches[j]); | |
| 1447 } | 1445 } |
| 1448 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa
cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded, this._cach
eAdded, this); | 1446 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa
cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded, this._cach
eAdded, this); |
| 1449 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa
cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved, this._ca
cheRemoved, this); | 1447 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa
cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved, this._ca
cheRemoved, this); |
| 1450 this._refreshCaches(); | |
| 1451 WebInspector.targetManager.observeTargets(this); | |
| 1452 }, | 1448 }, |
| 1453 | 1449 |
| 1454 onattach: function() | 1450 onattach: function() |
| 1455 { | 1451 { |
| 1456 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); | 1452 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); |
| 1457 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), true); | 1453 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), true); |
| 1458 }, | 1454 }, |
| 1459 | 1455 |
| 1460 /** | |
| 1461 * @override | |
| 1462 * @param {!WebInspector.Target} target | |
| 1463 */ | |
| 1464 targetAdded: function(target) | |
| 1465 { | |
| 1466 if (target.isServiceWorker() && target.serviceWorkerCacheModel) | |
| 1467 this._refreshCaches(); | |
| 1468 }, | |
| 1469 | |
| 1470 /** | |
| 1471 * @override | |
| 1472 * @param {!WebInspector.Target} target | |
| 1473 */ | |
| 1474 targetRemoved: function(target) {}, | |
| 1475 | |
| 1476 _handleContextMenuEvent: function(event) | 1456 _handleContextMenuEvent: function(event) |
| 1477 { | 1457 { |
| 1478 var contextMenu = new WebInspector.ContextMenu(event); | 1458 var contextMenu = new WebInspector.ContextMenu(event); |
| 1479 contextMenu.appendItem(WebInspector.UIString("Refresh Caches"), this._re
freshCaches.bind(this)); | 1459 contextMenu.appendItem(WebInspector.UIString("Refresh Caches"), this._re
freshCaches.bind(this)); |
| 1480 contextMenu.show(); | 1460 contextMenu.show(); |
| 1481 }, | 1461 }, |
| 1482 | 1462 |
| 1483 _refreshCaches: function() | 1463 _refreshCaches: function() |
| 1484 { | 1464 { |
| 1485 var targets = WebInspector.targetManager.targets(); | 1465 var target = this._storagePanel._target; |
| 1486 for (var i = 0; i < targets.length; ++i) { | 1466 if (target) { |
| 1487 if (targets[i].serviceWorkerCacheModel) | 1467 var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target); |
| 1488 targets[i].serviceWorkerCacheModel.refreshCacheNames(); | 1468 model.refreshCacheNames(); |
| 1489 } | 1469 } |
| 1490 }, | 1470 }, |
| 1491 | 1471 |
| 1492 /** | 1472 /** |
| 1493 * @param {!WebInspector.Event} event | 1473 * @param {!WebInspector.Event} event |
| 1494 */ | 1474 */ |
| 1495 _cacheAdded: function(event) | 1475 _cacheAdded: function(event) |
| 1496 { | 1476 { |
| 1497 var cacheId = /** @type {!WebInspector.ServiceWorkerCacheModel.CacheId}
*/ (event.data); | 1477 var cache = /** @type {!WebInspector.ServiceWorkerCacheModel.Cache} */ (
event.data); |
| 1498 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event.
target); | 1478 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event.
target); |
| 1499 this._addCache(model, cacheId); | 1479 this._addCache(model, cache); |
| 1500 }, | 1480 }, |
| 1501 | 1481 |
| 1502 /** | 1482 /** |
| 1503 * @param {!WebInspector.ServiceWorkerCacheModel} model | 1483 * @param {!WebInspector.ServiceWorkerCacheModel} model |
| 1504 * @param {!WebInspector.ServiceWorkerCacheModel.CacheId} cacheId | 1484 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache |
| 1505 */ | 1485 */ |
| 1506 _addCache: function(model, cacheId) | 1486 _addCache: function(model, cache) |
| 1507 { | 1487 { |
| 1508 var swCacheTreeElement = new WebInspector.SWCacheTreeElement(this._stora
gePanel, model, cacheId); | 1488 var swCacheTreeElement = new WebInspector.SWCacheTreeElement(this._stora
gePanel, model, cache); |
| 1509 this._swCacheTreeElements.push(swCacheTreeElement); | 1489 this._swCacheTreeElements.push(swCacheTreeElement); |
| 1510 this.appendChild(swCacheTreeElement); | 1490 this.appendChild(swCacheTreeElement); |
| 1511 }, | 1491 }, |
| 1512 | 1492 |
| 1513 /** | 1493 /** |
| 1514 * @param {!WebInspector.Event} event | 1494 * @param {!WebInspector.Event} event |
| 1515 */ | 1495 */ |
| 1516 _cacheRemoved: function(event) | 1496 _cacheRemoved: function(event) |
| 1517 { | 1497 { |
| 1518 var cacheId = /** @type {!WebInspector.ServiceWorkerCacheModel.CacheId}
*/ (event.data); | 1498 var cache = /** @type {!WebInspector.ServiceWorkerCacheModel.Cache} */ (
event.data); |
| 1519 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event.
target); | 1499 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event.
target); |
| 1520 | 1500 |
| 1521 var swCacheTreeElement = this._cacheTreeElement(model, cacheId); | 1501 var swCacheTreeElement = this._cacheTreeElement(model, cache); |
| 1522 if (!swCacheTreeElement) | 1502 if (!swCacheTreeElement) |
| 1523 return; | 1503 return; |
| 1524 | 1504 |
| 1525 swCacheTreeElement.clear(); | 1505 swCacheTreeElement.clear(); |
| 1526 this.removeChild(swCacheTreeElement); | 1506 this.removeChild(swCacheTreeElement); |
| 1527 this._swCacheTreeElements.remove(swCacheTreeElement); | 1507 this._swCacheTreeElements.remove(swCacheTreeElement); |
| 1528 }, | 1508 }, |
| 1529 | 1509 |
| 1530 /** | 1510 /** |
| 1531 * @param {!WebInspector.ServiceWorkerCacheModel} model | 1511 * @param {!WebInspector.ServiceWorkerCacheModel} model |
| 1532 * @param {!WebInspector.ServiceWorkerCacheModel.CacheId} cacheId | 1512 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache |
| 1533 * @return {?WebInspector.SWCacheTreeElement} | 1513 * @return {?WebInspector.SWCacheTreeElement} |
| 1534 */ | 1514 */ |
| 1535 _cacheTreeElement: function(model, cacheId) | 1515 _cacheTreeElement: function(model, cache) |
| 1536 { | 1516 { |
| 1537 var index = -1; | 1517 var index = -1; |
| 1538 for (var i = 0; i < this._swCacheTreeElements.length; ++i) { | 1518 for (var i = 0; i < this._swCacheTreeElements.length; ++i) { |
| 1539 if (this._swCacheTreeElements[i]._cacheId.equals(cacheId) && this._s
wCacheTreeElements[i]._model === model) { | 1519 if (this._swCacheTreeElements[i]._cache.equals(cache) && this._swCac
heTreeElements[i]._model === model) { |
| 1540 index = i; | 1520 index = i; |
| 1541 break; | 1521 break; |
| 1542 } | 1522 } |
| 1543 } | 1523 } |
| 1544 if (index !== -1) | 1524 if (index !== -1) |
| 1545 return this._swCacheTreeElements[i]; | 1525 return this._swCacheTreeElements[i]; |
| 1546 return null; | 1526 return null; |
| 1547 }, | 1527 }, |
| 1548 | 1528 |
| 1549 __proto__: WebInspector.StorageCategoryTreeElement.prototype | 1529 __proto__: WebInspector.StorageCategoryTreeElement.prototype |
| 1550 } | 1530 } |
| 1551 | 1531 |
| 1552 /** | 1532 /** |
| 1553 * @constructor | 1533 * @constructor |
| 1554 * @extends {WebInspector.BaseStorageTreeElement} | 1534 * @extends {WebInspector.BaseStorageTreeElement} |
| 1555 * @param {!WebInspector.ResourcesPanel} storagePanel | 1535 * @param {!WebInspector.ResourcesPanel} storagePanel |
| 1556 * @param {!WebInspector.ServiceWorkerCacheModel} model | 1536 * @param {!WebInspector.ServiceWorkerCacheModel} model |
| 1557 * @param {!WebInspector.ServiceWorkerCacheModel.CacheId} cacheId | 1537 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache |
| 1558 */ | 1538 */ |
| 1559 WebInspector.SWCacheTreeElement = function(storagePanel, model, cacheId) | 1539 WebInspector.SWCacheTreeElement = function(storagePanel, model, cache) |
| 1560 { | 1540 { |
| 1561 WebInspector.BaseStorageTreeElement.call(this, storagePanel, cacheId.name, [
"service-worker-cache-tree-item"]); | 1541 WebInspector.BaseStorageTreeElement.call(this, storagePanel, cache.cacheName
+ " - " + cache.securityOrigin, ["service-worker-cache-tree-item"]); |
| 1562 this._model = model; | 1542 this._model = model; |
| 1563 this._cacheId = cacheId; | 1543 this._cache = cache; |
| 1564 } | 1544 } |
| 1565 | 1545 |
| 1566 WebInspector.SWCacheTreeElement.prototype = { | 1546 WebInspector.SWCacheTreeElement.prototype = { |
| 1567 get itemURL() | 1547 get itemURL() |
| 1568 { | 1548 { |
| 1569 // I don't think this will work at all. | 1549 // I don't think this will work at all. |
| 1570 return "swcache://" + this._cacheId.name; | 1550 return "cache://" + this._cache.cacheId; |
| 1571 }, | 1551 }, |
| 1572 | 1552 |
| 1573 onattach: function() | 1553 onattach: function() |
| 1574 { | 1554 { |
| 1575 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); | 1555 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); |
| 1576 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), true); | 1556 this.listItemElement.addEventListener("contextmenu", this._handleContext
MenuEvent.bind(this), true); |
| 1577 }, | 1557 }, |
| 1578 | 1558 |
| 1579 _handleContextMenuEvent: function(event) | 1559 _handleContextMenuEvent: function(event) |
| 1580 { | 1560 { |
| 1581 var contextMenu = new WebInspector.ContextMenu(event); | 1561 var contextMenu = new WebInspector.ContextMenu(event); |
| 1582 contextMenu.appendItem(WebInspector.UIString("Delete"), this._clearCache
.bind(this)); | 1562 contextMenu.appendItem(WebInspector.UIString("Delete"), this._clearCache
.bind(this)); |
| 1583 contextMenu.show(); | 1563 contextMenu.show(); |
| 1584 }, | 1564 }, |
| 1585 | 1565 |
| 1586 _clearCache: function() | 1566 _clearCache: function() |
| 1587 { | 1567 { |
| 1588 this._model.deleteCache(this._cacheId); | 1568 this._model.deleteCache(this._cache); |
| 1589 }, | 1569 }, |
| 1590 | 1570 |
| 1591 /** | 1571 /** |
| 1592 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache | 1572 * @param {!WebInspector.ServiceWorkerCacheModel.Cache} cache |
| 1593 */ | 1573 */ |
| 1594 update: function(cache) | 1574 update: function(cache) |
| 1595 { | 1575 { |
| 1596 this._cache = cache; | 1576 this._cache = cache; |
| 1597 if (this._view) | 1577 if (this._view) |
| 1598 this._view.update(cache); | 1578 this._view.update(cache); |
| 1599 }, | 1579 }, |
| 1600 | 1580 |
| 1601 /** | 1581 /** |
| 1602 * @override | 1582 * @override |
| 1603 * @return {boolean} | 1583 * @return {boolean} |
| 1604 */ | 1584 */ |
| 1605 onselect: function(selectedByUser) | 1585 onselect: function(selectedByUser) |
| 1606 { | 1586 { |
| 1607 WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, select
edByUser); | 1587 WebInspector.BaseStorageTreeElement.prototype.onselect.call(this, select
edByUser); |
| 1608 if (!this._view) | 1588 if (!this._view) |
| 1609 this._view = new WebInspector.ServiceWorkerCacheView(this._model, th
is._cacheId, this._cache); | 1589 this._view = new WebInspector.ServiceWorkerCacheView(this._model, th
is._cache); |
| 1610 | 1590 |
| 1611 this._storagePanel.showServiceWorkerCache(this._view); | 1591 this._storagePanel.showServiceWorkerCache(this._view); |
| 1612 return false; | 1592 return false; |
| 1613 }, | 1593 }, |
| 1614 | 1594 |
| 1615 clear: function() | 1595 clear: function() |
| 1616 { | 1596 { |
| 1617 if (this._view) | 1597 if (this._view) |
| 1618 this._view.clear(); | 1598 this._view.clear(); |
| 1619 }, | 1599 }, |
| (...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2435 WebInspector.ResourcesPanelFactory.prototype = { | 2415 WebInspector.ResourcesPanelFactory.prototype = { |
| 2436 /** | 2416 /** |
| 2437 * @override | 2417 * @override |
| 2438 * @return {!WebInspector.Panel} | 2418 * @return {!WebInspector.Panel} |
| 2439 */ | 2419 */ |
| 2440 createPanel: function() | 2420 createPanel: function() |
| 2441 { | 2421 { |
| 2442 return WebInspector.ResourcesPanel._instance(); | 2422 return WebInspector.ResourcesPanel._instance(); |
| 2443 } | 2423 } |
| 2444 } | 2424 } |
| OLD | NEW |