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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 title: WebInspector.NetworkLogView._columnTitles[headerName], | 387 title: WebInspector.NetworkLogView._columnTitles[headerName], |
388 weight: 6 | 388 weight: 6 |
389 } | 389 } |
390 if (headerName === "Content-Length") | 390 if (headerName === "Content-Length") |
391 descriptor.align = WebInspector.DataGrid.Align.Right; | 391 descriptor.align = WebInspector.DataGrid.Align.Right; |
392 columns.push(descriptor); | 392 columns.push(descriptor); |
393 } | 393 } |
394 | 394 |
395 columns.push({ | 395 columns.push({ |
396 id: "timeline", | 396 id: "timeline", |
397 titleDOMFragment: document.createDocumentFragment(), | 397 titleDOMFragment: createDocumentFragment(), |
398 title: WebInspector.NetworkLogView._columnTitles["timeline"], | 398 title: WebInspector.NetworkLogView._columnTitles["timeline"], |
399 sortable: false, | 399 sortable: false, |
400 weight: 40, | 400 weight: 40, |
401 sort: WebInspector.DataGrid.Order.Ascending | 401 sort: WebInspector.DataGrid.Order.Ascending |
402 }); | 402 }); |
403 | 403 |
404 this._dataGrid = new WebInspector.SortableDataGrid(columns); | 404 this._dataGrid = new WebInspector.SortableDataGrid(columns); |
405 this._dataGrid.setStickToBottom(true); | 405 this._dataGrid.setStickToBottom(true); |
406 this._updateColumns(); | 406 this._updateColumns(); |
407 this._dataGrid.setName("networkLog"); | 407 this._dataGrid.setName("networkLog"); |
(...skipping 10 matching lines...) Expand all Loading... |
418 this._dataGrid.sortNodes(this._sortingFunctions.startTime, false); | 418 this._dataGrid.sortNodes(this._sortingFunctions.startTime, false); |
419 }, | 419 }, |
420 | 420 |
421 /** | 421 /** |
422 * @param {string} title | 422 * @param {string} title |
423 * @param {string} subtitle | 423 * @param {string} subtitle |
424 * @return {!DocumentFragment} | 424 * @return {!DocumentFragment} |
425 */ | 425 */ |
426 _makeHeaderFragment: function(title, subtitle) | 426 _makeHeaderFragment: function(title, subtitle) |
427 { | 427 { |
428 var fragment = document.createDocumentFragment(); | 428 var fragment = createDocumentFragment(); |
429 fragment.createTextChild(title); | 429 fragment.createTextChild(title); |
430 var subtitleDiv = fragment.createChild("div", "network-header-subtitle")
; | 430 var subtitleDiv = fragment.createChild("div", "network-header-subtitle")
; |
431 subtitleDiv.createTextChild(subtitle); | 431 subtitleDiv.createTextChild(subtitle); |
432 return fragment; | 432 return fragment; |
433 }, | 433 }, |
434 | 434 |
435 _patchTimelineHeader: function() | 435 _patchTimelineHeader: function() |
436 { | 436 { |
437 var timelineSorting = document.createElement("select"); | 437 var timelineSorting = createElement("select"); |
438 | 438 |
439 var option = document.createElement("option"); | 439 var option = createElement("option"); |
440 option.value = "startTime"; | 440 option.value = "startTime"; |
441 option.label = WebInspector.UIString("Timeline"); | 441 option.label = WebInspector.UIString("Timeline"); |
442 timelineSorting.appendChild(option); | 442 timelineSorting.appendChild(option); |
443 | 443 |
444 option = document.createElement("option"); | 444 option = createElement("option"); |
445 option.value = "startTime"; | 445 option.value = "startTime"; |
446 option.label = WebInspector.UIString("Start Time"); | 446 option.label = WebInspector.UIString("Start Time"); |
447 timelineSorting.appendChild(option); | 447 timelineSorting.appendChild(option); |
448 | 448 |
449 option = document.createElement("option"); | 449 option = createElement("option"); |
450 option.value = "responseTime"; | 450 option.value = "responseTime"; |
451 option.label = WebInspector.UIString("Response Time"); | 451 option.label = WebInspector.UIString("Response Time"); |
452 timelineSorting.appendChild(option); | 452 timelineSorting.appendChild(option); |
453 | 453 |
454 option = document.createElement("option"); | 454 option = createElement("option"); |
455 option.value = "endTime"; | 455 option.value = "endTime"; |
456 option.label = WebInspector.UIString("End Time"); | 456 option.label = WebInspector.UIString("End Time"); |
457 timelineSorting.appendChild(option); | 457 timelineSorting.appendChild(option); |
458 | 458 |
459 option = document.createElement("option"); | 459 option = createElement("option"); |
460 option.value = "duration"; | 460 option.value = "duration"; |
461 option.label = WebInspector.UIString("Duration"); | 461 option.label = WebInspector.UIString("Duration"); |
462 timelineSorting.appendChild(option); | 462 timelineSorting.appendChild(option); |
463 | 463 |
464 option = document.createElement("option"); | 464 option = createElement("option"); |
465 option.value = "latency"; | 465 option.value = "latency"; |
466 option.label = WebInspector.UIString("Latency"); | 466 option.label = WebInspector.UIString("Latency"); |
467 timelineSorting.appendChild(option); | 467 timelineSorting.appendChild(option); |
468 | 468 |
469 var header = this._dataGrid.headerTableHeader("timeline"); | 469 var header = this._dataGrid.headerTableHeader("timeline"); |
470 header.replaceChild(timelineSorting, header.firstChild); | 470 header.replaceChild(timelineSorting, header.firstChild); |
471 | 471 |
472 timelineSorting.addEventListener("click", function(event) { event.consum
e() }, false); | 472 timelineSorting.addEventListener("click", function(event) { event.consum
e() }, false); |
473 timelineSorting.addEventListener("change", this._sortByTimeline.bind(thi
s), false); | 473 timelineSorting.addEventListener("change", this._sortByTimeline.bind(thi
s), false); |
474 this._timelineSortSelector = timelineSorting; | 474 this._timelineSortSelector = timelineSorting; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 | 551 |
552 this._setCalculator(this._calculators[value]); | 552 this._setCalculator(this._calculators[value]); |
553 var sortingFunction = this._sortingFunctions[value]; | 553 var sortingFunction = this._sortingFunctions[value]; |
554 this._dataGrid.sortNodes(sortingFunction); | 554 this._dataGrid.sortNodes(sortingFunction); |
555 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM
atchIndex(this._currentMatchedRequestNode), false); | 555 this._highlightNthMatchedRequestForSearch(this._updateMatchCountAndFindM
atchIndex(this._currentMatchedRequestNode), false); |
556 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or
der.Ascending); | 556 this._dataGrid.markColumnAsSortedBy("timeline", WebInspector.DataGrid.Or
der.Ascending); |
557 }, | 557 }, |
558 | 558 |
559 _createStatusBarItems: function() | 559 _createStatusBarItems: function() |
560 { | 560 { |
561 this._progressBarContainer = document.createElement("div"); | 561 this._progressBarContainer = createElement("div"); |
562 this._progressBarContainer.className = "status-bar-item"; | 562 this._progressBarContainer.className = "status-bar-item"; |
563 }, | 563 }, |
564 | 564 |
565 _updateSummaryBar: function() | 565 _updateSummaryBar: function() |
566 { | 566 { |
567 var requestsNumber = this._nodesByRequestId.size; | 567 var requestsNumber = this._nodesByRequestId.size; |
568 | 568 |
569 if (!requestsNumber) { | 569 if (!requestsNumber) { |
570 if (this._summaryBarElement._isDisplayingWarning) | 570 if (this._summaryBarElement._isDisplayingWarning) |
571 return; | 571 return; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 // If our current sorting method starts at zero, that means it shows
all | 650 // If our current sorting method starts at zero, that means it shows
all |
651 // requests starting at the same point, and so onLoad event and DOMC
ontent | 651 // requests starting at the same point, and so onLoad event and DOMC
ontent |
652 // event lines really wouldn't make much sense here, so don't render
them. | 652 // event lines really wouldn't make much sense here, so don't render
them. |
653 return; | 653 return; |
654 } | 654 } |
655 | 655 |
656 this._timelineGrid.removeEventDividers(); | 656 this._timelineGrid.removeEventDividers(); |
657 if (this._mainRequestLoadTime !== -1) { | 657 if (this._mainRequestLoadTime !== -1) { |
658 var percent = calculator.computePercentageFromEventTime(this._mainRe
questLoadTime); | 658 var percent = calculator.computePercentageFromEventTime(this._mainRe
questLoadTime); |
659 | 659 |
660 var loadDivider = document.createElement("div"); | 660 var loadDivider = createElement("div"); |
661 loadDivider.className = "network-event-divider network-red-divider"; | 661 loadDivider.className = "network-event-divider network-red-divider"; |
662 | 662 |
663 var loadDividerPadding = document.createElement("div"); | 663 var loadDividerPadding = createElement("div"); |
664 loadDividerPadding.className = "network-event-divider-padding"; | 664 loadDividerPadding.className = "network-event-divider-padding"; |
665 loadDividerPadding.title = WebInspector.UIString("Load event"); | 665 loadDividerPadding.title = WebInspector.UIString("Load event"); |
666 loadDividerPadding.appendChild(loadDivider); | 666 loadDividerPadding.appendChild(loadDivider); |
667 loadDividerPadding.style.left = percent + "%"; | 667 loadDividerPadding.style.left = percent + "%"; |
668 this._timelineGrid.addEventDivider(loadDividerPadding); | 668 this._timelineGrid.addEventDivider(loadDividerPadding); |
669 } | 669 } |
670 | 670 |
671 if (this._mainRequestDOMContentLoadedTime !== -1) { | 671 if (this._mainRequestDOMContentLoadedTime !== -1) { |
672 var percent = calculator.computePercentageFromEventTime(this._mainRe
questDOMContentLoadedTime); | 672 var percent = calculator.computePercentageFromEventTime(this._mainRe
questDOMContentLoadedTime); |
673 | 673 |
674 var domContentLoadedDivider = document.createElement("div"); | 674 var domContentLoadedDivider = createElement("div"); |
675 domContentLoadedDivider.className = "network-event-divider network-b
lue-divider"; | 675 domContentLoadedDivider.className = "network-event-divider network-b
lue-divider"; |
676 | 676 |
677 var domContentLoadedDividerPadding = document.createElement("div"); | 677 var domContentLoadedDividerPadding = createElement("div"); |
678 domContentLoadedDividerPadding.className = "network-event-divider-pa
dding"; | 678 domContentLoadedDividerPadding.className = "network-event-divider-pa
dding"; |
679 domContentLoadedDividerPadding.title = WebInspector.UIString("DOMCon
tentLoaded event"); | 679 domContentLoadedDividerPadding.title = WebInspector.UIString("DOMCon
tentLoaded event"); |
680 domContentLoadedDividerPadding.appendChild(domContentLoadedDivider); | 680 domContentLoadedDividerPadding.appendChild(domContentLoadedDivider); |
681 domContentLoadedDividerPadding.style.left = percent + "%"; | 681 domContentLoadedDividerPadding.style.left = percent + "%"; |
682 this._timelineGrid.addEventDivider(domContentLoadedDividerPadding); | 682 this._timelineGrid.addEventDivider(domContentLoadedDividerPadding); |
683 } | 683 } |
684 }, | 684 }, |
685 | 685 |
686 _refreshIfNeeded: function() | 686 _refreshIfNeeded: function() |
687 { | 687 { |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 { | 1076 { |
1077 this._linkifier.reset(); | 1077 this._linkifier.reset(); |
1078 }, | 1078 }, |
1079 | 1079 |
1080 /** | 1080 /** |
1081 * @param {!WebInspector.NetworkRequest} request | 1081 * @param {!WebInspector.NetworkRequest} request |
1082 * @return {!Element} | 1082 * @return {!Element} |
1083 */ | 1083 */ |
1084 _generateScriptInitiatedPopoverContent: function(request) | 1084 _generateScriptInitiatedPopoverContent: function(request) |
1085 { | 1085 { |
1086 var framesTable = document.createElementWithClass("table", "network-stac
k-trace"); | 1086 var framesTable = createElementWithClass("table", "network-stack-trace")
; |
1087 | 1087 |
1088 /** | 1088 /** |
1089 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace | 1089 * @param {!Array.<!ConsoleAgent.CallFrame>} stackTrace |
1090 * @this {WebInspector.NetworkLogView} | 1090 * @this {WebInspector.NetworkLogView} |
1091 */ | 1091 */ |
1092 function appendStackTrace(stackTrace) | 1092 function appendStackTrace(stackTrace) |
1093 { | 1093 { |
1094 for (var i = 0; i < stackTrace.length; ++i) { | 1094 for (var i = 0; i < stackTrace.length; ++i) { |
1095 var stackFrame = stackTrace[i]; | 1095 var stackFrame = stackTrace[i]; |
1096 var row = document.createElement("tr"); | 1096 var row = createElement("tr"); |
1097 row.createChild("td").textContent = stackFrame.functionName || W
ebInspector.UIString("(anonymous function)"); | 1097 row.createChild("td").textContent = stackFrame.functionName || W
ebInspector.UIString("(anonymous function)"); |
1098 row.createChild("td").textContent = " @ "; | 1098 row.createChild("td").textContent = " @ "; |
1099 row.createChild("td").appendChild(this._linkifier.linkifyConsole
CallFrame(request.target(), stackFrame)); | 1099 row.createChild("td").appendChild(this._linkifier.linkifyConsole
CallFrame(request.target(), stackFrame)); |
1100 framesTable.appendChild(row); | 1100 framesTable.appendChild(row); |
1101 } | 1101 } |
1102 } | 1102 } |
1103 | 1103 |
1104 // Initiator is not null, checked in _getPopoverAnchor. | 1104 // Initiator is not null, checked in _getPopoverAnchor. |
1105 var initiator = /** @type {!NetworkAgent.Initiator} */ (request.initiato
r()); | 1105 var initiator = /** @type {!NetworkAgent.Initiator} */ (request.initiato
r()); |
1106 if (initiator.stackTrace) | 1106 if (initiator.stackTrace) |
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2785 /** | 2785 /** |
2786 * @param {!Element} cell | 2786 * @param {!Element} cell |
2787 */ | 2787 */ |
2788 _renderNameCell: function(cell) | 2788 _renderNameCell: function(cell) |
2789 { | 2789 { |
2790 this._nameCell = cell; | 2790 this._nameCell = cell; |
2791 cell.addEventListener("click", this._onClick.bind(this), false); | 2791 cell.addEventListener("click", this._onClick.bind(this), false); |
2792 cell.addEventListener("dblclick", this._openInNewTab.bind(this), false); | 2792 cell.addEventListener("dblclick", this._openInNewTab.bind(this), false); |
2793 var iconElement; | 2793 var iconElement; |
2794 if (this._request.type === WebInspector.resourceTypes.Image) { | 2794 if (this._request.type === WebInspector.resourceTypes.Image) { |
2795 var previewImage = document.createElementWithClass("img", "image-net
work-icon-preview"); | 2795 var previewImage = createElementWithClass("img", "image-network-icon
-preview"); |
2796 this._request.populateImageSource(previewImage); | 2796 this._request.populateImageSource(previewImage); |
2797 | 2797 |
2798 iconElement = document.createElementWithClass("div", "icon"); | 2798 iconElement = createElementWithClass("div", "icon"); |
2799 iconElement.appendChild(previewImage); | 2799 iconElement.appendChild(previewImage); |
2800 } else { | 2800 } else { |
2801 iconElement = document.createElementWithClass("img", "icon"); | 2801 iconElement = createElementWithClass("img", "icon"); |
2802 } | 2802 } |
2803 iconElement.classList.add(this._request.type.name()); | 2803 iconElement.classList.add(this._request.type.name()); |
2804 | 2804 |
2805 cell.appendChild(iconElement); | 2805 cell.appendChild(iconElement); |
2806 cell.createTextChild(this._request.name()); | 2806 cell.createTextChild(this._request.name()); |
2807 this._appendSubtitle(cell, this._request.path()); | 2807 this._appendSubtitle(cell, this._request.path()); |
2808 cell.title = this._request.url; | 2808 cell.title = this._request.url; |
2809 }, | 2809 }, |
2810 | 2810 |
2811 /** | 2811 /** |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2912 cell.setTextAndTitle(WebInspector.UIString("Pending")); | 2912 cell.setTextAndTitle(WebInspector.UIString("Pending")); |
2913 } | 2913 } |
2914 }, | 2914 }, |
2915 | 2915 |
2916 /** | 2916 /** |
2917 * @param {!Element} cellElement | 2917 * @param {!Element} cellElement |
2918 * @param {string} subtitleText | 2918 * @param {string} subtitleText |
2919 */ | 2919 */ |
2920 _appendSubtitle: function(cellElement, subtitleText) | 2920 _appendSubtitle: function(cellElement, subtitleText) |
2921 { | 2921 { |
2922 var subtitleElement = document.createElement("div"); | 2922 var subtitleElement = createElement("div"); |
2923 subtitleElement.className = "network-cell-subtitle"; | 2923 subtitleElement.className = "network-cell-subtitle"; |
2924 subtitleElement.textContent = subtitleText; | 2924 subtitleElement.textContent = subtitleText; |
2925 cellElement.appendChild(subtitleElement); | 2925 cellElement.appendChild(subtitleElement); |
2926 }, | 2926 }, |
2927 | 2927 |
2928 refreshGraph: function() | 2928 refreshGraph: function() |
2929 { | 2929 { |
2930 if (!this._timelineCell) | 2930 if (!this._timelineCell) |
2931 return; | 2931 return; |
2932 this._staleGraph = true; | 2932 this._staleGraph = true; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3188 | 3188 |
3189 WebInspector.NetworkPanelFactory.prototype = { | 3189 WebInspector.NetworkPanelFactory.prototype = { |
3190 /** | 3190 /** |
3191 * @return {!WebInspector.Panel} | 3191 * @return {!WebInspector.Panel} |
3192 */ | 3192 */ |
3193 createPanel: function() | 3193 createPanel: function() |
3194 { | 3194 { |
3195 return WebInspector.NetworkPanel._instance(); | 3195 return WebInspector.NetworkPanel._instance(); |
3196 } | 3196 } |
3197 } | 3197 } |
OLD | NEW |