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._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 this.cacheStorageListTreeElement._initialize(); |
177 this.serviceWorkerCacheListTreeElement._initialize(); | |
178 if (Runtime.experiments.isEnabled("fileSystemInspection")) | 176 if (Runtime.experiments.isEnabled("fileSystemInspection")) |
179 this.fileSystemListTreeElement._initialize(); | 177 this.fileSystemListTreeElement._initialize(); |
180 this._initDefaultSelection(); | 178 this._initDefaultSelection(); |
181 this._initialized = true; | 179 this._initialized = true; |
182 }, | 180 }, |
183 | 181 |
184 _loadEventFired: function() | 182 _loadEventFired: function() |
185 { | 183 { |
186 this._initDefaultSelection(); | 184 this._initDefaultSelection(); |
187 }, | 185 }, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 this._databaseQueryViews.clear(); | 224 this._databaseQueryViews.clear(); |
227 this._databaseTreeElements.clear(); | 225 this._databaseTreeElements.clear(); |
228 this._domStorageViews.clear(); | 226 this._domStorageViews.clear(); |
229 this._domStorageTreeElements.clear(); | 227 this._domStorageTreeElements.clear(); |
230 this._cookieViews = {}; | 228 this._cookieViews = {}; |
231 | 229 |
232 this.databasesListTreeElement.removeChildren(); | 230 this.databasesListTreeElement.removeChildren(); |
233 this.localStorageListTreeElement.removeChildren(); | 231 this.localStorageListTreeElement.removeChildren(); |
234 this.sessionStorageListTreeElement.removeChildren(); | 232 this.sessionStorageListTreeElement.removeChildren(); |
235 this.cookieListTreeElement.removeChildren(); | 233 this.cookieListTreeElement.removeChildren(); |
236 if (this.serviceWorkerCacheListTreeElement) | 234 this.cacheStorageListTreeElement.removeChildren(); |
237 this.serviceWorkerCacheListTreeElement.removeChildren(); | |
238 | 235 |
239 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora geCategoryView)) | 236 if (this.visibleView && !(this.visibleView instanceof WebInspector.Stora geCategoryView)) |
240 this.visibleView.detach(); | 237 this.visibleView.detach(); |
241 | 238 |
242 this._storageViewStatusBar.removeStatusBarItems(); | 239 this._storageViewStatusBar.removeStatusBarItems(); |
243 | 240 |
244 if (this._sidebarTree.selectedTreeElement) | 241 if (this._sidebarTree.selectedTreeElement) |
245 this._sidebarTree.selectedTreeElement.deselect(); | 242 this._sidebarTree.selectedTreeElement.deselect(); |
246 }, | 243 }, |
247 | 244 |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1414 }, | 1411 }, |
1415 | 1412 |
1416 __proto__: WebInspector.BaseStorageTreeElement.prototype | 1413 __proto__: WebInspector.BaseStorageTreeElement.prototype |
1417 } | 1414 } |
1418 | 1415 |
1419 | 1416 |
1420 /** | 1417 /** |
1421 * @constructor | 1418 * @constructor |
1422 * @extends {WebInspector.StorageCategoryTreeElement} | 1419 * @extends {WebInspector.StorageCategoryTreeElement} |
1423 * @param {!WebInspector.ResourcesPanel} storagePanel | 1420 * @param {!WebInspector.ResourcesPanel} storagePanel |
1424 * @implements {WebInspector.TargetManager.Observer} | |
1425 */ | 1421 */ |
1426 WebInspector.ServiceWorkerCacheTreeElement = function(storagePanel) | 1422 WebInspector.ServiceWorkerCacheTreeElement = function(storagePanel) |
1427 { | 1423 { |
1428 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto r.UIString("Service Worker Cache"), "ServiceWorkerCache", ["service-worker-cache -storage-tree-item"]); | 1424 WebInspector.StorageCategoryTreeElement.call(this, storagePanel, WebInspecto r.UIString("Cache Storage"), "CacheStorage", ["service-worker-cache-storage-tree -item"]); |
1429 } | 1425 } |
1430 | 1426 |
1431 WebInspector.ServiceWorkerCacheTreeElement.prototype = { | 1427 WebInspector.ServiceWorkerCacheTreeElement.prototype = { |
1432 _initialize: function() | 1428 _initialize: function() |
1433 { | 1429 { |
1434 /** @type {!Array.<!WebInspector.SWCacheTreeElement>} */ | 1430 /** @type {!Array.<!WebInspector.SWCacheTreeElement>} */ |
1435 this._swCacheTreeElements = []; | 1431 this._swCacheTreeElements = []; |
1436 var targets = WebInspector.targetManager.targets(); | 1432 var target = WebInspector.targetManager.mainTarget(); |
pfeldman
2015/04/16 10:22:52
Nit: var target = this._storagePanel._target;
dmurph
2015/04/18 00:59:31
Done.
| |
1437 for (var i = 0; i < targets.length; ++i) { | 1433 if (target) { |
1438 if (!targets[i].serviceWorkerCacheModel) | 1434 var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target); |
1439 continue; | 1435 var caches = model.caches(); |
1440 var caches = targets[i].serviceWorkerCacheModel.caches(); | 1436 for (var cache of caches) |
1441 for (var j = 0; j < caches.length; ++j) | 1437 this._addCache(model, cache); |
1442 this._addCache(targets[i].serviceWorkerCacheModel, caches[j]); | |
1443 } | 1438 } |
1444 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded, this._cach eAdded, this); | 1439 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheAdded, this._cach eAdded, this); |
1445 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved, this._ca cheRemoved, this); | 1440 WebInspector.targetManager.addModelListener(WebInspector.ServiceWorkerCa cheModel, WebInspector.ServiceWorkerCacheModel.EventTypes.CacheRemoved, this._ca cheRemoved, this); |
1446 this._refreshCaches(); | |
1447 WebInspector.targetManager.observeTargets(this); | |
1448 }, | 1441 }, |
1449 | 1442 |
1450 onattach: function() | 1443 onattach: function() |
1451 { | 1444 { |
1452 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); | 1445 WebInspector.StorageCategoryTreeElement.prototype.onattach.call(this); |
1453 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); | 1446 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); |
1454 }, | 1447 }, |
1455 | 1448 |
1456 /** | |
1457 * @override | |
1458 * @param {!WebInspector.Target} target | |
1459 */ | |
1460 targetAdded: function(target) | |
1461 { | |
1462 if (target.isServiceWorker() && target.serviceWorkerCacheModel) | |
1463 this._refreshCaches(); | |
1464 }, | |
1465 | |
1466 /** | |
1467 * @override | |
1468 * @param {!WebInspector.Target} target | |
1469 */ | |
1470 targetRemoved: function(target) {}, | |
1471 | |
1472 _handleContextMenuEvent: function(event) | 1449 _handleContextMenuEvent: function(event) |
1473 { | 1450 { |
1474 var contextMenu = new WebInspector.ContextMenu(event); | 1451 var contextMenu = new WebInspector.ContextMenu(event); |
1475 contextMenu.appendItem(WebInspector.UIString("Refresh Caches"), this._re freshCaches.bind(this)); | 1452 contextMenu.appendItem(WebInspector.UIString("Refresh Caches"), this._re freshCaches.bind(this)); |
1476 contextMenu.show(); | 1453 contextMenu.show(); |
1477 }, | 1454 }, |
1478 | 1455 |
1479 _refreshCaches: function() | 1456 _refreshCaches: function() |
1480 { | 1457 { |
1481 var targets = WebInspector.targetManager.targets(); | 1458 var target = WebInspector.targetManager.mainTarget(); |
pfeldman
2015/04/16 10:22:52
ditto
dmurph
2015/04/18 00:59:31
Done.
| |
1482 for (var i = 0; i < targets.length; ++i) { | 1459 if (target) { |
1483 if (targets[i].serviceWorkerCacheModel) | 1460 var model = WebInspector.ServiceWorkerCacheModel.fromTarget(target); |
1484 targets[i].serviceWorkerCacheModel.refreshCacheNames(); | 1461 model.refreshCacheNames(); |
1485 } | 1462 } |
1486 }, | 1463 }, |
1487 | 1464 |
1488 /** | 1465 /** |
1489 * @param {!WebInspector.Event} event | 1466 * @param {!WebInspector.Event} event |
1490 */ | 1467 */ |
1491 _cacheAdded: function(event) | 1468 _cacheAdded: function(event) |
1492 { | 1469 { |
1493 var cacheId = /** @type {!WebInspector.ServiceWorkerCacheModel.CacheId} */ (event.data); | 1470 var cacheId = /** @type {!WebInspector.ServiceWorkerCacheModel.CacheId} */ (event.data); |
1494 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event. target); | 1471 var model = /** @type {!WebInspector.ServiceWorkerCacheModel} */ (event. target); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1547 | 1524 |
1548 /** | 1525 /** |
1549 * @constructor | 1526 * @constructor |
1550 * @extends {WebInspector.BaseStorageTreeElement} | 1527 * @extends {WebInspector.BaseStorageTreeElement} |
1551 * @param {!WebInspector.ResourcesPanel} storagePanel | 1528 * @param {!WebInspector.ResourcesPanel} storagePanel |
1552 * @param {!WebInspector.ServiceWorkerCacheModel} model | 1529 * @param {!WebInspector.ServiceWorkerCacheModel} model |
1553 * @param {!WebInspector.ServiceWorkerCacheModel.CacheId} cacheId | 1530 * @param {!WebInspector.ServiceWorkerCacheModel.CacheId} cacheId |
1554 */ | 1531 */ |
1555 WebInspector.SWCacheTreeElement = function(storagePanel, model, cacheId) | 1532 WebInspector.SWCacheTreeElement = function(storagePanel, model, cacheId) |
1556 { | 1533 { |
1557 WebInspector.BaseStorageTreeElement.call(this, storagePanel, cacheId.name, [ "service-worker-cache-tree-item"]); | 1534 WebInspector.BaseStorageTreeElement.call(this, storagePanel, cacheId.cacheNa me + " - " + cacheId.securityOrigin, ["service-worker-cache-tree-item"]); |
1558 this._model = model; | 1535 this._model = model; |
1559 this._cacheId = cacheId; | 1536 this._cacheId = cacheId; |
1560 } | 1537 } |
1561 | 1538 |
1562 WebInspector.SWCacheTreeElement.prototype = { | 1539 WebInspector.SWCacheTreeElement.prototype = { |
1563 get itemURL() | 1540 get itemURL() |
1564 { | 1541 { |
1565 // I don't think this will work at all. | 1542 // I don't think this will work at all. |
1566 return "swcache://" + this._cacheId.name; | 1543 return "cache://" + this._cacheId.toString(); |
1567 }, | 1544 }, |
1568 | 1545 |
1569 onattach: function() | 1546 onattach: function() |
1570 { | 1547 { |
1571 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); | 1548 WebInspector.BaseStorageTreeElement.prototype.onattach.call(this); |
1572 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); | 1549 this.listItemElement.addEventListener("contextmenu", this._handleContext MenuEvent.bind(this), true); |
1573 }, | 1550 }, |
1574 | 1551 |
1575 _handleContextMenuEvent: function(event) | 1552 _handleContextMenuEvent: function(event) |
1576 { | 1553 { |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2431 WebInspector.ResourcesPanelFactory.prototype = { | 2408 WebInspector.ResourcesPanelFactory.prototype = { |
2432 /** | 2409 /** |
2433 * @override | 2410 * @override |
2434 * @return {!WebInspector.Panel} | 2411 * @return {!WebInspector.Panel} |
2435 */ | 2412 */ |
2436 createPanel: function() | 2413 createPanel: function() |
2437 { | 2414 { |
2438 return WebInspector.ResourcesPanel._instance(); | 2415 return WebInspector.ResourcesPanel._instance(); |
2439 } | 2416 } |
2440 } | 2417 } |
OLD | NEW |