Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: Source/devtools/front_end/network/NetworkPanel.js

Issue 352983004: DevTools: add more jsdocs to NetworkPanel. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 this._dataURLFilterUI.addEventListener(WebInspector.FilterUI.Events.Filt erChanged, this._filterChanged.bind(this), this); 176 this._dataURLFilterUI.addEventListener(WebInspector.FilterUI.Events.Filt erChanged, this._filterChanged.bind(this), this);
177 this._filterBar.addFilter(this._dataURLFilterUI); 177 this._filterBar.addFilter(this._dataURLFilterUI);
178 }, 178 },
179 179
180 _resetSuggestionBuilder: function() 180 _resetSuggestionBuilder: function()
181 { 181 {
182 this._suggestionBuilder = new WebInspector.FilterSuggestionBuilder(WebIn spector.NetworkPanel._searchKeys); 182 this._suggestionBuilder = new WebInspector.FilterSuggestionBuilder(WebIn spector.NetworkPanel._searchKeys);
183 this._textFilterUI.setSuggestionBuilder(this._suggestionBuilder); 183 this._textFilterUI.setSuggestionBuilder(this._suggestionBuilder);
184 }, 184 },
185 185
186 /**
187 * @param {!WebInspector.Event} event
188 */
186 _filterChanged: function(event) 189 _filterChanged: function(event)
187 { 190 {
188 this._removeAllNodeHighlights(); 191 this._removeAllNodeHighlights();
189 this.searchCanceled(); 192 this.searchCanceled();
190 this._parseFilterQuery(this._textFilterUI.value()); 193 this._parseFilterQuery(this._textFilterUI.value());
191 this._filterRequests(); 194 this._filterRequests();
192 }, 195 },
193 196
194 _initializeView: function() 197 _initializeView: function()
195 { 198 {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); 382 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true);
380 this._dataGrid.show(this.element); 383 this._dataGrid.show(this.element);
381 384
382 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. 385 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update.
383 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); 386 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this);
384 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); 387 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this);
385 388
386 this._patchTimelineHeader(); 389 this._patchTimelineHeader();
387 }, 390 },
388 391
392 /**
393 * @param {string} title
394 * @param {string} subtitle
395 * @return {!DocumentFragment}
396 */
389 _makeHeaderFragment: function(title, subtitle) 397 _makeHeaderFragment: function(title, subtitle)
390 { 398 {
391 var fragment = document.createDocumentFragment(); 399 var fragment = document.createDocumentFragment();
392 fragment.createTextChild(title); 400 fragment.createTextChild(title);
393 var subtitleDiv = fragment.createChild("div", "network-header-subtitle") ; 401 var subtitleDiv = fragment.createChild("div", "network-header-subtitle") ;
394 subtitleDiv.createTextChild(subtitle); 402 subtitleDiv.createTextChild(subtitle);
395 return fragment; 403 return fragment;
396 }, 404 },
397 405
398 _patchTimelineHeader: function() 406 _patchTimelineHeader: function()
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 this._largerRequestsButton.addEventListener("click", this._toggleLargerR equests, this); 709 this._largerRequestsButton.addEventListener("click", this._toggleLargerR equests, this);
702 710
703 this._preserveLogCheckbox = new WebInspector.StatusBarCheckbox(WebInspec tor.UIString("Preserve log")); 711 this._preserveLogCheckbox = new WebInspector.StatusBarCheckbox(WebInspec tor.UIString("Preserve log"));
704 this._preserveLogCheckbox.element.title = WebInspector.UIString("Do not clear log on page reload / navigation."); 712 this._preserveLogCheckbox.element.title = WebInspector.UIString("Do not clear log on page reload / navigation.");
705 713
706 this._disableCacheCheckbox = new WebInspector.StatusBarCheckbox(WebInspe ctor.UIString("Disable cache")); 714 this._disableCacheCheckbox = new WebInspector.StatusBarCheckbox(WebInspe ctor.UIString("Disable cache"));
707 WebInspector.SettingsUI.bindCheckbox(this._disableCacheCheckbox.inputEle ment, WebInspector.settings.cacheDisabled); 715 WebInspector.SettingsUI.bindCheckbox(this._disableCacheCheckbox.inputEle ment, WebInspector.settings.cacheDisabled);
708 this._disableCacheCheckbox.element.title = WebInspector.UIString("Disabl e cache (while DevTools is open)."); 716 this._disableCacheCheckbox.element.title = WebInspector.UIString("Disabl e cache (while DevTools is open).");
709 }, 717 },
710 718
719 /**
720 * @param {!WebInspector.Event} event
721 */
711 _loadEventFired: function(event) 722 _loadEventFired: function(event)
712 { 723 {
713 if (!this._recordButton.toggled) 724 if (!this._recordButton.toggled)
714 return; 725 return;
715 726
716 this._mainRequestLoadTime = event.data || -1; 727 this._mainRequestLoadTime = event.data || -1;
717 // Schedule refresh to update boundaries and draw the new line. 728 // Schedule refresh to update boundaries and draw the new line.
718 this._scheduleRefresh(); 729 this._scheduleRefresh();
719 }, 730 },
720 731
732 /**
733 * @param {!WebInspector.Event} event
734 */
721 _domContentLoadedEventFired: function(event) 735 _domContentLoadedEventFired: function(event)
722 { 736 {
723 if (!this._recordButton.toggled) 737 if (!this._recordButton.toggled)
724 return; 738 return;
725 this._mainRequestDOMContentLoadedTime = event.data || -1; 739 this._mainRequestDOMContentLoadedTime = event.data || -1;
726 // Schedule refresh to update boundaries and draw the new line. 740 // Schedule refresh to update boundaries and draw the new line.
727 this._scheduleRefresh(); 741 this._scheduleRefresh();
728 }, 742 },
729 743
730 wasShown: function() 744 wasShown: function()
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 if (this._dataGrid) { 829 if (this._dataGrid) {
816 this._dataGrid.rootNode().removeChildren(); 830 this._dataGrid.rootNode().removeChildren();
817 this._updateDividersIfNeeded(); 831 this._updateDividersIfNeeded();
818 this._updateSummaryBar(); 832 this._updateSummaryBar();
819 } 833 }
820 834
821 this._mainRequestLoadTime = -1; 835 this._mainRequestLoadTime = -1;
822 this._mainRequestDOMContentLoadedTime = -1; 836 this._mainRequestDOMContentLoadedTime = -1;
823 }, 837 },
824 838
839 /**
840 * @param {!WebInspector.Event} event
841 */
825 _onRequestStarted: function(event) 842 _onRequestStarted: function(event)
826 { 843 {
827 if (this._recordButton.toggled) 844 if (this._recordButton.toggled) {
828 this._appendRequest(event.data); 845 var request = /** @type {!WebInspector.NetworkRequest} */ (event.dat a);
846 this._appendRequest(request);
847 }
829 }, 848 },
830 849
850 /**
851 * @param {!WebInspector.NetworkRequest} request
852 */
831 _appendRequest: function(request) 853 _appendRequest: function(request)
832 { 854 {
833 this._requests.push(request); 855 this._requests.push(request);
834 856
835 // In case of redirect request id is reassigned to a redirected 857 // In case of redirect request id is reassigned to a redirected
836 // request and we need to update _requestsById and search results. 858 // request and we need to update _requestsById and search results.
837 if (this._requestsById[request.requestId]) { 859 if (this._requestsById[request.requestId]) {
838 var oldRequest = request.redirects[request.redirects.length - 1]; 860 var oldRequest = request.redirects[request.redirects.length - 1];
839 this._requestsById[oldRequest.requestId] = oldRequest; 861 this._requestsById[oldRequest.requestId] = oldRequest;
840 862
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 var cookie = cookies[i]; 903 var cookie = cookies[i];
882 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieDomain, cookie.domain()); 904 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieDomain, cookie.domain());
883 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieName, cookie.name()); 905 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieName, cookie.name());
884 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieValue, cookie.value()); 906 this._suggestionBuilder.addItem(WebInspector.NetworkPanel.FilterType .SetCookieValue, cookie.value());
885 } 907 }
886 908
887 this._staleRequests[request.requestId] = request; 909 this._staleRequests[request.requestId] = request;
888 this._scheduleRefresh(); 910 this._scheduleRefresh();
889 }, 911 },
890 912
913 /**
914 * @param {!WebInspector.Event} event
915 */
891 _willReloadPage: function(event) 916 _willReloadPage: function(event)
892 { 917 {
893 this._recordButton.toggled = true; 918 this._recordButton.toggled = true;
894 if (!this._preserveLogCheckbox.checked()) 919 if (!this._preserveLogCheckbox.checked())
895 this._reset(); 920 this._reset();
896 }, 921 },
897 922
898 /** 923 /**
899 * @param {!WebInspector.Event} event 924 * @param {!WebInspector.Event} event
900 */ 925 */
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 this._updateColumns(); 966 this._updateColumns();
942 this._popoverHelper.hidePopover(); 967 this._popoverHelper.hidePopover();
943 }, 968 },
944 969
945 _toggleLargerRequests: function() 970 _toggleLargerRequests: function()
946 { 971 {
947 WebInspector.settings.resourcesLargeRows.set(!WebInspector.settings.reso urcesLargeRows.get()); 972 WebInspector.settings.resourcesLargeRows.set(!WebInspector.settings.reso urcesLargeRows.get());
948 this._setLargerRequests(WebInspector.settings.resourcesLargeRows.get()); 973 this._setLargerRequests(WebInspector.settings.resourcesLargeRows.get());
949 }, 974 },
950 975
976 /**
977 * @param {boolean} enabled
978 */
951 _setLargerRequests: function(enabled) 979 _setLargerRequests: function(enabled)
952 { 980 {
953 this._largerRequestsButton.toggled = enabled; 981 this._largerRequestsButton.toggled = enabled;
954 if (!enabled) { 982 if (!enabled) {
955 this._largerRequestsButton.title = WebInspector.UIString("Use large resource rows."); 983 this._largerRequestsButton.title = WebInspector.UIString("Use large resource rows.");
956 this._dataGrid.element.classList.add("small"); 984 this._dataGrid.element.classList.add("small");
957 this._timelineGrid.element.classList.add("small"); 985 this._timelineGrid.element.classList.add("small");
958 } else { 986 } else {
959 this._largerRequestsButton.title = WebInspector.UIString("Use small resource rows."); 987 this._largerRequestsButton.title = WebInspector.UIString("Use small resource rows.");
960 this._dataGrid.element.classList.remove("small"); 988 this._dataGrid.element.classList.remove("small");
961 this._timelineGrid.element.classList.remove("small"); 989 this._timelineGrid.element.classList.remove("small");
962 } 990 }
963 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Row SizeChanged, { largeRows: enabled }); 991 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Row SizeChanged, { largeRows: enabled });
964 }, 992 },
965 993
966 _getPopoverAnchor: function(element) 994 /**
995 * @param {!Element} element
996 * @param {!Event} event
997 * @return {!Element|!AnchorBox|undefined}
998 */
999 _getPopoverAnchor: function(element, event)
967 { 1000 {
968 if (!this._allowPopover) 1001 if (!this._allowPopover)
969 return; 1002 return;
970 var anchor = element.enclosingNodeOrSelfWithClass("network-graph-bar") | | element.enclosingNodeOrSelfWithClass("network-graph-label"); 1003 var anchor = element.enclosingNodeOrSelfWithClass("network-graph-bar") | | element.enclosingNodeOrSelfWithClass("network-graph-label");
971 if (anchor && anchor.parentElement.request && anchor.parentElement.reque st.timing) 1004 if (anchor && anchor.parentElement.request && anchor.parentElement.reque st.timing)
972 return anchor; 1005 return anchor;
973 anchor = element.enclosingNodeOrSelfWithClass("network-script-initiated" ); 1006 anchor = element.enclosingNodeOrSelfWithClass("network-script-initiated" );
974 if (anchor && anchor.request && anchor.request.initiator) 1007 if (anchor && anchor.request && anchor.request.initiator)
975 return anchor; 1008 return anchor;
976
977 return null;
978 }, 1009 },
979 1010
980 /** 1011 /**
981 * @param {!Element} anchor 1012 * @param {!Element} anchor
982 * @param {!WebInspector.Popover} popover 1013 * @param {!WebInspector.Popover} popover
983 */ 1014 */
984 _showPopover: function(anchor, popover) 1015 _showPopover: function(anchor, popover)
985 { 1016 {
986 var content; 1017 var content;
987 if (anchor.classList.contains("network-script-initiated")) 1018 if (anchor.classList.contains("network-script-initiated"))
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 function compare(id1, id2) 1084 function compare(id1, id2)
1054 { 1085 {
1055 return columnTitles[id1].compareTo(columnTitles[id2]); 1086 return columnTitles[id1].compareTo(columnTitles[id2]);
1056 } 1087 }
1057 1088
1058 var columnIDs = Object.keys(this._coulmnsVisibilitySetting.get()); 1089 var columnIDs = Object.keys(this._coulmnsVisibilitySetting.get());
1059 this._configurableColumnIDs = columnIDs.sort(compare); 1090 this._configurableColumnIDs = columnIDs.sort(compare);
1060 return this._configurableColumnIDs; 1091 return this._configurableColumnIDs;
1061 }, 1092 },
1062 1093
1094 /**
1095 * @param {?Event} event
1096 */
1063 _contextMenu: function(event) 1097 _contextMenu: function(event)
1064 { 1098 {
1065 var contextMenu = new WebInspector.ContextMenu(event); 1099 var contextMenu = new WebInspector.ContextMenu(event);
1066 1100
1067 if (this._detailedMode && event.target.isSelfOrDescendant(this._dataGrid .headerTableBody)) { 1101 if (this._detailedMode && event.target.isSelfOrDescendant(this._dataGrid .headerTableBody)) {
1068 var columnsVisibility = this._coulmnsVisibilitySetting.get(); 1102 var columnsVisibility = this._coulmnsVisibilitySetting.get();
1069 var columnIDs = this._getConfigurableColumnIDs(); 1103 var columnIDs = this._getConfigurableColumnIDs();
1070 var columnTitles = WebInspector.NetworkLogView._columnTitles; 1104 var columnTitles = WebInspector.NetworkLogView._columnTitles;
1071 for (var i = 0; i < columnIDs.length; ++i) { 1105 for (var i = 0; i < columnIDs.length; ++i) {
1072 var columnIdentifier = columnIDs[i]; 1106 var columnIdentifier = columnIDs[i];
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 1144
1111 if (request && request.type === WebInspector.resourceTypes.XHR) { 1145 if (request && request.type === WebInspector.resourceTypes.XHR) {
1112 contextMenu.appendSeparator(); 1146 contextMenu.appendSeparator();
1113 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), this._re playXHR.bind(this, request.requestId)); 1147 contextMenu.appendItem(WebInspector.UIString("Replay XHR"), this._re playXHR.bind(this, request.requestId));
1114 contextMenu.appendSeparator(); 1148 contextMenu.appendSeparator();
1115 } 1149 }
1116 1150
1117 contextMenu.show(); 1151 contextMenu.show();
1118 }, 1152 },
1119 1153
1154 /**
1155 * @param {string} requestId
1156 */
1120 _replayXHR: function(requestId) 1157 _replayXHR: function(requestId)
1121 { 1158 {
1122 NetworkAgent.replayXHR(requestId); 1159 NetworkAgent.replayXHR(requestId);
1123 }, 1160 },
1124 1161
1125 _harRequests: function() 1162 _harRequests: function()
1126 { 1163 {
1127 var httpRequests = this._requests.filter(WebInspector.NetworkLogView.HTT PRequestsFilter); 1164 var httpRequests = this._requests.filter(WebInspector.NetworkLogView.HTT PRequestsFilter);
1128 httpRequests = httpRequests.filter(WebInspector.NetworkLogView.FinishedR equestsFilter); 1165 httpRequests = httpRequests.filter(WebInspector.NetworkLogView.FinishedR equestsFilter);
1129 return httpRequests.filter(WebInspector.NetworkLogView.NonDevToolsReques tsFilter); 1166 return httpRequests.filter(WebInspector.NetworkLogView.NonDevToolsReques tsFilter);
1130 }, 1167 },
1131 1168
1132 _copyAll: function() 1169 _copyAll: function()
1133 { 1170 {
1134 var harArchive = { 1171 var harArchive = {
1135 log: (new WebInspector.HARLog(this._harRequests())).build() 1172 log: (new WebInspector.HARLog(this._harRequests())).build()
1136 }; 1173 };
1137 InspectorFrontendHost.copyText(JSON.stringify(harArchive, null, 2)); 1174 InspectorFrontendHost.copyText(JSON.stringify(harArchive, null, 2));
1138 }, 1175 },
1139 1176
1177 /**
1178 * @param {!WebInspector.NetworkRequest} request
1179 */
1140 _copyLocation: function(request) 1180 _copyLocation: function(request)
1141 { 1181 {
1142 InspectorFrontendHost.copyText(request.url); 1182 InspectorFrontendHost.copyText(request.url);
1143 }, 1183 },
1144 1184
1185 /**
1186 * @param {!WebInspector.NetworkRequest} request
1187 */
1145 _copyRequestHeaders: function(request) 1188 _copyRequestHeaders: function(request)
1146 { 1189 {
1147 InspectorFrontendHost.copyText(request.requestHeadersText()); 1190 InspectorFrontendHost.copyText(request.requestHeadersText());
1148 }, 1191 },
1149 1192
1193 /**
1194 * @param {!WebInspector.NetworkRequest} request
1195 */
1150 _copyResponse: function(request) 1196 _copyResponse: function(request)
1151 { 1197 {
1198 /**
1199 * @param {?string} content
1200 */
1152 function callback(content) 1201 function callback(content)
1153 { 1202 {
1154 if (request.contentEncoded) 1203 if (request.contentEncoded)
1155 content = request.asDataURL(); 1204 content = request.asDataURL();
1156 InspectorFrontendHost.copyText(content || ""); 1205 InspectorFrontendHost.copyText(content || "");
1157 } 1206 }
1158 request.requestContent(callback); 1207 request.requestContent(callback);
1159 }, 1208 },
1160 1209
1210 /**
1211 * @param {!WebInspector.NetworkRequest} request
1212 */
1161 _copyResponseHeaders: function(request) 1213 _copyResponseHeaders: function(request)
1162 { 1214 {
1163 InspectorFrontendHost.copyText(request.responseHeadersText); 1215 InspectorFrontendHost.copyText(request.responseHeadersText);
1164 }, 1216 },
1165 1217
1166 /** 1218 /**
1167 * @param {!WebInspector.NetworkRequest} request 1219 * @param {!WebInspector.NetworkRequest} request
1168 */ 1220 */
1169 _copyCurlCommand: function(request) 1221 _copyCurlCommand: function(request)
1170 { 1222 {
(...skipping 26 matching lines...) Expand all
1197 if (confirm(WebInspector.UIString("Are you sure you want to clear browse r cache?"))) 1249 if (confirm(WebInspector.UIString("Are you sure you want to clear browse r cache?")))
1198 NetworkAgent.clearBrowserCache(); 1250 NetworkAgent.clearBrowserCache();
1199 }, 1251 },
1200 1252
1201 _clearBrowserCookies: function() 1253 _clearBrowserCookies: function()
1202 { 1254 {
1203 if (confirm(WebInspector.UIString("Are you sure you want to clear browse r cookies?"))) 1255 if (confirm(WebInspector.UIString("Are you sure you want to clear browse r cookies?")))
1204 NetworkAgent.clearBrowserCookies(); 1256 NetworkAgent.clearBrowserCookies();
1205 }, 1257 },
1206 1258
1259 /**
1260 * @param {!WebInspector.NetworkRequest} request
1261 * @return {number}
1262 */
1207 _matchRequest: function(request) 1263 _matchRequest: function(request)
1208 { 1264 {
1209 if (!this._searchRegExp) 1265 if (!this._searchRegExp)
1210 return -1; 1266 return -1;
1211 1267
1212 if (!request.name().match(this._searchRegExp) && !request.path().match(t his._searchRegExp)) 1268 if (!request.name().match(this._searchRegExp) && !request.path().match(t his._searchRegExp))
1213 return -1; 1269 return -1;
1214 1270
1215 if (request.requestId in this._matchedRequestsMap) 1271 if (request.requestId in this._matchedRequestsMap)
1216 return this._matchedRequestsMap[request.requestId]; 1272 return this._matchedRequestsMap[request.requestId];
(...skipping 16 matching lines...) Expand all
1233 _updateSearchMatchedListAfterRequestIdChanged: function(oldRequestId, newReq uestId) 1289 _updateSearchMatchedListAfterRequestIdChanged: function(oldRequestId, newReq uestId)
1234 { 1290 {
1235 var requestIndex = this._matchedRequestsMap[oldRequestId]; 1291 var requestIndex = this._matchedRequestsMap[oldRequestId];
1236 if (requestIndex) { 1292 if (requestIndex) {
1237 delete this._matchedRequestsMap[oldRequestId]; 1293 delete this._matchedRequestsMap[oldRequestId];
1238 this._matchedRequestsMap[newRequestId] = requestIndex; 1294 this._matchedRequestsMap[newRequestId] = requestIndex;
1239 this._matchedRequests[requestIndex] = newRequestId; 1295 this._matchedRequests[requestIndex] = newRequestId;
1240 } 1296 }
1241 }, 1297 },
1242 1298
1299 /**
1300 * @param {!WebInspector.NetworkRequest} request
1301 */
1243 _updateHighlightIfMatched: function(request) 1302 _updateHighlightIfMatched: function(request)
1244 { 1303 {
1245 var matchedRequestIndex = this._matchRequest(request); 1304 var matchedRequestIndex = this._matchRequest(request);
1246 if (matchedRequestIndex === -1) 1305 if (matchedRequestIndex === -1)
1247 return; 1306 return;
1248 1307
1249 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, this._matchedRequests.length); 1308 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, this._matchedRequests.length);
1250 1309
1251 if (this._currentMatchedRequestIndex !== -1 && this._currentMatchedReque stIndex !== matchedRequestIndex) 1310 if (this._currentMatchedRequestIndex !== -1 && this._currentMatchedReque stIndex !== matchedRequestIndex)
1252 return; 1311 return;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 } 1390 }
1332 } 1391 }
1333 1392
1334 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, this._matchedRequests.length); 1393 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, this._matchedRequests.length);
1335 if (shouldJump) { 1394 if (shouldJump) {
1336 var index = this._normalizeSearchResultIndex(newMatchedRequestIndex) ; 1395 var index = this._normalizeSearchResultIndex(newMatchedRequestIndex) ;
1337 this._highlightNthMatchedRequestForSearch(index, true); 1396 this._highlightNthMatchedRequestForSearch(index, true);
1338 } 1397 }
1339 }, 1398 },
1340 1399
1400 /**
1401 * @param {number} index
1402 * @return {number}
1403 */
1341 _normalizeSearchResultIndex: function(index) 1404 _normalizeSearchResultIndex: function(index)
1342 { 1405 {
1343 return (index + this._matchedRequests.length) % this._matchedRequests.le ngth; 1406 return (index + this._matchedRequests.length) % this._matchedRequests.le ngth;
1344 }, 1407 },
1345 1408
1346 /** 1409 /**
1347 * @param {!WebInspector.NetworkDataGridNode} node 1410 * @param {!WebInspector.NetworkDataGridNode} node
1348 */ 1411 */
1349 _applyFilter: function(node) 1412 _applyFilter: function(node)
1350 { 1413 {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 var index = this._normalizeSearchResultIndex(this._currentMatchedRequest Index + 1); 1508 var index = this._normalizeSearchResultIndex(this._currentMatchedRequest Index + 1);
1446 this._highlightNthMatchedRequestForSearch(index, true); 1509 this._highlightNthMatchedRequestForSearch(index, true);
1447 }, 1510 },
1448 1511
1449 searchCanceled: function() 1512 searchCanceled: function()
1450 { 1513 {
1451 this._clearSearchMatchedList(); 1514 this._clearSearchMatchedList();
1452 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, 0); 1515 this.dispatchEventToListeners(WebInspector.NetworkLogView.EventTypes.Sea rchCountUpdated, 0);
1453 }, 1516 },
1454 1517
1518 /**
1519 * @param {!WebInspector.NetworkRequest} request
1520 */
1455 revealAndHighlightRequest: function(request) 1521 revealAndHighlightRequest: function(request)
1456 { 1522 {
1457 this._removeAllNodeHighlights(); 1523 this._removeAllNodeHighlights();
1458 1524
1459 var node = this._requestGridNode(request); 1525 var node = this._requestGridNode(request);
1460 if (node) { 1526 if (node) {
1461 this._dataGrid.element.focus(); 1527 this._dataGrid.element.focus();
1462 node.reveal(); 1528 node.reveal();
1463 this._highlightNode(node); 1529 this._highlightNode(node);
1464 } 1530 }
1465 }, 1531 },
1466 1532
1467 _removeAllNodeHighlights: function() 1533 _removeAllNodeHighlights: function()
1468 { 1534 {
1469 if (this._highlightedNode) { 1535 if (this._highlightedNode) {
1470 this._highlightedNode.element.classList.remove("highlighted-row"); 1536 this._highlightedNode.element.classList.remove("highlighted-row");
1471 delete this._highlightedNode; 1537 delete this._highlightedNode;
1472 } 1538 }
1473 }, 1539 },
1474 1540
1541 /**
1542 * @param {!WebInspector.NetworkDataGridNode} node
1543 */
1475 _highlightNode: function(node) 1544 _highlightNode: function(node)
1476 { 1545 {
1477 WebInspector.runCSSAnimationOnce(node.element, "highlighted-row"); 1546 WebInspector.runCSSAnimationOnce(node.element, "highlighted-row");
1478 this._highlightedNode = node; 1547 this._highlightedNode = node;
1479 }, 1548 },
1480 1549
1481 /** 1550 /**
1482 * @param {!WebInspector.NetworkRequest} request 1551 * @param {!WebInspector.NetworkRequest} request
1483 * @return {string} 1552 * @return {string}
1484 */ 1553 */
1485 _generateCurlCommand: function(request) 1554 _generateCurlCommand: function(request)
1486 { 1555 {
1487 var command = ["curl"]; 1556 var command = ["curl"];
1488 // These headers are derived from URL (except "version") and would be ad ded by cURL anyway. 1557 // These headers are derived from URL (except "version") and would be ad ded by cURL anyway.
1489 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v ersion": 1}; 1558 var ignoredHeaders = {"host": 1, "method": 1, "path": 1, "scheme": 1, "v ersion": 1};
1490 1559
1491 function escapeStringWin(str) 1560 function escapeStringWin(str)
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 SetCookieDomain: "SetCookieDomain", 1870 SetCookieDomain: "SetCookieDomain",
1802 SetCookieName: "SetCookieName", 1871 SetCookieName: "SetCookieName",
1803 SetCookieValue: "SetCookieValue", 1872 SetCookieValue: "SetCookieValue",
1804 StatusCode: "StatusCode" 1873 StatusCode: "StatusCode"
1805 }; 1874 };
1806 1875
1807 /** @type {!Array.<string>} */ 1876 /** @type {!Array.<string>} */
1808 WebInspector.NetworkPanel._searchKeys = Object.values(WebInspector.NetworkPanel. FilterType); 1877 WebInspector.NetworkPanel._searchKeys = Object.values(WebInspector.NetworkPanel. FilterType);
1809 1878
1810 WebInspector.NetworkPanel.prototype = { 1879 WebInspector.NetworkPanel.prototype = {
1880 /**
1881 * @param {!WebInspector.Event} event
1882 */
1811 _onFiltersToggled: function(event) 1883 _onFiltersToggled: function(event)
1812 { 1884 {
1813 var toggled = /** @type {boolean} */ (event.data); 1885 var toggled = /** @type {boolean} */ (event.data);
1814 this._filtersContainer.classList.toggle("hidden", !toggled); 1886 this._filtersContainer.classList.toggle("hidden", !toggled);
1815 this.element.classList.toggle("filters-toggled", toggled); 1887 this.element.classList.toggle("filters-toggled", toggled);
1816 this.doResize(); 1888 this.doResize();
1817 }, 1889 },
1818 1890
1819 /** 1891 /**
1820 * @return {!Array.<!Element>} 1892 * @return {!Array.<!Element>}
(...skipping 10 matching lines...) Expand all
1831 { 1903 {
1832 return this._searchableView; 1904 return this._searchableView;
1833 }, 1905 },
1834 1906
1835 // FIXME: only used by the layout tests, should not be exposed. 1907 // FIXME: only used by the layout tests, should not be exposed.
1836 _reset: function() 1908 _reset: function()
1837 { 1909 {
1838 this._networkLogView._reset(); 1910 this._networkLogView._reset();
1839 }, 1911 },
1840 1912
1913 /**
1914 * @param {!KeyboardEvent} event
1915 */
1841 handleShortcut: function(event) 1916 handleShortcut: function(event)
1842 { 1917 {
1843 if (this._viewingRequestMode && event.keyCode === WebInspector.KeyboardS hortcut.Keys.Esc.code) { 1918 if (this._viewingRequestMode && event.keyCode === WebInspector.KeyboardS hortcut.Keys.Esc.code) {
1844 this._toggleGridMode(); 1919 this._toggleGridMode();
1845 event.handled = true; 1920 event.handled = true;
1846 return; 1921 return;
1847 } 1922 }
1848 1923
1849 WebInspector.Panel.prototype.handleShortcut.call(this, event); 1924 WebInspector.Panel.prototype.handleShortcut.call(this, event);
1850 }, 1925 },
1851 1926
1852 wasShown: function() 1927 wasShown: function()
1853 { 1928 {
1854 WebInspector.Panel.prototype.wasShown.call(this); 1929 WebInspector.Panel.prototype.wasShown.call(this);
1855 }, 1930 },
1856 1931
1857 /** 1932 /**
1858 * @param {!WebInspector.NetworkRequest} request 1933 * @param {!WebInspector.NetworkRequest} request
1859 */ 1934 */
1860 revealAndHighlightRequest: function(request) 1935 revealAndHighlightRequest: function(request)
1861 { 1936 {
1862 this._toggleGridMode(); 1937 this._toggleGridMode();
1863 if (request) 1938 if (request)
1864 this._networkLogView.revealAndHighlightRequest(request); 1939 this._networkLogView.revealAndHighlightRequest(request);
1865 }, 1940 },
1866 1941
1942 /**
1943 * @param {!WebInspector.Event} event
1944 */
1867 _onViewCleared: function(event) 1945 _onViewCleared: function(event)
1868 { 1946 {
1869 this._closeVisibleRequest(); 1947 this._closeVisibleRequest();
1870 this._toggleGridMode(); 1948 this._toggleGridMode();
1871 this._viewsContainerElement.removeChildren(); 1949 this._viewsContainerElement.removeChildren();
1872 this._viewsContainerElement.appendChild(this._closeButtonElement); 1950 this._viewsContainerElement.appendChild(this._closeButtonElement);
1873 }, 1951 },
1874 1952
1953 /**
1954 * @param {!WebInspector.Event} event
1955 */
1875 _onRowSizeChanged: function(event) 1956 _onRowSizeChanged: function(event)
1876 { 1957 {
1877 this._viewsContainerElement.classList.toggle("small", !event.data.largeR ows); 1958 this._viewsContainerElement.classList.toggle("small", !event.data.largeR ows);
1878 }, 1959 },
1879 1960
1961 /**
1962 * @param {!WebInspector.Event} event
1963 */
1880 _onSearchCountUpdated: function(event) 1964 _onSearchCountUpdated: function(event)
1881 { 1965 {
1882 this._searchableView.updateSearchMatchesCount(event.data); 1966 var count = /** @type {number} */ (event.data);
1883 }, 1967 this._searchableView.updateSearchMatchesCount(count);
1884
1885 _onSearchIndexUpdated: function(event)
1886 {
1887 this._searchableView.updateCurrentMatchIndex(event.data);
1888 },
1889
1890 _onRequestSelected: function(event)
1891 {
1892 this._showRequest(event.data);
1893 }, 1968 },
1894 1969
1895 /** 1970 /**
1971 * @param {!WebInspector.Event} event
1972 */
1973 _onSearchIndexUpdated: function(event)
1974 {
1975 var index = /** @type {number} */ (event.data);
1976 this._searchableView.updateCurrentMatchIndex(index);
1977 },
1978
1979 /**
1980 * @param {!WebInspector.Event} event
1981 */
1982 _onRequestSelected: function(event)
1983 {
1984 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data);
1985 this._showRequest(request);
1986 },
1987
1988 /**
1896 * @param {?WebInspector.NetworkRequest} request 1989 * @param {?WebInspector.NetworkRequest} request
1897 */ 1990 */
1898 _showRequest: function(request) 1991 _showRequest: function(request)
1899 { 1992 {
1900 if (!request) 1993 if (!request)
1901 return; 1994 return;
1902 1995
1903 this._toggleViewingRequestMode(); 1996 this._toggleViewingRequestMode();
1904 1997
1905 if (this._networkItemView) { 1998 if (this._networkItemView) {
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2186 /** 2279 /**
2187 * @param {number} value 2280 * @param {number} value
2188 * @param {number=} precision 2281 * @param {number=} precision
2189 * @return {string} 2282 * @return {string}
2190 */ 2283 */
2191 formatTime: function(value, precision) 2284 formatTime: function(value, precision)
2192 { 2285 {
2193 return value.toString(); 2286 return value.toString();
2194 }, 2287 },
2195 2288
2289 /**
2290 * @param {number} clientWidth
2291 */
2196 setDisplayWindow: function(clientWidth) 2292 setDisplayWindow: function(clientWidth)
2197 { 2293 {
2198 this._workingArea = clientWidth; 2294 this._workingArea = clientWidth;
2199 }, 2295 },
2200 2296
2201 /** 2297 /**
2202 * @return {number} 2298 * @return {number}
2203 */ 2299 */
2204 paddingLeft: function() 2300 paddingLeft: function()
2205 { 2301 {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2336 }, 2432 },
2337 2433
2338 /** 2434 /**
2339 * @return {string} 2435 * @return {string}
2340 */ 2436 */
2341 formatTime: function(value) 2437 formatTime: function(value)
2342 { 2438 {
2343 return Number.secondsToString(value); 2439 return Number.secondsToString(value);
2344 }, 2440 },
2345 2441
2442 /**
2443 * @param {!WebInspector.NetworkRequest} request
2444 */
2346 _lowerBound: function(request) 2445 _lowerBound: function(request)
2347 { 2446 {
2348 return 0; 2447 return 0;
2349 }, 2448 },
2350 2449
2450 /**
2451 * @param {!WebInspector.NetworkRequest} request
2452 */
2351 _upperBound: function(request) 2453 _upperBound: function(request)
2352 { 2454 {
2353 return 0; 2455 return 0;
2354 }, 2456 },
2355 2457
2356 __proto__: WebInspector.NetworkBaseCalculator.prototype 2458 __proto__: WebInspector.NetworkBaseCalculator.prototype
2357 } 2459 }
2358 2460
2359 /** 2461 /**
2360 * @constructor 2462 * @constructor
2361 * @extends {WebInspector.NetworkTimeCalculator} 2463 * @extends {WebInspector.NetworkTimeCalculator}
2362 */ 2464 */
2363 WebInspector.NetworkTransferTimeCalculator = function() 2465 WebInspector.NetworkTransferTimeCalculator = function()
2364 { 2466 {
2365 WebInspector.NetworkTimeCalculator.call(this, false); 2467 WebInspector.NetworkTimeCalculator.call(this, false);
2366 } 2468 }
2367 2469
2368 WebInspector.NetworkTransferTimeCalculator.prototype = { 2470 WebInspector.NetworkTransferTimeCalculator.prototype = {
2369 /** 2471 /**
2370 * @param {number} value 2472 * @param {number} value
2371 * @return {string} 2473 * @return {string}
2372 */ 2474 */
2373 formatTime: function(value) 2475 formatTime: function(value)
2374 { 2476 {
2375 return Number.secondsToString(value - this.zeroTime()); 2477 return Number.secondsToString(value - this.zeroTime());
2376 }, 2478 },
2377 2479
2480 /**
2481 * @param {!WebInspector.NetworkRequest} request
2482 */
2378 _lowerBound: function(request) 2483 _lowerBound: function(request)
2379 { 2484 {
2380 return request.startTime; 2485 return request.startTime;
2381 }, 2486 },
2382 2487
2488 /**
2489 * @param {!WebInspector.NetworkRequest} request
2490 */
2383 _upperBound: function(request) 2491 _upperBound: function(request)
2384 { 2492 {
2385 return request.endTime; 2493 return request.endTime;
2386 }, 2494 },
2387 2495
2388 __proto__: WebInspector.NetworkTimeCalculator.prototype 2496 __proto__: WebInspector.NetworkTimeCalculator.prototype
2389 } 2497 }
2390 2498
2391 /** 2499 /**
2392 * @constructor 2500 * @constructor
2393 * @extends {WebInspector.NetworkTimeCalculator} 2501 * @extends {WebInspector.NetworkTimeCalculator}
2394 */ 2502 */
2395 WebInspector.NetworkTransferDurationCalculator = function() 2503 WebInspector.NetworkTransferDurationCalculator = function()
2396 { 2504 {
2397 WebInspector.NetworkTimeCalculator.call(this, true); 2505 WebInspector.NetworkTimeCalculator.call(this, true);
2398 } 2506 }
2399 2507
2400 WebInspector.NetworkTransferDurationCalculator.prototype = { 2508 WebInspector.NetworkTransferDurationCalculator.prototype = {
2401 /** 2509 /**
2402 * @param {number} value 2510 * @param {number} value
2403 * @return {string} 2511 * @return {string}
2404 */ 2512 */
2405 formatTime: function(value) 2513 formatTime: function(value)
2406 { 2514 {
2407 return Number.secondsToString(value); 2515 return Number.secondsToString(value);
2408 }, 2516 },
2409 2517
2518 /**
2519 * @param {!WebInspector.NetworkRequest} request
2520 */
2410 _upperBound: function(request) 2521 _upperBound: function(request)
2411 { 2522 {
2412 return request.duration; 2523 return request.duration;
2413 }, 2524 },
2414 2525
2415 __proto__: WebInspector.NetworkTimeCalculator.prototype 2526 __proto__: WebInspector.NetworkTimeCalculator.prototype
2416 } 2527 }
2417 2528
2418 /** 2529 /**
2419 * @constructor 2530 * @constructor
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2510 { 2621 {
2511 this._parentView.dispatchEventToListeners(WebInspector.NetworkLogView.Ev entTypes.RequestSelected, this._request); 2622 this._parentView.dispatchEventToListeners(WebInspector.NetworkLogView.Ev entTypes.RequestSelected, this._request);
2512 WebInspector.DataGridNode.prototype.select.apply(this, arguments); 2623 WebInspector.DataGridNode.prototype.select.apply(this, arguments);
2513 2624
2514 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, { 2625 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, {
2515 action: WebInspector.UserMetrics.UserActionNames.NetworkRequestSelec ted, 2626 action: WebInspector.UserMetrics.UserActionNames.NetworkRequestSelec ted,
2516 url: this._request.url 2627 url: this._request.url
2517 }); 2628 });
2518 }, 2629 },
2519 2630
2631 /**
2632 * @param {!RegExp=} regexp
2633 */
2520 _highlightMatchedSubstring: function(regexp) 2634 _highlightMatchedSubstring: function(regexp)
2521 { 2635 {
2522 var domChanges = []; 2636 var domChanges = [];
2523 var matchInfo = this._element.textContent.match(regexp); 2637 var matchInfo = this._element.textContent.match(regexp);
2524 if (matchInfo) 2638 if (matchInfo)
2525 WebInspector.highlightSearchResult(this._nameCell, matchInfo.index, matchInfo[0].length, domChanges); 2639 WebInspector.highlightSearchResult(this._nameCell, matchInfo.index, matchInfo[0].length, domChanges);
2526 return domChanges; 2640 return domChanges;
2527 }, 2641 },
2528 2642
2529 _openInNewTab: function() 2643 _openInNewTab: function()
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 { 2828 {
2715 if (this._request.duration > 0) { 2829 if (this._request.duration > 0) {
2716 cell.setTextAndTitle(Number.secondsToString(this._request.duration)) ; 2830 cell.setTextAndTitle(Number.secondsToString(this._request.duration)) ;
2717 this._appendSubtitle(cell, Number.secondsToString(this._request.late ncy)); 2831 this._appendSubtitle(cell, Number.secondsToString(this._request.late ncy));
2718 } else { 2832 } else {
2719 cell.classList.add("network-dim-cell"); 2833 cell.classList.add("network-dim-cell");
2720 cell.setTextAndTitle(WebInspector.UIString("Pending")); 2834 cell.setTextAndTitle(WebInspector.UIString("Pending"));
2721 } 2835 }
2722 }, 2836 },
2723 2837
2838 /**
2839 * @param {!Element} cellElement
2840 * @param {string} subtitleText
2841 */
2724 _appendSubtitle: function(cellElement, subtitleText) 2842 _appendSubtitle: function(cellElement, subtitleText)
2725 { 2843 {
2726 var subtitleElement = document.createElement("div"); 2844 var subtitleElement = document.createElement("div");
2727 subtitleElement.className = "network-cell-subtitle"; 2845 subtitleElement.className = "network-cell-subtitle";
2728 subtitleElement.textContent = subtitleText; 2846 subtitleElement.textContent = subtitleText;
2729 cellElement.appendChild(subtitleElement); 2847 cellElement.appendChild(subtitleElement);
2730 }, 2848 },
2731 2849
2850 /**
2851 * @param {!WebInspector.NetworkBaseCalculator} calculator
2852 */
2732 refreshGraph: function(calculator) 2853 refreshGraph: function(calculator)
2733 { 2854 {
2734 if (!this._timelineCell) 2855 if (!this._timelineCell)
2735 return; 2856 return;
2736 2857
2737 var percentages = calculator.computeBarGraphPercentages(this._request); 2858 var percentages = calculator.computeBarGraphPercentages(this._request);
2738 this._percentages = percentages; 2859 this._percentages = percentages;
2739 2860
2740 this._barAreaElement.classList.remove("hidden"); 2861 this._barAreaElement.classList.remove("hidden");
2741 2862
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) 3066 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b)
2946 { 3067 {
2947 var aValue = a._request[propertyName]; 3068 var aValue = a._request[propertyName];
2948 var bValue = b._request[propertyName]; 3069 var bValue = b._request[propertyName];
2949 if (aValue > bValue) 3070 if (aValue > bValue)
2950 return revert ? -1 : 1; 3071 return revert ? -1 : 1;
2951 if (bValue > aValue) 3072 if (bValue > aValue)
2952 return revert ? 1 : -1; 3073 return revert ? 1 : -1;
2953 return a._request.indentityCompare(b._request); 3074 return a._request.indentityCompare(b._request);
2954 } 3075 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/ElementsPanel.js ('k') | Source/devtools/front_end/profiler/CanvasProfileView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698