OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> | 3 * Copyright (C) 2008, 2009 Anthony Ricaud <rik@webkit.org> |
4 * Copyright (C) 2011 Google Inc. All rights reserved. | 4 * Copyright (C) 2011 Google Inc. 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 10 matching lines...) Expand all Loading... |
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 22 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
| 31 importScript("FilterSuggestionBuilder.js"); |
31 importScript("RequestView.js"); | 32 importScript("RequestView.js"); |
32 importScript("NetworkItemView.js"); | 33 importScript("NetworkItemView.js"); |
33 importScript("RequestCookiesView.js"); | 34 importScript("RequestCookiesView.js"); |
34 importScript("RequestHeadersView.js"); | 35 importScript("RequestHeadersView.js"); |
35 importScript("RequestHTMLView.js"); | 36 importScript("RequestHTMLView.js"); |
36 importScript("RequestJSONView.js"); | 37 importScript("RequestJSONView.js"); |
37 importScript("RequestPreviewView.js"); | 38 importScript("RequestPreviewView.js"); |
38 importScript("RequestResponseView.js"); | 39 importScript("RequestResponseView.js"); |
39 importScript("RequestTimingView.js"); | 40 importScript("RequestTimingView.js"); |
40 importScript("ResourceWebSocketFrameView.js"); | 41 importScript("ResourceWebSocketFrameView.js"); |
41 | 42 |
42 /** | 43 /** |
43 * @constructor | 44 * @constructor |
44 * @implements {WebInspector.Searchable} | 45 * @implements {WebInspector.Searchable} |
45 * @extends {WebInspector.View} | 46 * @extends {WebInspector.View} |
46 * @param {!WebInspector.FilterBar} filterBar | 47 * @param {!WebInspector.FilterBar} filterBar |
47 * @param {!WebInspector.Setting} coulmnsVisibilitySetting | 48 * @param {!WebInspector.Setting} coulmnsVisibilitySetting |
48 */ | 49 */ |
49 WebInspector.NetworkLogView = function(filterBar, coulmnsVisibilitySetting) | 50 WebInspector.NetworkLogView = function(filterBar, coulmnsVisibilitySetting) |
50 { | 51 { |
51 WebInspector.View.call(this); | 52 WebInspector.View.call(this); |
52 this.registerRequiredCSS("networkLogView.css"); | 53 this.registerRequiredCSS("networkLogView.css"); |
53 this.registerRequiredCSS("filter.css"); | 54 this.registerRequiredCSS("filter.css"); |
| 55 this.registerRequiredCSS("textPrompt.css"); |
54 | 56 |
55 this._filterBar = filterBar; | 57 this._filterBar = filterBar; |
56 this._coulmnsVisibilitySetting = coulmnsVisibilitySetting; | 58 this._coulmnsVisibilitySetting = coulmnsVisibilitySetting; |
57 this._allowRequestSelection = false; | 59 this._allowRequestSelection = false; |
58 this._requests = []; | 60 this._requests = []; |
59 this._requestsById = {}; | 61 this._requestsById = {}; |
60 this._requestsByURL = {}; | 62 this._requestsByURL = {}; |
61 this._staleRequests = {}; | 63 this._staleRequests = {}; |
62 this._requestGridNodes = {}; | 64 this._requestGridNodes = {}; |
63 this._lastRequestGridNodeId = 0; | 65 this._lastRequestGridNodeId = 0; |
64 this._mainRequestLoadTime = -1; | 66 this._mainRequestLoadTime = -1; |
65 this._mainRequestDOMContentLoadedTime = -1; | 67 this._mainRequestDOMContentLoadedTime = -1; |
66 this._matchedRequests = []; | 68 this._matchedRequests = []; |
67 this._highlightedSubstringChanges = []; | 69 this._highlightedSubstringChanges = []; |
68 this._filteredOutRequests = new Map(); | 70 this._filteredOutRequests = new Map(); |
69 | 71 |
| 72 /** @type {!Array.<!WebInspector.NetworkLogView.Filter>} */ |
| 73 this._filters = []; |
| 74 |
70 this._matchedRequestsMap = {}; | 75 this._matchedRequestsMap = {}; |
71 this._currentMatchedRequestIndex = -1; | 76 this._currentMatchedRequestIndex = -1; |
72 | 77 |
73 this._createStatusbarButtons(); | 78 this._createStatusbarButtons(); |
74 this._createStatusBarItems(); | 79 this._createStatusBarItems(); |
75 this._linkifier = new WebInspector.Linkifier(); | 80 this._linkifier = new WebInspector.Linkifier(); |
76 | 81 |
77 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestStarted, this._onRequestStarted, this); | 82 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestStarted, this._onRequestStarted, this); |
78 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestUpdated, this._onRequestUpdated, this); | 83 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestUpdated, this._onRequestUpdated, this); |
79 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestFinished, this._onRequestUpdated, this); | 84 WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.Eve
ntTypes.RequestFinished, this._onRequestUpdated, this); |
80 | 85 |
81 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.WillReloadPage, this._willReloadPage, this); | 86 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.WillReloadPage, this._willReloadPage, this); |
82 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); | 87 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); |
83 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.Load, this._loadEventFired, this); | 88 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.Load, this._loadEventFired, this); |
84 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); | 89 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeMod
el.EventTypes.DOMContentLoaded, this._domContentLoadedEventFired, this); |
85 | 90 |
86 this._addFilters(); | 91 this._addFilters(); |
| 92 this._resetSuggestionBuilder(); |
87 this._initializeView(); | 93 this._initializeView(); |
88 this._recordButton.toggled = true; | 94 this._recordButton.toggled = true; |
89 WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this)); | 95 WebInspector.networkLog.requests.forEach(this._appendRequest.bind(this)); |
90 } | 96 } |
91 | 97 |
92 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr
ue, "wss": true}; | 98 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr
ue, "wss": true}; |
93 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti
on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified"
, "Server", "Vary"]; | 99 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti
on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified"
, "Server", "Vary"]; |
94 WebInspector.NetworkLogView._defaultColumnsVisibility = { | 100 WebInspector.NetworkLogView._defaultColumnsVisibility = { |
95 method: true, status: true, scheme: false, domain: false, remoteAddress: fal
se, type: true, initiator: true, cookies: false, setCookies: false, size: true,
time: true, | 101 method: true, status: true, scheme: false, domain: false, remoteAddress: fal
se, type: true, initiator: true, cookies: false, setCookies: false, size: true,
time: true, |
96 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con
tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false,
"Server": false, "Vary": false | 102 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con
tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false,
"Server": false, "Vary": false |
(...skipping 14 matching lines...) Expand all Loading... |
111 } | 117 } |
112 this._resourceTypeFilterUI.addEventListener(WebInspector.FilterUI.Events
.FilterChanged, this._filterChanged.bind(this), this); | 118 this._resourceTypeFilterUI.addEventListener(WebInspector.FilterUI.Events
.FilterChanged, this._filterChanged.bind(this), this); |
113 this._filterBar.addFilter(this._resourceTypeFilterUI); | 119 this._filterBar.addFilter(this._resourceTypeFilterUI); |
114 | 120 |
115 var dataURLSetting = WebInspector.settings.networkHideDataURL; | 121 var dataURLSetting = WebInspector.settings.networkHideDataURL; |
116 this._dataURLFilterUI = new WebInspector.CheckboxFilterUI("hide-data-url
", WebInspector.UIString("Hide data URLs"), true, dataURLSetting); | 122 this._dataURLFilterUI = new WebInspector.CheckboxFilterUI("hide-data-url
", WebInspector.UIString("Hide data URLs"), true, dataURLSetting); |
117 this._dataURLFilterUI.addEventListener(WebInspector.FilterUI.Events.Filt
erChanged, this._filterChanged.bind(this), this); | 123 this._dataURLFilterUI.addEventListener(WebInspector.FilterUI.Events.Filt
erChanged, this._filterChanged.bind(this), this); |
118 this._filterBar.addFilter(this._dataURLFilterUI); | 124 this._filterBar.addFilter(this._dataURLFilterUI); |
119 }, | 125 }, |
120 | 126 |
| 127 _resetSuggestionBuilder: function() |
| 128 { |
| 129 this._suggestionBuilder = new WebInspector.FilterSuggestionBuilder(WebIn
spector.NetworkPanel._searchKeys); |
| 130 this._textFilterUI.setSuggestionBuilder(this._suggestionBuilder); |
| 131 }, |
| 132 |
121 _filterChanged: function(event) | 133 _filterChanged: function(event) |
122 { | 134 { |
123 this._removeAllNodeHighlights(); | 135 this._removeAllNodeHighlights(); |
124 this.searchCanceled(); | 136 this.searchCanceled(); |
| 137 this._parseFilterQuery(this._textFilterUI.value()); |
125 this._filterRequests(); | 138 this._filterRequests(); |
126 }, | 139 }, |
127 | 140 |
128 _initializeView: function() | 141 _initializeView: function() |
129 { | 142 { |
130 this.element.id = "network-container"; | 143 this.element.id = "network-container"; |
131 | 144 |
132 this._createSortingFunctions(); | 145 this._createSortingFunctions(); |
133 this._createTable(); | 146 this._createTable(); |
134 this._createTimelineGrid(); | 147 this._createTimelineGrid(); |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 this._popoverHelper.hidePopover(); | 749 this._popoverHelper.hidePopover(); |
737 | 750 |
738 if (this._calculator) | 751 if (this._calculator) |
739 this._calculator.reset(); | 752 this._calculator.reset(); |
740 | 753 |
741 this._requests = []; | 754 this._requests = []; |
742 this._requestsById = {}; | 755 this._requestsById = {}; |
743 this._requestsByURL = {}; | 756 this._requestsByURL = {}; |
744 this._staleRequests = {}; | 757 this._staleRequests = {}; |
745 this._requestGridNodes = {}; | 758 this._requestGridNodes = {}; |
| 759 this._resetSuggestionBuilder(); |
746 | 760 |
747 if (this._dataGrid) { | 761 if (this._dataGrid) { |
748 this._dataGrid.rootNode().removeChildren(); | 762 this._dataGrid.rootNode().removeChildren(); |
749 this._updateDividersIfNeeded(); | 763 this._updateDividersIfNeeded(); |
750 this._updateSummaryBar(); | 764 this._updateSummaryBar(); |
751 } | 765 } |
752 | 766 |
753 this._mainRequestLoadTime = -1; | 767 this._mainRequestLoadTime = -1; |
754 this._mainRequestDOMContentLoadedTime = -1; | 768 this._mainRequestDOMContentLoadedTime = -1; |
755 }, | 769 }, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 this._refreshRequest(request); | 813 this._refreshRequest(request); |
800 }, | 814 }, |
801 | 815 |
802 /** | 816 /** |
803 * @param {!WebInspector.NetworkRequest} request | 817 * @param {!WebInspector.NetworkRequest} request |
804 */ | 818 */ |
805 _refreshRequest: function(request) | 819 _refreshRequest: function(request) |
806 { | 820 { |
807 if (!this._requestsById[request.requestId]) | 821 if (!this._requestsById[request.requestId]) |
808 return; | 822 return; |
| 823 |
| 824 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType.Dom
ain, request.domain); |
| 825 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType.Mim
eType, request.mimeType); |
| 826 |
| 827 var responseHeaders = request.responseHeaders; |
| 828 for (var i = 0, l = responseHeaders.length; i < l; ++i) |
| 829 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType
.HasResponseHeader, responseHeaders[i].name); |
| 830 var cookies = request.responseCookies; |
| 831 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) { |
| 832 var cookie = cookies[i]; |
| 833 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType
.SetCookieDomain, cookie.domain()); |
| 834 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType
.SetCookieName, cookie.name()); |
| 835 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType
.SetCookieValue, cookie.value()); |
| 836 } |
| 837 |
809 this._staleRequests[request.requestId] = request; | 838 this._staleRequests[request.requestId] = request; |
810 this._scheduleRefresh(); | 839 this._scheduleRefresh(); |
811 }, | 840 }, |
812 | 841 |
813 _willReloadPage: function(event) | 842 _willReloadPage: function(event) |
814 { | 843 { |
815 this._recordButton.toggled = true; | 844 this._recordButton.toggled = true; |
816 if (!this._preserveLogCheckbox.checked()) | 845 if (!this._preserveLogCheckbox.checked()) |
817 this._reset(); | 846 this._reset(); |
818 }, | 847 }, |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchCountUpdated, this._matchedRequests.length); | 1313 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea
rchCountUpdated, this._matchedRequests.length); |
1285 if (shouldJump) | 1314 if (shouldJump) |
1286 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, tr
ue); | 1315 this._highlightNthMatchedRequestForSearch(newMatchedRequestIndex, tr
ue); |
1287 }, | 1316 }, |
1288 | 1317 |
1289 /** | 1318 /** |
1290 * @param {!WebInspector.NetworkDataGridNode} node | 1319 * @param {!WebInspector.NetworkDataGridNode} node |
1291 */ | 1320 */ |
1292 _applyFilter: function(node) | 1321 _applyFilter: function(node) |
1293 { | 1322 { |
1294 var filter = this._textFilterUI.regex(); | |
1295 var request = node._request; | 1323 var request = node._request; |
1296 | 1324 var matches = this._resourceTypeFilterUI.accept(request.type.name()); |
1297 var matches = true; | |
1298 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL()) | 1325 if (this._dataURLFilterUI.checked() && request.parsedURL.isDataURL()) |
1299 matches = false; | 1326 matches = false; |
1300 if (matches && !this._resourceTypeFilterUI.accept(request.type.name())) | 1327 for (var i = 0; matches && (i < this._filters.length); ++i) |
1301 matches = false; | 1328 matches = this._filters[i](request); |
1302 | |
1303 if (matches && filter) { | |
1304 matches = filter.test(request.name()) || filter.test(request.path())
; | |
1305 if (matches) | |
1306 this._highlightMatchedRequest(request, false, filter); | |
1307 } | |
1308 | 1329 |
1309 node.element.enableStyleClass("filtered-out", !matches); | 1330 node.element.enableStyleClass("filtered-out", !matches); |
1310 if (matches) | 1331 if (matches) |
1311 this._filteredOutRequests.remove(request); | 1332 this._filteredOutRequests.remove(request); |
1312 else | 1333 else |
1313 this._filteredOutRequests.put(request, true); | 1334 this._filteredOutRequests.put(request, true); |
1314 }, | 1335 }, |
1315 | 1336 |
| 1337 /** |
| 1338 * @param {string} query |
| 1339 */ |
| 1340 _parseFilterQuery: function(query) |
| 1341 { |
| 1342 var parsedQuery = this._suggestionBuilder.parseQuery(query); |
| 1343 this._filters = parsedQuery.text.map(this._createTextFilter); |
| 1344 for (var key in parsedQuery.filters) { |
| 1345 var filterType = /** @type {!WebInspector.NetworkPanel.FilterType} *
/ (key); |
| 1346 this._filters.push(this._createFilter(filterType, parsedQuery.filter
s[key])); |
| 1347 } |
| 1348 }, |
| 1349 |
| 1350 /** |
| 1351 * @param {string} text |
| 1352 * @return {!WebInspector.NetworkLogView.Filter} |
| 1353 */ |
| 1354 _createTextFilter: function(text) |
| 1355 { |
| 1356 var regexp = new RegExp(text.escapeForRegExp(), "i"); |
| 1357 return WebInspector.NetworkLogView._requestNameOrPathFilter.bind(null, r
egexp); |
| 1358 }, |
| 1359 |
| 1360 /** |
| 1361 * @param {!WebInspector.NetworkPanel.FilterType} type |
| 1362 * @param {string} value |
| 1363 * @return {!WebInspector.NetworkLogView.Filter} |
| 1364 */ |
| 1365 _createFilter: function(type, value) { |
| 1366 switch (type) { |
| 1367 case WebInspector.NetworkPanel.FilterType.Domain: |
| 1368 return WebInspector.NetworkLogView._requestDomainFilter.bind(null, v
alue); |
| 1369 |
| 1370 case WebInspector.NetworkPanel.FilterType.HasResponseHeader: |
| 1371 return WebInspector.NetworkLogView._requestResponseHeaderFilter.bind
(null, value); |
| 1372 |
| 1373 case WebInspector.NetworkPanel.FilterType.MimeType: |
| 1374 return WebInspector.NetworkLogView._requestMimeTypeFilter.bind(null,
value); |
| 1375 |
| 1376 case WebInspector.NetworkPanel.FilterType.SetCookieDomain: |
| 1377 return WebInspector.NetworkLogView._requestSetCookieDomainFilter.bin
d(null, value); |
| 1378 |
| 1379 case WebInspector.NetworkPanel.FilterType.SetCookieName: |
| 1380 return WebInspector.NetworkLogView._requestSetCookieNameFilter.bind(
null, value); |
| 1381 |
| 1382 case WebInspector.NetworkPanel.FilterType.SetCookieValue: |
| 1383 return WebInspector.NetworkLogView._requestSetCookieValueFilter.bind
(null, value); |
| 1384 } |
| 1385 return this._createTextFilter(type + ":" + value); |
| 1386 }, |
| 1387 |
1316 _filterRequests: function() | 1388 _filterRequests: function() |
1317 { | 1389 { |
1318 this._removeAllHighlights(); | 1390 this._removeAllHighlights(); |
1319 this._filteredOutRequests.clear(); | 1391 this._filteredOutRequests.clear(); |
1320 | 1392 |
1321 var nodes = this._dataGrid.rootNode().children; | 1393 var nodes = this._dataGrid.rootNode().children; |
1322 for (var i = 0; i < nodes.length; ++i) | 1394 for (var i = 0; i < nodes.length; ++i) |
1323 this._applyFilter(nodes[i]); | 1395 this._applyFilter(nodes[i]); |
1324 this._updateSummaryBar(); | 1396 this._updateSummaryBar(); |
1325 this._updateOffscreenRows(); | 1397 this._updateOffscreenRows(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 command.push(escapeString(name + ": " + header.value)); | 1537 command.push(escapeString(name + ": " + header.value)); |
1466 } | 1538 } |
1467 command = command.concat(data); | 1539 command = command.concat(data); |
1468 command.push("--compressed"); | 1540 command.push("--compressed"); |
1469 return command.join(" "); | 1541 return command.join(" "); |
1470 }, | 1542 }, |
1471 | 1543 |
1472 __proto__: WebInspector.View.prototype | 1544 __proto__: WebInspector.View.prototype |
1473 } | 1545 } |
1474 | 1546 |
| 1547 /** @typedef {function(!WebInspector.NetworkRequest): boolean} */ |
| 1548 WebInspector.NetworkLogView.Filter; |
| 1549 |
| 1550 /** |
| 1551 * @param {!RegExp} regex |
| 1552 * @param {!WebInspector.NetworkRequest} request |
| 1553 * @return {boolean} |
| 1554 */ |
| 1555 WebInspector.NetworkLogView._requestNameOrPathFilter = function(regex, request) |
| 1556 { |
| 1557 return regex.test(request.name()) || regex.test(request.path()); |
| 1558 } |
| 1559 |
| 1560 /** |
| 1561 * @param {string} value |
| 1562 * @param {!WebInspector.NetworkRequest} request |
| 1563 * @return {boolean} |
| 1564 */ |
| 1565 WebInspector.NetworkLogView._requestDomainFilter = function(value, request) |
| 1566 { |
| 1567 return request.domain === value; |
| 1568 } |
| 1569 |
| 1570 /** |
| 1571 * @param {string} value |
| 1572 * @param {!WebInspector.NetworkRequest} request |
| 1573 * @return {boolean} |
| 1574 */ |
| 1575 WebInspector.NetworkLogView._requestResponseHeaderFilter = function(value, reque
st) |
| 1576 { |
| 1577 return request.responseHeaderValue(value) !== undefined; |
| 1578 } |
| 1579 |
| 1580 /** |
| 1581 * @param {string} value |
| 1582 * @param {!WebInspector.NetworkRequest} request |
| 1583 * @return {boolean} |
| 1584 */ |
| 1585 WebInspector.NetworkLogView._requestMimeTypeFilter = function(value, request) |
| 1586 { |
| 1587 return request.mimeType === value; |
| 1588 } |
| 1589 |
| 1590 /** |
| 1591 * @param {string} value |
| 1592 * @param {!WebInspector.NetworkRequest} request |
| 1593 * @return {boolean} |
| 1594 */ |
| 1595 WebInspector.NetworkLogView._requestSetCookieDomainFilter = function(value, requ
est) |
| 1596 { |
| 1597 var cookies = request.responseCookies; |
| 1598 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) { |
| 1599 if (cookies[i].domain() === value) |
| 1600 return false; |
| 1601 } |
| 1602 return false; |
| 1603 } |
| 1604 |
| 1605 /** |
| 1606 * @param {string} value |
| 1607 * @param {!WebInspector.NetworkRequest} request |
| 1608 * @return {boolean} |
| 1609 */ |
| 1610 WebInspector.NetworkLogView._requestSetCookieNameFilter = function(value, reques
t) |
| 1611 { |
| 1612 var cookies = request.responseCookies; |
| 1613 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) { |
| 1614 if (cookies[i].name() === value) |
| 1615 return false; |
| 1616 } |
| 1617 return false; |
| 1618 } |
| 1619 |
| 1620 /** |
| 1621 * @param {string} value |
| 1622 * @param {!WebInspector.NetworkRequest} request |
| 1623 * @return {boolean} |
| 1624 */ |
| 1625 WebInspector.NetworkLogView._requestSetCookieValueFilter = function(value, reque
st) |
| 1626 { |
| 1627 var cookies = request.responseCookies; |
| 1628 for (var i = 0, l = cookies ? cookies.length : 0; i < l; ++i) { |
| 1629 if (cookies[i].value() === value) |
| 1630 return false; |
| 1631 } |
| 1632 return false; |
| 1633 } |
| 1634 |
1475 /** | 1635 /** |
1476 * @param {!WebInspector.NetworkRequest} request | 1636 * @param {!WebInspector.NetworkRequest} request |
1477 * @return {boolean} | 1637 * @return {boolean} |
1478 */ | 1638 */ |
1479 WebInspector.NetworkLogView.HTTPRequestsFilter = function(request) | 1639 WebInspector.NetworkLogView.HTTPRequestsFilter = function(request) |
1480 { | 1640 { |
1481 return request.parsedURL.isValid && (request.scheme in WebInspector.NetworkL
ogView.HTTPSchemas); | 1641 return request.parsedURL.isValid && (request.scheme in WebInspector.NetworkL
ogView.HTTPSchemas); |
1482 } | 1642 } |
1483 | 1643 |
1484 /** | 1644 /** |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1559 /** | 1719 /** |
1560 * @this {WebInspector.NetworkPanel} | 1720 * @this {WebInspector.NetworkPanel} |
1561 */ | 1721 */ |
1562 function viewGetter() | 1722 function viewGetter() |
1563 { | 1723 { |
1564 return this.visibleView; | 1724 return this.visibleView; |
1565 } | 1725 } |
1566 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); | 1726 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); |
1567 } | 1727 } |
1568 | 1728 |
| 1729 /** @enum {string} */ |
| 1730 WebInspector.NetworkPanel.FilterType = { |
| 1731 Domain: "Domain", |
| 1732 HasResponseHeader: "HasResponseHeader", |
| 1733 MimeType: "MimeType", |
| 1734 SetCookieDomain: "SetCookieDomain", |
| 1735 SetCookieName: "SetCookieName", |
| 1736 SetCookieValue: "SetCookieValue" |
| 1737 }; |
| 1738 |
| 1739 /** @type {!Array.<string>} */ |
| 1740 WebInspector.NetworkPanel._searchKeys = Object.values(WebInspector.NetworkPanel.
FilterType); |
| 1741 |
1569 WebInspector.NetworkPanel.prototype = { | 1742 WebInspector.NetworkPanel.prototype = { |
1570 _onFiltersToggled: function(event) | 1743 _onFiltersToggled: function(event) |
1571 { | 1744 { |
1572 var toggled = /** @type {boolean} */ (event.data); | 1745 var toggled = /** @type {boolean} */ (event.data); |
1573 this._filtersContainer.enableStyleClass("hidden", !toggled); | 1746 this._filtersContainer.enableStyleClass("hidden", !toggled); |
1574 this.element.enableStyleClass("filters-toggled", toggled); | 1747 this.element.enableStyleClass("filters-toggled", toggled); |
1575 }, | 1748 }, |
1576 | 1749 |
1577 /** | 1750 /** |
1578 * @return {!Array.<!Element>} | 1751 * @return {!Array.<!Element>} |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2700 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) | 2873 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa
me, revert, a, b) |
2701 { | 2874 { |
2702 var aValue = a._request[propertyName]; | 2875 var aValue = a._request[propertyName]; |
2703 var bValue = b._request[propertyName]; | 2876 var bValue = b._request[propertyName]; |
2704 if (aValue > bValue) | 2877 if (aValue > bValue) |
2705 return revert ? -1 : 1; | 2878 return revert ? -1 : 1; |
2706 if (bValue > aValue) | 2879 if (bValue > aValue) |
2707 return revert ? 1 : -1; | 2880 return revert ? 1 : -1; |
2708 return 0; | 2881 return 0; |
2709 } | 2882 } |
OLD | NEW |