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.serviceWorkerCacheListTreeElement = new WebInspector.ServiceWorkerCache TreeElement(this); | |
70 this._sidebarTree.appendChild(this.serviceWorkerCacheListTreeElement); | |
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._storageViewStatusBar = new WebInspector.StatusBar(mainView.element); | 79 this._storageViewStatusBar = new WebInspector.StatusBar(mainView.element); |
77 this._storageViewStatusBar.element.classList.add("resources-status-bar"); | 80 this._storageViewStatusBar.element.classList.add("resources-status-bar"); |
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 20 matching lines...) Expand all Loading... | |
160 this._databaseModel.removeEventListener(WebInspector.DatabaseModel.Event s.DatabaseAdded, this._databaseAdded, this); | 158 this._databaseModel.removeEventListener(WebInspector.DatabaseModel.Event s.DatabaseAdded, this._databaseAdded, this); |
161 | 159 |
162 this._resetWithFrames(); | 160 this._resetWithFrames(); |
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 WebInspector.IndexedDBModel.fromTarget(this._target).enable(); | 167 WebInspector.IndexedDBModel.fromTarget(this._target).enable(); |
168 WebInspector.ServiceWorkerCacheModel.fromTarget(this._target).enable(); | |
170 | 169 |
171 if (this._target.isPage()) | 170 if (this._target.isPage()) |
172 this._populateResourceTree(); | 171 this._populateResourceTree(); |
173 this._populateDOMStorageTree(); | 172 this._populateDOMStorageTree(); |
174 this._populateApplicationCacheTree(); | 173 this._populateApplicationCacheTree(); |
175 this.indexedDBListTreeElement._initialize(); | 174 this.indexedDBListTreeElement._initialize(); |
176 if (this.serviceWorkerCacheListTreeElement) | 175 if (this.serviceWorkerCacheListTreeElement) |
177 this.serviceWorkerCacheListTreeElement._initialize(); | 176 this.serviceWorkerCacheListTreeElement._initialize(); |
178 if (Runtime.experiments.isEnabled("fileSystemInspection")) | 177 if (Runtime.experiments.isEnabled("fileSystemInspection")) |
179 this.fileSystemListTreeElement._initialize(); | 178 this.fileSystemListTreeElement._initialize(); |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1415 }, | 1414 }, |
1416 | 1415 |
1417 __proto__: WebInspector.BaseStorageTreeElement.prototype | 1416 __proto__: WebInspector.BaseStorageTreeElement.prototype |
1418 } | 1417 } |
1419 | 1418 |
1420 | 1419 |
1421 /** | 1420 /** |
1422 * @constructor | 1421 * @constructor |
1423 * @extends {WebInspector.StorageCategoryTreeElement} | 1422 * @extends {WebInspector.StorageCategoryTreeElement} |
1424 * @param {!WebInspector.ResourcesPanel} storagePanel | 1423 * @param {!WebInspector.ResourcesPanel} storagePanel |
1425 * @implements {WebInspector.TargetManager.Observer} | |
1426 */ | 1424 */ |
1427 WebInspector.ServiceWorkerCacheTreeElement = function(storagePanel) | 1425 WebInspector.ServiceWorkerCacheTreeElement = function(storagePanel) |
1428 { | 1426 { |
1429 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto r.UIString("Service Worker Cache"), "ServiceWorkerCache", ["service-worker-cache -storage-tree-item"]); | 1427 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto r.UIString("Cache Storage"), "CacheStorage", ["service-worker-cache-storage-tree -item"]); |
1430 } | 1428 } |
1431 | 1429 |
1432 WebInspector.ServiceWorkerCacheTreeElement.prototype = { | 1430 WebInspector.ServiceWorkerCacheTreeElement.prototype = { |
1433 _initialize: function() | 1431 _initialize: function() |
1434 { | 1432 { |
1435 /** @type {!Array.<!WebInspector.SWCacheTreeElement>} */ | 1433 /** @type {!Array.<!WebInspector.SWCacheTreeElement>} */ |
1436 this._swCacheTreeElements = []; | 1434 this._swCacheTreeElements = []; |
1437 var targets = WebInspector.targetManager.targets(); | 1435 var targets = WebInspector.targetManager.targets(); |
1438 for (var i = 0; i < targets.length; ++i) { | 1436 for (var target of targets) { |
pfeldman
2015/04/02 21:18:57
You can directly access the WebInspector.targetMan
dmurph
2015/04/02 23:23:17
done
| |
1439 if (!targets[i].serviceWorkerCacheModel) | 1437 var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target); |
1440 continue; | 1438 if (!model.isEnabled()) { |
1441 var caches = targets[i].serviceWorkerCacheModel.caches(); | 1439 continue; |
1442 for (var j = 0; j < caches.length; ++j) | 1440 } |
1443 this._addCache(targets[i].serviceWorkerCacheModel, caches[j]); | 1441 var caches = model.caches(); |
1442 for (var cache of caches) | |
1443 this._addCache(model, cache); | |
1444 } | 1444 } |
1445 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded, this._cach eAdded, this); | 1445 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded, this._cach eAdded, this); |
1446 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved, this._ca cheRemoved, this); | 1446 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved, this._ca cheRemoved, this); |
1447 this._refreshCaches(); | |
1448 WebInspector.targetManager.observeTargets(this); | |
1449 }, | 1447 }, |
1450 | 1448 |
1451 onattach: function() | 1449 onattach: function() |
1452 { | 1450 { |
1453 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); | 1451 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); |
1454 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); | 1452 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); |
1455 }, | 1453 }, |
1456 | 1454 |
1457 /** | |
1458 * @override | |
1459 * @param {!WebInspector.Target} target | |
1460 */ | |
1461 targetAdded: function(target) | |
1462 { | |
1463 if (target.isServiceWorker() && target.serviceWorkerCacheModel) | |
1464 this._refreshCaches(); | |
1465 }, | |
1466 | |
1467 /** | |
1468 * @override | |
1469 * @param {!WebInspector.Target} target | |
1470 */ | |
1471 targetRemoved: function(target) {}, | |
1472 | |
1473 _handleContextMenuEvent: function(event) | 1455 _handleContextMenuEvent: function(event) |
1474 { | 1456 { |
1475 var contextMenu = new WebInspector.ContextMenu(event); | 1457 var contextMenu = new WebInspector.ContextMenu(event); |
1476 contextMenu.appendItem(WebInspector.UIString("Refresh Caches"), this._re freshCaches.bind(this)); | 1458 contextMenu.appendItem(WebInspector.UIString("Refresh Caches"), this._re freshCaches.bind(this)); |
1477 contextMenu.show(); | 1459 contextMenu.show(); |
1478 }, | 1460 }, |
1479 | 1461 |
1480 _refreshCaches: function() | 1462 _refreshCaches: function() |
1481 { | 1463 { |
1482 var targets = WebInspector.targetManager.targets(); | 1464 var targets = WebInspector.targetManager.targets(); |
1483 for (var i = 0; i < targets.length; ++i) { | 1465 for (var target of targets) |
pfeldman
2015/04/02 21:18:57
ditto
dmurph
2015/04/02 23:23:17
Done.
| |
1484 if (targets[i].serviceWorkerCacheModel) | 1466 WebInspector.ServiceWorkerCacheModel.fromTarget(target).refreshCache Names(); |
1485 targets[i].serviceWorkerCacheModel.refreshCacheNames(); | |
1486 } | |
1487 }, | 1467 }, |
1488 | 1468 |
1489 /** | 1469 /** |
1490 * @param {!WebInspector.Event} event | 1470 * @param {!WebInspector.Event} event |
1491 */ | 1471 */ |
1492 _cacheAdded: function(event) | 1472 _cacheAdded: function(event) |
1493 { | 1473 { |
1494 var cacheId = /** @type {!WebInspector.ServiceWorkerCacheModel.CacheId} */ (event.data); | 1474 var cacheId = /** @type {!WebInspector.ServiceWorkerCacheModel.CacheId} */ (event.data); |
1495 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event. target); | 1475 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event. target); |
1496 this._addCache(model, cacheId); | 1476 this._addCache(model, cacheId); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1548 | 1528 |
1549 /** | 1529 /** |
1550 * @constructor | 1530 * @constructor |
1551 * @extends {WebInspector.BaseStorageTreeElement} | 1531 * @extends {WebInspector.BaseStorageTreeElement} |
1552 * @param {!WebInspector.ResourcesPanel} storagePanel | 1532 * @param {!WebInspector.ResourcesPanel} storagePanel |
1553 * @param {!WebInspector.ServiceWorkerCacheModel} model | 1533 * @param {!WebInspector.ServiceWorkerCacheModel} model |
1554 * @param {!WebInspector.ServiceWorkerCacheModel.CacheId} cacheId | 1534 * @param {!WebInspector.ServiceWorkerCacheModel.CacheId} cacheId |
1555 */ | 1535 */ |
1556 WebInspector.SWCacheTreeElement = function(storagePanel, model, cacheId) | 1536 WebInspector.SWCacheTreeElement = function(storagePanel, model, cacheId) |
1557 { | 1537 { |
1558 WebInspector.BaseStorageTreeElement.call(this, storagePanel, cacheId.name, [ "service-worker-cache-tree-item"]); | 1538 WebInspector.BaseStorageTreeElement.call(this, storagePanel, cacheId.name + " - " + cacheId.securityOrigin, ["service-worker-cache-tree-item"]); |
1559 this._model = model; | 1539 this._model = model; |
1560 this._cacheId = cacheId; | 1540 this._cacheId = cacheId; |
1561 } | 1541 } |
1562 | 1542 |
1563 WebInspector.SWCacheTreeElement.prototype = { | 1543 WebInspector.SWCacheTreeElement.prototype = { |
1564 get itemURL() | 1544 get itemURL() |
1565 { | 1545 { |
1566 // I don't think this will work at all. | 1546 // I don't think this will work at all. |
1567 return "swcache://" + this._cacheId.name; | 1547 return "swcache://" + this._cacheId.name; |
1568 }, | 1548 }, |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2432 WebInspector.ResourcesPanelFactory.prototype = { | 2412 WebInspector.ResourcesPanelFactory.prototype = { |
2433 /** | 2413 /** |
2434 * @override | 2414 * @override |
2435 * @return {!WebInspector.Panel} | 2415 * @return {!WebInspector.Panel} |
2436 */ | 2416 */ |
2437 createPanel: function() | 2417 createPanel: function() |
2438 { | 2418 { |
2439 return WebInspector.ResourcesPanel._instance(); | 2419 return WebInspector.ResourcesPanel._instance(); |
2440 } | 2420 } |
2441 } | 2421 } |
OLD | NEW |