Chromium Code Reviews| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 } | 89 } |
| 90 | 90 |
| 91 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr ue, "wss": true}; | 91 WebInspector.NetworkLogView.HTTPSchemas = {"http": true, "https": true, "ws": tr ue, "wss": true}; |
| 92 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified" , "Server", "Vary"]; | 92 WebInspector.NetworkLogView._responseHeaderColumns = ["Cache-Control", "Connecti on", "Content-Encoding", "Content-Length", "ETag", "Keep-Alive", "Last-Modified" , "Server", "Vary"]; |
| 93 WebInspector.NetworkLogView._defaultColumnsVisibility = { | 93 WebInspector.NetworkLogView._defaultColumnsVisibility = { |
| 94 method: true, status: true, scheme: false, domain: false, remoteAddress: fal se, type: true, initiator: true, cookies: false, setCookies: false, size: true, time: true, | 94 method: true, status: true, scheme: false, domain: false, remoteAddress: fal se, type: true, initiator: true, cookies: false, setCookies: false, size: true, time: true, |
| 95 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false, "Server": false, "Vary": false | 95 "Cache-Control": false, "Connection": false, "Content-Encoding": false, "Con tent-Length": false, "ETag": false, "Keep-Alive": false, "Last-Modified": false, "Server": false, "Vary": false |
| 96 }; | 96 }; |
| 97 WebInspector.NetworkLogView._defaultRefreshDelay = 500; | 97 WebInspector.NetworkLogView._defaultRefreshDelay = 500; |
| 98 | 98 |
| 99 /** @type {!Object.<string, string>} */ | |
| 100 WebInspector.NetworkLogView._columnTitles = { | |
|
yurys
2014/06/02 09:16:21
What's the point in this map? We already have an a
eustas
2014/06/02 09:43:18
This map is used for unwireing from dataGrid.
| |
| 101 "name": WebInspector.UIString("Name"), | |
| 102 "method": WebInspector.UIString("Method"), | |
| 103 "status": WebInspector.UIString("Status"), | |
| 104 "scheme": WebInspector.UIString("Scheme"), | |
| 105 "domain": WebInspector.UIString("Domain"), | |
| 106 "remoteAddress": WebInspector.UIString("Remote Address"), | |
| 107 "type": WebInspector.UIString("Type"), | |
| 108 "initiator": WebInspector.UIString("Initiator"), | |
| 109 "cookies": WebInspector.UIString("Cookies"), | |
| 110 "setCookies": WebInspector.UIString("Set-Cookies"), | |
| 111 "size": WebInspector.UIString("Size"), | |
| 112 "time": WebInspector.UIString("Time"), | |
| 113 "timeline": WebInspector.UIString("Timeline"), | |
| 114 | |
| 115 // Response header columns | |
| 116 "Cache-Control": WebInspector.UIString("Cache-Control"), | |
| 117 "Connection": WebInspector.UIString("Connection"), | |
| 118 "Content-Encoding": WebInspector.UIString("Content-Encoding"), | |
| 119 "Content-Length": WebInspector.UIString("Content-Length"), | |
| 120 "ETag": WebInspector.UIString("ETag"), | |
| 121 "Keep-Alive": WebInspector.UIString("Keep-Alive"), | |
| 122 "Last-Modified": WebInspector.UIString("Last-Modified"), | |
| 123 "Server": WebInspector.UIString("Server"), | |
| 124 "Vary": WebInspector.UIString("Vary") | |
| 125 }; | |
| 126 | |
| 99 WebInspector.NetworkLogView.prototype = { | 127 WebInspector.NetworkLogView.prototype = { |
| 100 /** | 128 /** |
| 101 * @param {!WebInspector.Target} target | 129 * @param {!WebInspector.Target} target |
| 102 */ | 130 */ |
| 103 targetAdded: function(target) | 131 targetAdded: function(target) |
| 104 { | 132 { |
| 105 target.networkManager.addEventListener(WebInspector.NetworkManager.Event Types.RequestStarted, this._onRequestStarted, this); | 133 target.networkManager.addEventListener(WebInspector.NetworkManager.Event Types.RequestStarted, this._onRequestStarted, this); |
| 106 target.networkManager.addEventListener(WebInspector.NetworkManager.Event Types.RequestUpdated, this._onRequestUpdated, this); | 134 target.networkManager.addEventListener(WebInspector.NetworkManager.Event Types.RequestUpdated, this._onRequestUpdated, this); |
| 107 target.networkManager.addEventListener(WebInspector.NetworkManager.Event Types.RequestFinished, this._onRequestUpdated, this); | 135 target.networkManager.addEventListener(WebInspector.NetworkManager.Event Types.RequestFinished, this._onRequestUpdated, this); |
| 108 | 136 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 224 this._timelineGrid.element.classList.add("network-timeline-grid"); | 252 this._timelineGrid.element.classList.add("network-timeline-grid"); |
| 225 this._dataGrid.element.appendChild(this._timelineGrid.element); | 253 this._dataGrid.element.appendChild(this._timelineGrid.element); |
| 226 }, | 254 }, |
| 227 | 255 |
| 228 _createTable: function() | 256 _createTable: function() |
| 229 { | 257 { |
| 230 var columns = []; | 258 var columns = []; |
| 231 columns.push({ | 259 columns.push({ |
| 232 id: "name", | 260 id: "name", |
| 233 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Na me"), WebInspector.UIString("Path")), | 261 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Na me"), WebInspector.UIString("Path")), |
| 234 title: WebInspector.UIString("Name"), | 262 title: WebInspector.NetworkLogView._columnTitles["name"], |
| 235 sortable: true, | 263 sortable: true, |
| 236 weight: 20, | 264 weight: 20, |
| 237 disclosure: true | 265 disclosure: true |
| 238 }); | 266 }); |
| 239 | 267 |
| 240 columns.push({ | 268 columns.push({ |
| 241 id: "method", | 269 id: "method", |
| 242 title: WebInspector.UIString("Method"), | 270 title: WebInspector.NetworkLogView._columnTitles["method"], |
| 243 sortable: true, | 271 sortable: true, |
| 244 weight: 6 | 272 weight: 6 |
| 245 }); | 273 }); |
| 246 | 274 |
| 247 columns.push({ | 275 columns.push({ |
| 248 id: "status", | 276 id: "status", |
| 249 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("St atus"), WebInspector.UIString("Text")), | 277 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("St atus"), WebInspector.UIString("Text")), |
| 250 title: WebInspector.UIString("Status"), | 278 title: WebInspector.NetworkLogView._columnTitles["status"], |
| 251 sortable: true, | 279 sortable: true, |
| 252 weight: 6 | 280 weight: 6 |
| 253 }); | 281 }); |
| 254 | 282 |
| 255 columns.push({ | 283 columns.push({ |
| 256 id: "scheme", | 284 id: "scheme", |
| 257 title: WebInspector.UIString("Scheme"), | 285 title: WebInspector.NetworkLogView._columnTitles["scheme"], |
| 258 sortable: true, | 286 sortable: true, |
| 259 weight: 6 | 287 weight: 6 |
| 260 }); | 288 }); |
| 261 | 289 |
| 262 columns.push({ | 290 columns.push({ |
| 263 id: "domain", | 291 id: "domain", |
| 264 title: WebInspector.UIString("Domain"), | 292 title: WebInspector.NetworkLogView._columnTitles["domain"], |
| 265 sortable: true, | 293 sortable: true, |
| 266 weight: 6 | 294 weight: 6 |
| 267 }); | 295 }); |
| 268 | 296 |
| 269 columns.push({ | 297 columns.push({ |
| 270 id: "remoteAddress", | 298 id: "remoteAddress", |
| 271 title: WebInspector.UIString("Remote Address"), | 299 title: WebInspector.NetworkLogView._columnTitles["remoteAddress"], |
| 272 sortable: true, | 300 sortable: true, |
| 273 weight: 10, | 301 weight: 10, |
| 274 align: WebInspector.DataGrid.Align.Right | 302 align: WebInspector.DataGrid.Align.Right |
| 275 }); | 303 }); |
| 276 | 304 |
| 277 columns.push({ | 305 columns.push({ |
| 278 id: "type", | 306 id: "type", |
| 279 title: WebInspector.UIString("Type"), | 307 title: WebInspector.NetworkLogView._columnTitles["type"], |
| 280 sortable: true, | 308 sortable: true, |
| 281 weight: 6 | 309 weight: 6 |
| 282 }); | 310 }); |
| 283 | 311 |
| 284 columns.push({ | 312 columns.push({ |
| 285 id: "initiator", | 313 id: "initiator", |
| 286 title: WebInspector.UIString("Initiator"), | 314 title: WebInspector.NetworkLogView._columnTitles["initiator"], |
| 287 sortable: true, | 315 sortable: true, |
| 288 weight: 10 | 316 weight: 10 |
| 289 }); | 317 }); |
| 290 | 318 |
| 291 columns.push({ | 319 columns.push({ |
| 292 id: "cookies", | 320 id: "cookies", |
| 293 title: WebInspector.UIString("Cookies"), | 321 title: WebInspector.NetworkLogView._columnTitles["cookies"], |
| 294 sortable: true, | 322 sortable: true, |
| 295 weight: 6, | 323 weight: 6, |
| 296 align: WebInspector.DataGrid.Align.Right | 324 align: WebInspector.DataGrid.Align.Right |
| 297 }); | 325 }); |
| 298 | 326 |
| 299 columns.push({ | 327 columns.push({ |
| 300 id: "setCookies", | 328 id: "setCookies", |
| 301 title: WebInspector.UIString("Set-Cookies"), | 329 title: WebInspector.NetworkLogView._columnTitles["setCookies"], |
| 302 sortable: true, | 330 sortable: true, |
| 303 weight: 6, | 331 weight: 6, |
| 304 align: WebInspector.DataGrid.Align.Right | 332 align: WebInspector.DataGrid.Align.Right |
| 305 }); | 333 }); |
| 306 | 334 |
| 307 columns.push({ | 335 columns.push({ |
| 308 id: "size", | 336 id: "size", |
| 309 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Si ze"), WebInspector.UIString("Content")), | 337 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Si ze"), WebInspector.UIString("Content")), |
| 310 title: WebInspector.UIString("Size"), | 338 title: WebInspector.NetworkLogView._columnTitles["size"], |
| 311 sortable: true, | 339 sortable: true, |
| 312 weight: 6, | 340 weight: 6, |
| 313 align: WebInspector.DataGrid.Align.Right | 341 align: WebInspector.DataGrid.Align.Right |
| 314 }); | 342 }); |
| 315 | 343 |
| 316 columns.push({ | 344 columns.push({ |
| 317 id: "time", | 345 id: "time", |
| 318 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Ti me"), WebInspector.UIString("Latency")), | 346 titleDOMFragment: this._makeHeaderFragment(WebInspector.UIString("Ti me"), WebInspector.UIString("Latency")), |
| 319 title: WebInspector.UIString("Time"), | 347 title: WebInspector.NetworkLogView._columnTitles["time"], |
| 320 sortable: true, | 348 sortable: true, |
| 321 weight: 6, | 349 weight: 6, |
| 322 align: WebInspector.DataGrid.Align.Right | 350 align: WebInspector.DataGrid.Align.Right |
| 323 }); | 351 }); |
| 324 | 352 |
| 325 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns; | 353 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns; |
| 326 for (var i = 0; i < responseHeaderColumns.length; ++i) { | 354 for (var i = 0; i < responseHeaderColumns.length; ++i) { |
| 327 var headerName = responseHeaderColumns[i]; | 355 var headerName = responseHeaderColumns[i]; |
| 328 var descriptor = { | 356 var descriptor = { |
| 329 id: headerName, | 357 id: headerName, |
| 330 title: WebInspector.UIString(headerName), | 358 title: WebInspector.NetworkLogView._columnTitles[headerName], |
| 331 weight: 6 | 359 weight: 6 |
| 332 } | 360 } |
| 333 if (headerName === "Content-Length") | 361 if (headerName === "Content-Length") |
| 334 descriptor.align = WebInspector.DataGrid.Align.Right; | 362 descriptor.align = WebInspector.DataGrid.Align.Right; |
| 335 columns.push(descriptor); | 363 columns.push(descriptor); |
| 336 } | 364 } |
| 337 | 365 |
| 338 columns.push({ | 366 columns.push({ |
| 339 id: "timeline", | 367 id: "timeline", |
| 340 titleDOMFragment: document.createDocumentFragment(), | 368 titleDOMFragment: document.createDocumentFragment(), |
| 341 title: WebInspector.UIString("Timeline"), | 369 title: WebInspector.UIString("timeline"), |
|
yurys
2014/06/02 09:16:21
Why not NetworkLogView._columnTitles["timeline"] ?
eustas
2014/06/02 09:43:18
Done.
| |
| 342 sortable: false, | 370 sortable: false, |
| 343 weight: 40, | 371 weight: 40, |
| 344 sort: WebInspector.DataGrid.Order.Ascending | 372 sort: WebInspector.DataGrid.Order.Ascending |
| 345 }); | 373 }); |
| 346 | 374 |
| 347 this._dataGrid = new WebInspector.DataGrid(columns); | 375 this._dataGrid = new WebInspector.DataGrid(columns); |
| 376 this._updateColumns(); | |
| 348 this._dataGrid.setName("networkLog"); | 377 this._dataGrid.setName("networkLog"); |
| 349 this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last; | 378 this._dataGrid.resizeMethod = WebInspector.DataGrid.ResizeMethod.Last; |
| 350 this._dataGrid.element.classList.add("network-log-grid"); | 379 this._dataGrid.element.classList.add("network-log-grid"); |
| 351 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); | 380 this._dataGrid.element.addEventListener("contextmenu", this._contextMenu .bind(this), true); |
| 352 this._dataGrid.show(this.element); | 381 this._dataGrid.show(this.element); |
| 353 | 382 |
| 354 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. | 383 // Event listeners need to be added _after_ we attach to the document, s o that owner document is properly update. |
| 355 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); | 384 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortItems, this); |
| 356 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); | 385 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.ColumnsResi zed, this._updateDividersIfNeeded, this); |
| 357 | 386 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 this._needsRefresh = true; | 582 this._needsRefresh = true; |
| 554 | 583 |
| 555 if (this.isShowing() && !this._refreshTimeout) | 584 if (this.isShowing() && !this._refreshTimeout) |
| 556 this._refreshTimeout = setTimeout(this.refresh.bind(this), WebInspec tor.NetworkLogView._defaultRefreshDelay); | 585 this._refreshTimeout = setTimeout(this.refresh.bind(this), WebInspec tor.NetworkLogView._defaultRefreshDelay); |
| 557 }, | 586 }, |
| 558 | 587 |
| 559 _updateDividersIfNeeded: function() | 588 _updateDividersIfNeeded: function() |
| 560 { | 589 { |
| 561 if (!this._dataGrid) | 590 if (!this._dataGrid) |
| 562 return; | 591 return; |
| 563 var timelineColumn = this._dataGrid.columns.timeline; | 592 var timelineOffset = this._dataGrid.columnOffset("timeline"); |
| 564 for (var i = 0; i < this._dataGrid.resizers.length; ++i) { | 593 // Position timline grid location. |
| 565 if (timelineColumn.ordinal === this._dataGrid.resizers[i].rightNeigh boringColumnIndex) { | 594 if (timelineOffset) |
| 566 // Position timline grid location. | 595 this._timelineGrid.element.style.left = timelineOffset + "px"; |
| 567 this._timelineGrid.element.style.left = this._dataGrid.resizers[ i].style.left; | |
| 568 } | |
| 569 } | |
| 570 | 596 |
| 571 var proceed = true; | 597 var proceed = true; |
| 572 if (!this.isShowing()) { | 598 if (!this.isShowing()) { |
| 573 this._scheduleRefresh(); | 599 this._scheduleRefresh(); |
| 574 proceed = false; | 600 proceed = false; |
| 575 } else { | 601 } else { |
| 576 this.calculator.setDisplayWindow(this._timelineGrid.dividersElement. clientWidth); | 602 this.calculator.setDisplayWindow(this._timelineGrid.dividersElement. clientWidth); |
| 577 proceed = this._timelineGrid.updateDividers(this.calculator); | 603 proceed = this._timelineGrid.updateDividers(this.calculator); |
| 578 } | 604 } |
| 579 if (!proceed) | 605 if (!proceed) |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 } | 755 } |
| 730 | 756 |
| 731 for (var requestId in this._staleRequests) { | 757 for (var requestId in this._staleRequests) { |
| 732 var request = this._staleRequests[requestId]; | 758 var request = this._staleRequests[requestId]; |
| 733 var node = this._requestGridNode(request); | 759 var node = this._requestGridNode(request); |
| 734 if (!node) { | 760 if (!node) { |
| 735 // Create the timeline tree element and graph. | 761 // Create the timeline tree element and graph. |
| 736 node = this._createRequestGridNode(request); | 762 node = this._createRequestGridNode(request); |
| 737 this._dataGrid.rootNode().appendChild(node); | 763 this._dataGrid.rootNode().appendChild(node); |
| 738 } | 764 } |
| 739 node.refreshRequest(); | 765 node.refresh(); |
| 740 this._applyFilter(node); | 766 this._applyFilter(node); |
| 741 | 767 |
| 742 if (this.calculator.updateBoundaries(request)) | 768 if (this.calculator.updateBoundaries(request)) |
| 743 boundariesChanged = true; | 769 boundariesChanged = true; |
| 744 | 770 |
| 745 if (!node.isFilteredOut()) | 771 if (!node.isFilteredOut()) |
| 746 this._updateHighlightIfMatched(request); | 772 this._updateHighlightIfMatched(request); |
| 747 } | 773 } |
| 748 | 774 |
| 749 if (boundariesChanged) { | 775 if (boundariesChanged) { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 row.createChild("td").textContent = stackFrame.functionName || WebIn spector.UIString("(anonymous function)"); | 1019 row.createChild("td").textContent = stackFrame.functionName || WebIn spector.UIString("(anonymous function)"); |
| 994 row.createChild("td").textContent = " @ "; | 1020 row.createChild("td").textContent = " @ "; |
| 995 row.createChild("td").appendChild(this._linkifier.linkifyLocation(re quest.target(), stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumb er - 1)); | 1021 row.createChild("td").appendChild(this._linkifier.linkifyLocation(re quest.target(), stackFrame.url, stackFrame.lineNumber - 1, stackFrame.columnNumb er - 1)); |
| 996 framesTable.appendChild(row); | 1022 framesTable.appendChild(row); |
| 997 } | 1023 } |
| 998 return framesTable; | 1024 return framesTable; |
| 999 }, | 1025 }, |
| 1000 | 1026 |
| 1001 _updateColumns: function() | 1027 _updateColumns: function() |
| 1002 { | 1028 { |
| 1003 var columnsVisibility = this._coulmnsVisibilitySetting.get(); | |
| 1004 var detailedMode = !!this._detailedMode; | 1029 var detailedMode = !!this._detailedMode; |
| 1005 for (var columnIdentifier in columnsVisibility) { | 1030 var visibleColumns = {"name": true}; |
| 1006 var visible = detailedMode && columnsVisibility[columnIdentifier]; | 1031 if (detailedMode) { |
| 1007 this._dataGrid.setColumnVisible(columnIdentifier, visible); | 1032 visibleColumns["timeline"] = true; |
| 1033 var columnsVisibility = this._coulmnsVisibilitySetting.get(); | |
| 1034 for (var columnIdentifier in columnsVisibility) | |
| 1035 visibleColumns[columnIdentifier] = columnsVisibility[columnIdent ifier]; | |
| 1008 } | 1036 } |
| 1009 this._dataGrid.setColumnVisible("timeline", detailedMode); | 1037 |
| 1010 this._dataGrid.applyColumnWeights(); | 1038 this._dataGrid.setColumnsVisiblity(visibleColumns); |
| 1011 }, | 1039 }, |
| 1012 | 1040 |
| 1013 /** | 1041 /** |
| 1014 * @param {string} columnIdentifier | 1042 * @param {string} columnIdentifier |
| 1015 */ | 1043 */ |
| 1016 _toggleColumnVisibility: function(columnIdentifier) | 1044 _toggleColumnVisibility: function(columnIdentifier) |
| 1017 { | 1045 { |
| 1018 var columnsVisibility = this._coulmnsVisibilitySetting.get(); | 1046 var columnsVisibility = this._coulmnsVisibilitySetting.get(); |
| 1019 columnsVisibility[columnIdentifier] = !columnsVisibility[columnIdentifie r]; | 1047 columnsVisibility[columnIdentifier] = !columnsVisibility[columnIdentifie r]; |
| 1020 this._coulmnsVisibilitySetting.set(columnsVisibility); | 1048 this._coulmnsVisibilitySetting.set(columnsVisibility); |
| 1021 | 1049 |
| 1022 this._updateColumns(); | 1050 this._updateColumns(); |
| 1023 }, | 1051 }, |
| 1024 | 1052 |
| 1025 /** | 1053 /** |
| 1026 * @return {!Array.<string>} | 1054 * @return {!Array.<string>} |
| 1027 */ | 1055 */ |
| 1028 _getConfigurableColumnIDs: function() | 1056 _getConfigurableColumnIDs: function() |
| 1029 { | 1057 { |
| 1030 if (this._configurableColumnIDs) | 1058 if (this._configurableColumnIDs) |
| 1031 return this._configurableColumnIDs; | 1059 return this._configurableColumnIDs; |
| 1032 | 1060 |
| 1033 var columns = this._dataGrid.columns; | 1061 var columnTitles = WebInspector.NetworkLogView._columnTitles; |
| 1034 function compare(id1, id2) | 1062 function compare(id1, id2) |
| 1035 { | 1063 { |
| 1036 return columns[id1].title.compareTo(columns[id2].title); | 1064 return columnTitles[id1].compareTo(columnTitles[id2]); |
| 1037 } | 1065 } |
| 1038 | 1066 |
| 1039 var columnIDs = Object.keys(this._coulmnsVisibilitySetting.get()); | 1067 var columnIDs = Object.keys(this._coulmnsVisibilitySetting.get()); |
| 1040 this._configurableColumnIDs = columnIDs.sort(compare); | 1068 this._configurableColumnIDs = columnIDs.sort(compare); |
| 1041 return this._configurableColumnIDs; | 1069 return this._configurableColumnIDs; |
| 1042 }, | 1070 }, |
| 1043 | 1071 |
| 1044 _contextMenu: function(event) | 1072 _contextMenu: function(event) |
| 1045 { | 1073 { |
| 1046 var contextMenu = new WebInspector.ContextMenu(event); | 1074 var contextMenu = new WebInspector.ContextMenu(event); |
| 1047 | 1075 |
| 1048 if (this._detailedMode && event.target.isSelfOrDescendant(this._dataGrid .headerTableBody)) { | 1076 if (this._detailedMode && event.target.isSelfOrDescendant(this._dataGrid .headerTableBody)) { |
| 1049 var columnsVisibility = this._coulmnsVisibilitySetting.get(); | 1077 var columnsVisibility = this._coulmnsVisibilitySetting.get(); |
| 1050 var columnIDs = this._getConfigurableColumnIDs(); | 1078 var columnIDs = this._getConfigurableColumnIDs(); |
| 1079 var columnTitles = WebInspector.NetworkLogView._columnTitles; | |
| 1051 for (var i = 0; i < columnIDs.length; ++i) { | 1080 for (var i = 0; i < columnIDs.length; ++i) { |
| 1052 var columnIdentifier = columnIDs[i]; | 1081 var columnIdentifier = columnIDs[i]; |
| 1053 var column = this._dataGrid.columns[columnIdentifier]; | 1082 contextMenu.appendCheckboxItem(columnTitles[columnIdentifier], t his._toggleColumnVisibility.bind(this, columnIdentifier), !!columnsVisibility[co lumnIdentifier]); |
| 1054 contextMenu.appendCheckboxItem(column.title, this._toggleColumnV isibility.bind(this, columnIdentifier), !!columnsVisibility[columnIdentifier]); | |
| 1055 } | 1083 } |
| 1056 contextMenu.show(); | 1084 contextMenu.show(); |
| 1057 return; | 1085 return; |
| 1058 } | 1086 } |
| 1059 | 1087 |
| 1060 var gridNode = this._dataGrid.dataGridNodeFromNode(event.target); | 1088 var gridNode = this._dataGrid.dataGridNodeFromNode(event.target); |
| 1061 var request = gridNode && gridNode._request; | 1089 var request = gridNode && gridNode._request; |
| 1062 | 1090 |
| 1063 /** | 1091 /** |
| 1064 * @param {string} url | 1092 * @param {string} url |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2407 WebInspector.DataGridNode.call(this, {}); | 2435 WebInspector.DataGridNode.call(this, {}); |
| 2408 this._parentView = parentView; | 2436 this._parentView = parentView; |
| 2409 this._request = request; | 2437 this._request = request; |
| 2410 this._linkifier = new WebInspector.Linkifier(); | 2438 this._linkifier = new WebInspector.Linkifier(); |
| 2411 } | 2439 } |
| 2412 | 2440 |
| 2413 WebInspector.NetworkDataGridNode.prototype = { | 2441 WebInspector.NetworkDataGridNode.prototype = { |
| 2414 /** override */ | 2442 /** override */ |
| 2415 createCells: function() | 2443 createCells: function() |
| 2416 { | 2444 { |
| 2417 this._nameCell = this._createCell("name"); | 2445 this._nameCell = null; |
| 2418 this._methodCell = this._createCell("method"); | 2446 this._timelineCell = null; |
| 2419 this._statusCell = this._createCell("status"); | |
| 2420 this._schemeCell = this._createCell("scheme"); | |
| 2421 this._domainCell = this._createCell("domain"); | |
| 2422 this._remoteAddressCell = this._createCell("remoteAddress"); | |
| 2423 this._typeCell = this._createCell("type"); | |
| 2424 this._initiatorCell = this._createCell("initiator"); | |
| 2425 this._cookiesCell = this._createCell("cookies"); | |
| 2426 this._setCookiesCell = this._createCell("setCookies"); | |
| 2427 this._sizeCell = this._createCell("size"); | |
| 2428 this._timeCell = this._createCell("time"); | |
| 2429 | 2447 |
| 2430 this._responseHeaderCells = {}; | 2448 var element = this._element; |
| 2431 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns; | 2449 element.classList.toggle("network-error-row", this._isFailed()); |
| 2432 for (var i = 0; i < responseHeaderColumns.length; ++i) | 2450 element.classList.toggle("resource-cached", this._request.cached); |
| 2433 this._responseHeaderCells[responseHeaderColumns[i]] = this._createCe ll(responseHeaderColumns[i]); | 2451 var typeClassName = "network-type-" + this._request.type.name(); |
| 2452 if (!element.classList.contains(typeClassName)) { | |
| 2453 element.removeMatchingStyleClasses("network-type-\\w+"); | |
| 2454 element.classList.add(typeClassName); | |
| 2455 } | |
| 2434 | 2456 |
| 2435 var timelineCell = this._createCell("timeline"); | 2457 WebInspector.DataGridNode.prototype.createCells.call(this); |
| 2436 this._timelineCell = timelineCell.createChild("div"); | 2458 |
| 2437 this._createTimelineBar(this._timelineCell); | 2459 this.refreshGraph(this._parentView.calculator); |
| 2438 this._nameCell.addEventListener("click", this._onClick.bind(this), false ); | 2460 }, |
| 2439 this._nameCell.addEventListener("dblclick", this._openInNewTab.bind(this ), false); | 2461 |
| 2462 /** | |
| 2463 * @override | |
| 2464 * @param {string} columnIdentifier | |
| 2465 * @return {!Element} | |
| 2466 */ | |
| 2467 createCell: function(columnIdentifier) | |
| 2468 { | |
| 2469 var cell = this.createTD(columnIdentifier); | |
| 2470 switch (columnIdentifier) { | |
| 2471 case "name": this._renderNameCell(cell); break; | |
| 2472 case "timeline": this._createTimelineBar(cell); break; | |
| 2473 case "method": cell.setTextAndTitle(this._request.requestMethod); break; | |
| 2474 case "scheme": cell.setTextAndTitle(this._request.scheme); break; | |
| 2475 case "domain": cell.setTextAndTitle(this._request.domain); break; | |
| 2476 case "remoteAddress": cell.setTextAndTitle(this._request.remoteAddress() ); break; | |
| 2477 case "cookies": cell.setTextAndTitle(this._arrayLength(this._request.req uestCookies)); break; | |
| 2478 case "setCookies": cell.setTextAndTitle(this._arrayLength(this._request. responseCookies)); break; | |
| 2479 case "type": this._renderTypeCell(cell); break; | |
| 2480 case "initiator": this._renderInitiatorCell(cell); break; | |
| 2481 case "size": this._renderSizeCell(cell); break; | |
| 2482 case "time": this._renderTimeCell(cell); break; | |
| 2483 default: cell.setTextAndTitle(this._request.responseHeaderValue(columnId entifier) || ""); break; | |
| 2484 } | |
| 2485 | |
| 2486 return cell; | |
| 2487 }, | |
| 2488 | |
| 2489 /** | |
| 2490 * @param array {?Array} | |
| 2491 * @return {string} | |
| 2492 */ | |
| 2493 _arrayLength: function(array) | |
| 2494 { | |
| 2495 return array ? "" + array.length : ""; | |
| 2440 }, | 2496 }, |
| 2441 | 2497 |
| 2442 wasDetached: function() | 2498 wasDetached: function() |
| 2443 { | 2499 { |
| 2444 this._linkifier.reset(); | 2500 this._linkifier.reset(); |
| 2445 }, | 2501 }, |
| 2446 | 2502 |
| 2447 /** | 2503 /** |
| 2448 * @return {boolean} | 2504 * @return {boolean} |
| 2449 */ | 2505 */ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2481 _openInNewTab: function() | 2537 _openInNewTab: function() |
| 2482 { | 2538 { |
| 2483 InspectorFrontendHost.openInNewTab(this._request.url); | 2539 InspectorFrontendHost.openInNewTab(this._request.url); |
| 2484 }, | 2540 }, |
| 2485 | 2541 |
| 2486 get selectable() | 2542 get selectable() |
| 2487 { | 2543 { |
| 2488 return this._parentView._allowRequestSelection && !this.isFilteredOut(); | 2544 return this._parentView._allowRequestSelection && !this.isFilteredOut(); |
| 2489 }, | 2545 }, |
| 2490 | 2546 |
| 2491 _createCell: function(columnIdentifier) | |
| 2492 { | |
| 2493 var td = this.createTD(columnIdentifier); | |
| 2494 this._element.appendChild(td); | |
| 2495 return td; | |
| 2496 }, | |
| 2497 | |
| 2498 /** | 2547 /** |
| 2499 * @param {!Element} cell | 2548 * @param {!Element} cell |
| 2500 */ | 2549 */ |
| 2501 _createTimelineBar: function(cell) | 2550 _createTimelineBar: function(cell) |
| 2502 { | 2551 { |
| 2552 cell = cell.createChild("div"); | |
| 2553 this._timelineCell = cell; | |
| 2554 | |
| 2503 cell.className = "network-graph-side"; | 2555 cell.className = "network-graph-side"; |
| 2504 | 2556 |
| 2505 this._barAreaElement = document.createElement("div"); | 2557 this._barAreaElement = document.createElement("div"); |
| 2506 // this._barAreaElement.className = "network-graph-bar-area hidden"; | 2558 // this._barAreaElement.className = "network-graph-bar-area hidden"; |
| 2507 this._barAreaElement.className = "network-graph-bar-area"; | 2559 this._barAreaElement.className = "network-graph-bar-area"; |
| 2508 this._barAreaElement.request = this._request; | 2560 this._barAreaElement.request = this._request; |
| 2509 cell.appendChild(this._barAreaElement); | 2561 cell.appendChild(this._barAreaElement); |
| 2510 | 2562 |
| 2511 this._barLeftElement = document.createElement("div"); | 2563 this._barLeftElement = document.createElement("div"); |
| 2512 this._barLeftElement.className = "network-graph-bar waiting"; | 2564 this._barLeftElement.className = "network-graph-bar waiting"; |
| 2513 this._barAreaElement.appendChild(this._barLeftElement); | 2565 this._barAreaElement.appendChild(this._barLeftElement); |
| 2514 | 2566 |
| 2515 this._barRightElement = document.createElement("div"); | 2567 this._barRightElement = document.createElement("div"); |
| 2516 this._barRightElement.className = "network-graph-bar"; | 2568 this._barRightElement.className = "network-graph-bar"; |
| 2517 this._barAreaElement.appendChild(this._barRightElement); | 2569 this._barAreaElement.appendChild(this._barRightElement); |
| 2518 | 2570 |
| 2519 | 2571 |
| 2520 this._labelLeftElement = document.createElement("div"); | 2572 this._labelLeftElement = document.createElement("div"); |
| 2521 this._labelLeftElement.className = "network-graph-label waiting"; | 2573 this._labelLeftElement.className = "network-graph-label waiting"; |
| 2522 this._barAreaElement.appendChild(this._labelLeftElement); | 2574 this._barAreaElement.appendChild(this._labelLeftElement); |
| 2523 | 2575 |
| 2524 this._labelRightElement = document.createElement("div"); | 2576 this._labelRightElement = document.createElement("div"); |
| 2525 this._labelRightElement.className = "network-graph-label"; | 2577 this._labelRightElement.className = "network-graph-label"; |
| 2526 this._barAreaElement.appendChild(this._labelRightElement); | 2578 this._barAreaElement.appendChild(this._labelRightElement); |
| 2527 | 2579 |
| 2528 cell.addEventListener("mouseover", this._refreshLabelPositions.bind(this ), false); | 2580 cell.addEventListener("mouseover", this._refreshLabelPositions.bind(this ), false); |
| 2529 }, | 2581 }, |
| 2530 | 2582 |
| 2531 refreshRequest: function() | |
| 2532 { | |
| 2533 this._refreshNameCell(); | |
| 2534 this._refreshMethodCell(); | |
| 2535 this._refreshStatusCell(); | |
| 2536 this._refreshSchemeCell(); | |
| 2537 this._refreshDomainCell(); | |
| 2538 this._refreshRemoteAddressCell(); | |
| 2539 this._refreshTypeCell(); | |
| 2540 this._refreshInitiatorCell(); | |
| 2541 this._refreshCookiesCell(); | |
| 2542 this._refreshSetCookiesCell(); | |
| 2543 this._refreshSizeCell(); | |
| 2544 this._refreshTimeCell(); | |
| 2545 | |
| 2546 var responseHeaderColumns = WebInspector.NetworkLogView._responseHeaderC olumns; | |
| 2547 for (var i = 0; i < responseHeaderColumns.length; ++i) | |
| 2548 this._refreshResponseHeaderCell(responseHeaderColumns[i]); | |
| 2549 | |
| 2550 this._updateElementStyleClasses(); | |
| 2551 }, | |
| 2552 | |
| 2553 /** | 2583 /** |
| 2554 * @return {boolean} | 2584 * @return {boolean} |
| 2555 */ | 2585 */ |
| 2556 _isFailed: function() | 2586 _isFailed: function() |
| 2557 { | 2587 { |
| 2558 return !!this._request.failed || (this._request.statusCode >= 400); | 2588 return !!this._request.failed || (this._request.statusCode >= 400); |
| 2559 }, | 2589 }, |
| 2560 | 2590 |
| 2561 _updateElementStyleClasses: function() | 2591 /** |
| 2592 * @param {!Element} cell | |
| 2593 */ | |
| 2594 _renderNameCell: function(cell) | |
| 2562 { | 2595 { |
| 2563 var element = this._element; | 2596 this._nameCell = cell; |
| 2564 element.classList.toggle("network-error-row", this._isFailed()); | 2597 cell.addEventListener("click", this._onClick.bind(this), false); |
| 2565 element.classList.toggle("resource-cached", this._request.cached); | 2598 cell.addEventListener("dblclick", this._openInNewTab.bind(this), false); |
| 2566 var typeClassName = "network-type-" + this._request.type.name(); | |
| 2567 if (!element.classList.contains(typeClassName)) { | |
| 2568 element.removeMatchingStyleClasses("network-type-\\w+"); | |
| 2569 element.classList.add(typeClassName); | |
| 2570 } | |
| 2571 }, | |
| 2572 | |
| 2573 _refreshResponseHeaderCell: function(headerName) | |
| 2574 { | |
| 2575 var cell = this._responseHeaderCells[headerName]; | |
| 2576 var value = this._request.responseHeaderValue(headerName); | |
| 2577 cell.setTextAndTitle(value ? value : ""); | |
| 2578 }, | |
| 2579 | |
| 2580 _refreshNameCell: function() | |
| 2581 { | |
| 2582 this._nameCell.removeChildren(); | |
| 2583 | 2599 |
| 2584 if (this._request.type === WebInspector.resourceTypes.Image) { | 2600 if (this._request.type === WebInspector.resourceTypes.Image) { |
| 2585 var previewImage = document.createElement("img"); | 2601 var previewImage = document.createElement("img"); |
| 2586 previewImage.className = "image-network-icon-preview"; | 2602 previewImage.className = "image-network-icon-preview"; |
| 2587 this._request.populateImageSource(previewImage); | 2603 this._request.populateImageSource(previewImage); |
| 2588 | 2604 |
| 2589 var iconElement = document.createElement("div"); | 2605 var iconElement = document.createElement("div"); |
| 2590 iconElement.className = "icon"; | 2606 iconElement.className = "icon"; |
| 2591 iconElement.appendChild(previewImage); | 2607 iconElement.appendChild(previewImage); |
| 2592 } else { | 2608 } else { |
| 2593 var iconElement = document.createElement("img"); | 2609 var iconElement = document.createElement("img"); |
| 2594 iconElement.className = "icon"; | 2610 iconElement.className = "icon"; |
| 2595 } | 2611 } |
| 2596 this._nameCell.appendChild(iconElement); | 2612 cell.appendChild(iconElement); |
| 2597 this._nameCell.appendChild(document.createTextNode(this._request.name()) ); | 2613 cell.appendChild(document.createTextNode(this._request.name())); |
| 2598 this._appendSubtitle(this._nameCell, this._request.path()); | 2614 this._appendSubtitle(cell, this._request.path()); |
| 2599 this._nameCell.title = this._request.url; | 2615 cell.title = this._request.url; |
| 2600 }, | 2616 }, |
| 2601 | 2617 |
| 2602 _refreshMethodCell: function() | 2618 /** |
| 2619 * @param {!Element} cell | |
| 2620 */ | |
| 2621 _renderStatusCell: function(cell) | |
| 2603 { | 2622 { |
| 2604 this._methodCell.setTextAndTitle(this._request.requestMethod); | 2623 cell.classList.toggle("network-dim-cell", !this._isFailed() && (this._re quest.cached || !this._request.statusCode)); |
| 2605 }, | |
| 2606 | |
| 2607 _refreshStatusCell: function() | |
| 2608 { | |
| 2609 this._statusCell.removeChildren(); | |
| 2610 this._statusCell.classList.toggle("network-dim-cell", !this._isFailed() && (this._request.cached || !this._request.statusCode)); | |
| 2611 | 2624 |
| 2612 if (this._request.failed && !this._request.canceled) { | 2625 if (this._request.failed && !this._request.canceled) { |
| 2613 var failText = WebInspector.UIString("(failed)"); | 2626 var failText = WebInspector.UIString("(failed)"); |
| 2614 if (this._request.localizedFailDescription) { | 2627 if (this._request.localizedFailDescription) { |
| 2615 this._statusCell.appendChild(document.createTextNode(failText)); | 2628 cell.appendChild(document.createTextNode(failText)); |
| 2616 this._appendSubtitle(this._statusCell, this._request.localizedFa ilDescription); | 2629 this._appendSubtitle(cell, this._request.localizedFailDescriptio n); |
| 2617 this._statusCell.title = failText + " " + this._request.localize dFailDescription; | 2630 cell.title = failText + " " + this._request.localizedFailDescrip tion; |
| 2618 } else | 2631 } else |
| 2619 this._statusCell.setTextAndTitle(failText); | 2632 cell.setTextAndTitle(failText); |
| 2620 } else if (this._request.statusCode) { | 2633 } else if (this._request.statusCode) { |
| 2621 this._statusCell.appendChild(document.createTextNode("" + this._requ est.statusCode)); | 2634 cell.appendChild(document.createTextNode("" + this._request.statusCo de)); |
| 2622 this._appendSubtitle(this._statusCell, this._request.statusText); | 2635 this._appendSubtitle(cell, this._request.statusText); |
| 2623 this._statusCell.title = this._request.statusCode + " " + this._requ est.statusText; | 2636 cell.title = this._request.statusCode + " " + this._request.statusTe xt; |
| 2624 } else if (this._request.parsedURL.isDataURL()) { | 2637 } else if (this._request.parsedURL.isDataURL()) { |
| 2625 this._statusCell.setTextAndTitle(WebInspector.UIString("(data)")); | 2638 cell.setTextAndTitle(WebInspector.UIString("(data)")); |
| 2626 } else if (this._request.isPingRequest()) { | 2639 } else if (this._request.isPingRequest()) { |
| 2627 this._statusCell.setTextAndTitle(WebInspector.UIString("(ping)")); | 2640 cell.setTextAndTitle(WebInspector.UIString("(ping)")); |
| 2628 } else if (this._request.canceled) { | 2641 } else if (this._request.canceled) { |
| 2629 this._statusCell.setTextAndTitle(WebInspector.UIString("(canceled)") ); | 2642 cell.setTextAndTitle(WebInspector.UIString("(canceled)")); |
| 2630 } else if (this._request.finished) { | 2643 } else if (this._request.finished) { |
| 2631 this._statusCell.setTextAndTitle(WebInspector.UIString("Finished")); | 2644 cell.setTextAndTitle(WebInspector.UIString("Finished")); |
| 2632 } else { | 2645 } else { |
| 2633 this._statusCell.setTextAndTitle(WebInspector.UIString("(pending)")) ; | 2646 cell.setTextAndTitle(WebInspector.UIString("(pending)")); |
| 2634 } | 2647 } |
| 2635 }, | 2648 }, |
| 2636 | 2649 |
| 2637 _refreshSchemeCell: function() | 2650 /** |
| 2638 { | 2651 * @param {!Element} cell |
| 2639 this._schemeCell.setTextAndTitle(this._request.scheme); | 2652 */ |
| 2640 }, | 2653 _renderTypeCell: function(cell) |
| 2641 | |
| 2642 _refreshDomainCell: function() | |
| 2643 { | |
| 2644 this._domainCell.setTextAndTitle(this._request.domain); | |
| 2645 }, | |
| 2646 | |
| 2647 _refreshRemoteAddressCell: function() | |
| 2648 { | |
| 2649 this._remoteAddressCell.setTextAndTitle(this._request.remoteAddress()); | |
| 2650 }, | |
| 2651 | |
| 2652 _refreshTypeCell: function() | |
| 2653 { | 2654 { |
| 2654 if (this._request.mimeType) { | 2655 if (this._request.mimeType) { |
| 2655 this._typeCell.classList.remove("network-dim-cell"); | 2656 cell.setTextAndTitle(this._request.mimeType); |
| 2656 this._typeCell.setTextAndTitle(this._request.mimeType); | |
| 2657 } else { | 2657 } else { |
| 2658 this._typeCell.classList.toggle("network-dim-cell", !this._request.i sPingRequest()); | 2658 cell.classList.toggle("network-dim-cell", !this._request.isPingReque st()); |
| 2659 this._typeCell.setTextAndTitle(this._request.requestContentType() || ""); | 2659 cell.setTextAndTitle(this._request.requestContentType() || ""); |
| 2660 } | 2660 } |
| 2661 }, | 2661 }, |
| 2662 | 2662 |
| 2663 _refreshInitiatorCell: function() | 2663 /** |
| 2664 * @param {!Element} cell | |
| 2665 */ | |
| 2666 _renderInitiatorCell: function(cell) | |
| 2664 { | 2667 { |
| 2665 this._initiatorCell.removeChildren(); | |
| 2666 this._initiatorCell.classList.remove("network-dim-cell"); | |
| 2667 this._initiatorCell.classList.remove("network-script-initiated"); | |
| 2668 delete this._initiatorCell.request; | |
| 2669 | |
| 2670 var request = this._request; | 2668 var request = this._request; |
| 2671 var initiator = request.initiatorInfo(); | 2669 var initiator = request.initiatorInfo(); |
| 2672 | 2670 |
| 2673 switch (initiator.type) { | 2671 switch (initiator.type) { |
| 2674 case WebInspector.NetworkRequest.InitiatorType.Parser: | 2672 case WebInspector.NetworkRequest.InitiatorType.Parser: |
| 2675 this._initiatorCell.title = initiator.url + ":" + initiator.lineNumb er; | 2673 cell.title = initiator.url + ":" + initiator.lineNumber; |
| 2676 this._initiatorCell.appendChild(WebInspector.linkifyResourceAsNode(i nitiator.url, initiator.lineNumber - 1)); | 2674 cell.appendChild(WebInspector.linkifyResourceAsNode(initiator.url, i nitiator.lineNumber - 1)); |
| 2677 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Par ser")); | 2675 this._appendSubtitle(cell, WebInspector.UIString("Parser")); |
| 2678 break; | 2676 break; |
| 2679 | 2677 |
| 2680 case WebInspector.NetworkRequest.InitiatorType.Redirect: | 2678 case WebInspector.NetworkRequest.InitiatorType.Redirect: |
| 2681 this._initiatorCell.title = initiator.url; | 2679 cell.title = initiator.url; |
| 2682 console.assert(request.redirectSource); | 2680 console.assert(request.redirectSource); |
| 2683 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource); | 2681 var redirectSource = /** @type {!WebInspector.NetworkRequest} */ (re quest.redirectSource); |
| 2684 this._initiatorCell.appendChild(WebInspector.linkifyRequestAsNode(re directSource)); | 2682 cell.appendChild(WebInspector.linkifyRequestAsNode(redirectSource)); |
| 2685 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Red irect")); | 2683 this._appendSubtitle(cell, WebInspector.UIString("Redirect")); |
| 2686 break; | 2684 break; |
| 2687 | 2685 |
| 2688 case WebInspector.NetworkRequest.InitiatorType.Script: | 2686 case WebInspector.NetworkRequest.InitiatorType.Script: |
| 2689 var urlElement = this._linkifier.linkifyLocation(request.target(), i nitiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1); | 2687 var urlElement = this._linkifier.linkifyLocation(request.target(), i nitiator.url, initiator.lineNumber - 1, initiator.columnNumber - 1); |
| 2690 urlElement.title = ""; | 2688 urlElement.title = ""; |
| 2691 this._initiatorCell.appendChild(urlElement); | 2689 cell.appendChild(urlElement); |
| 2692 this._appendSubtitle(this._initiatorCell, WebInspector.UIString("Scr ipt")); | 2690 this._appendSubtitle(cell, WebInspector.UIString("Script")); |
| 2693 this._initiatorCell.classList.add("network-script-initiated"); | 2691 cell.classList.add("network-script-initiated"); |
| 2694 this._initiatorCell.request = request; | 2692 cell.request = request; |
| 2695 break; | 2693 break; |
| 2696 | 2694 |
| 2697 default: | 2695 default: |
| 2698 this._initiatorCell.title = ""; | 2696 cell.title = ""; |
| 2699 this._initiatorCell.classList.add("network-dim-cell"); | 2697 cell.classList.add("network-dim-cell"); |
| 2700 this._initiatorCell.setTextAndTitle(WebInspector.UIString("Other")); | 2698 cell.setTextAndTitle(WebInspector.UIString("Other")); |
| 2701 } | 2699 } |
| 2702 }, | 2700 }, |
| 2703 | 2701 |
| 2704 _refreshCookiesCell: function() | 2702 /** |
| 2705 { | 2703 * @param {!Element} cell |
| 2706 var requestCookies = this._request.requestCookies; | 2704 */ |
| 2707 this._cookiesCell.setTextAndTitle(requestCookies ? "" + requestCookies.l ength : ""); | 2705 _renderSizeCell: function(cell) |
| 2708 }, | |
| 2709 | |
| 2710 _refreshSetCookiesCell: function() | |
| 2711 { | |
| 2712 var responseCookies = this._request.responseCookies; | |
| 2713 this._setCookiesCell.setTextAndTitle(responseCookies ? "" + responseCook ies.length : ""); | |
| 2714 }, | |
| 2715 | |
| 2716 _refreshSizeCell: function() | |
| 2717 { | 2706 { |
| 2718 if (this._request.cached) { | 2707 if (this._request.cached) { |
| 2719 this._sizeCell.setTextAndTitle(WebInspector.UIString("(from cache)") ); | 2708 cell.setTextAndTitle(WebInspector.UIString("(from cache)")); |
| 2720 this._sizeCell.classList.add("network-dim-cell"); | 2709 cell.classList.add("network-dim-cell"); |
| 2721 } else { | 2710 } else { |
| 2722 var resourceSize = Number.bytesToString(this._request.resourceSize); | 2711 var resourceSize = Number.bytesToString(this._request.resourceSize); |
| 2723 var transferSize = Number.bytesToString(this._request.transferSize); | 2712 var transferSize = Number.bytesToString(this._request.transferSize); |
| 2724 this._sizeCell.setTextAndTitle(transferSize); | 2713 cell.setTextAndTitle(transferSize); |
| 2725 this._sizeCell.classList.remove("network-dim-cell"); | 2714 this._appendSubtitle(cell, resourceSize); |
| 2726 this._appendSubtitle(this._sizeCell, resourceSize); | |
| 2727 } | 2715 } |
| 2728 }, | 2716 }, |
| 2729 | 2717 |
| 2730 _refreshTimeCell: function() | 2718 /** |
| 2719 * @param {!Element} cell | |
| 2720 */ | |
| 2721 _renderTimeCell: function(cell) | |
| 2731 { | 2722 { |
| 2732 if (this._request.duration > 0) { | 2723 if (this._request.duration > 0) { |
| 2733 this._timeCell.classList.remove("network-dim-cell"); | 2724 cell.setTextAndTitle(Number.secondsToString(this._request.duration)) ; |
| 2734 this._timeCell.setTextAndTitle(Number.secondsToString(this._request. duration)); | 2725 this._appendSubtitle(cell, Number.secondsToString(this._request.late ncy)); |
| 2735 this._appendSubtitle(this._timeCell, Number.secondsToString(this._re quest.latency)); | |
| 2736 } else { | 2726 } else { |
| 2737 this._timeCell.classList.add("network-dim-cell"); | 2727 cell.classList.add("network-dim-cell"); |
| 2738 this._timeCell.setTextAndTitle(WebInspector.UIString("Pending")); | 2728 cell.setTextAndTitle(WebInspector.UIString("Pending")); |
| 2739 } | 2729 } |
| 2740 }, | 2730 }, |
| 2741 | 2731 |
| 2742 _appendSubtitle: function(cellElement, subtitleText) | 2732 _appendSubtitle: function(cellElement, subtitleText) |
| 2743 { | 2733 { |
| 2744 var subtitleElement = document.createElement("div"); | 2734 var subtitleElement = document.createElement("div"); |
| 2745 subtitleElement.className = "network-cell-subtitle"; | 2735 subtitleElement.className = "network-cell-subtitle"; |
| 2746 subtitleElement.textContent = subtitleText; | 2736 subtitleElement.textContent = subtitleText; |
| 2747 cellElement.appendChild(subtitleElement); | 2737 cellElement.appendChild(subtitleElement); |
| 2748 }, | 2738 }, |
| 2749 | 2739 |
| 2750 refreshGraph: function(calculator) | 2740 refreshGraph: function(calculator) |
| 2751 { | 2741 { |
| 2742 if (!this._timelineCell) | |
| 2743 return; | |
| 2744 | |
| 2752 var percentages = calculator.computeBarGraphPercentages(this._request); | 2745 var percentages = calculator.computeBarGraphPercentages(this._request); |
| 2753 this._percentages = percentages; | 2746 this._percentages = percentages; |
| 2754 | 2747 |
| 2755 this._barAreaElement.classList.remove("hidden"); | 2748 this._barAreaElement.classList.remove("hidden"); |
| 2756 | 2749 |
| 2757 this._barLeftElement.style.setProperty("left", percentages.start + "%"); | 2750 this._barLeftElement.style.setProperty("left", percentages.start + "%"); |
| 2758 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%"); | 2751 this._barRightElement.style.setProperty("right", (100 - percentages.end) + "%"); |
| 2759 | 2752 |
| 2760 this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%"); | 2753 this._barLeftElement.style.setProperty("right", (100 - percentages.end) + "%"); |
| 2761 this._barRightElement.style.setProperty("left", percentages.middle + "%" ); | 2754 this._barRightElement.style.setProperty("left", percentages.middle + "%" ); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2924 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) | 2917 WebInspector.NetworkDataGridNode.RequestPropertyComparator = function(propertyNa me, revert, a, b) |
| 2925 { | 2918 { |
| 2926 var aValue = a._request[propertyName]; | 2919 var aValue = a._request[propertyName]; |
| 2927 var bValue = b._request[propertyName]; | 2920 var bValue = b._request[propertyName]; |
| 2928 if (aValue > bValue) | 2921 if (aValue > bValue) |
| 2929 return revert ? -1 : 1; | 2922 return revert ? -1 : 1; |
| 2930 if (bValue > aValue) | 2923 if (bValue > aValue) |
| 2931 return revert ? 1 : -1; | 2924 return revert ? 1 : -1; |
| 2932 return 0; | 2925 return 0; |
| 2933 } | 2926 } |
| OLD | NEW |