OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 { | 67 { |
68 throw new Error("Not implemented."); | 68 throw new Error("Not implemented."); |
69 }, | 69 }, |
70 /** | 70 /** |
71 * @param {!WebInspector.TimelineModel.Record} record | 71 * @param {!WebInspector.TimelineModel.Record} record |
72 * @return {?Object} | 72 * @return {?Object} |
73 */ | 73 */ |
74 highlightQuadForRecord: function(record) | 74 highlightQuadForRecord: function(record) |
75 { | 75 { |
76 throw new Error("Not implemented."); | 76 throw new Error("Not implemented."); |
| 77 }, |
| 78 /** |
| 79 * @param {!WebInspector.TimelineModel.Record} record |
| 80 * @param {!WebInspector.Linkifier} linkifier |
| 81 * @param {boolean} loadedFromFile |
| 82 * @return {?Node} |
| 83 */ |
| 84 buildDetailsNode: function(record, linkifier, loadedFromFile) |
| 85 { |
| 86 throw new Error("Not implemented."); |
| 87 }, |
| 88 /** |
| 89 * @param {!WebInspector.TimelineModel.Record} record |
| 90 * @param {!WebInspector.TimelineModel} model |
| 91 * @param {!WebInspector.Linkifier} linkifier |
| 92 * @param {function(!DocumentFragment)} callback |
| 93 * @param {boolean} loadedFromFile |
| 94 */ |
| 95 generateDetailsContent: function(record, model, linkifier, callback, loadedF
romFile) |
| 96 { |
| 97 throw new Error("Not implemented."); |
77 } | 98 } |
78 } | 99 } |
79 | 100 |
80 /** | 101 /** |
81 * @return {!Object.<string, !WebInspector.TimelineCategory>} | 102 * @return {!Object.<string, !WebInspector.TimelineCategory>} |
82 */ | 103 */ |
83 WebInspector.TimelineUIUtils.categories = function() | 104 WebInspector.TimelineUIUtils.categories = function() |
84 { | 105 { |
85 if (WebInspector.TimelineUIUtils._categories) | 106 if (WebInspector.TimelineUIUtils._categories) |
86 return WebInspector.TimelineUIUtils._categories; | 107 return WebInspector.TimelineUIUtils._categories; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 WebInspector.TimelineUIUtils._recordStylesMap = recordStyles; | 175 WebInspector.TimelineUIUtils._recordStylesMap = recordStyles; |
155 return recordStyles; | 176 return recordStyles; |
156 } | 177 } |
157 | 178 |
158 /** | 179 /** |
159 * @param {!WebInspector.TimelineModel.Record} record | 180 * @param {!WebInspector.TimelineModel.Record} record |
160 * @return {!{title: string, category: !WebInspector.TimelineCategory}} | 181 * @return {!{title: string, category: !WebInspector.TimelineCategory}} |
161 */ | 182 */ |
162 WebInspector.TimelineUIUtils.recordStyle = function(record) | 183 WebInspector.TimelineUIUtils.recordStyle = function(record) |
163 { | 184 { |
164 return WebInspector.TimelineUIUtils.styleForTimelineEvent(record.type()); | 185 var type = record.type(); |
165 } | |
166 | |
167 /** | |
168 * @param {string} type | |
169 * @return {!{title: string, category: !WebInspector.TimelineCategory}} | |
170 */ | |
171 WebInspector.TimelineUIUtils.styleForTimelineEvent = function(type) | |
172 { | |
173 var recordStyles = WebInspector.TimelineUIUtils._initRecordStyles(); | 186 var recordStyles = WebInspector.TimelineUIUtils._initRecordStyles(); |
174 var result = recordStyles[type]; | 187 var result = recordStyles[type]; |
175 if (!result) { | 188 if (!result) { |
176 result = { | 189 result = { |
177 title: WebInspector.UIString("Unknown: %s", type), | 190 title: WebInspector.UIString("Unknown: %s", type), |
178 category: WebInspector.TimelineUIUtils.categories()["other"] | 191 category: WebInspector.TimelineUIUtils.categories()["other"] |
179 }; | 192 }; |
180 recordStyles[type] = result; | 193 recordStyles[type] = result; |
181 } | 194 } |
182 return result; | 195 return result; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 ".timeline-details-view .timeline-" + category.name + ", " + | 478 ".timeline-details-view .timeline-" + category.name + ", " + |
466 ".timeline-category-" + category.name + " .timeline-tree-icon" | 479 ".timeline-category-" + category.name + " .timeline-tree-icon" |
467 | 480 |
468 return selector + " { background-image: linear-gradient(" + | 481 return selector + " { background-image: linear-gradient(" + |
469 category.fillColorStop0 + ", " + category.fillColorStop1 + " 25%, " + cat
egory.fillColorStop1 + " 25%, " + category.fillColorStop1 + ");" + | 482 category.fillColorStop0 + ", " + category.fillColorStop1 + " 25%, " + cat
egory.fillColorStop1 + " 25%, " + category.fillColorStop1 + ");" + |
470 " border-color: " + category.borderColor + | 483 " border-color: " + category.borderColor + |
471 "}"; | 484 "}"; |
472 } | 485 } |
473 | 486 |
474 /** | 487 /** |
475 * @param {!WebInspector.TimelineModel.Record} record | |
476 * @param {!WebInspector.TimelineModel} model | |
477 * @param {!WebInspector.Linkifier} linkifier | |
478 * @param {function(!DocumentFragment)} callback | |
479 * @param {boolean} loadedFromFile | |
480 */ | |
481 WebInspector.TimelineUIUtils.generateDetailsContent = function(record, model, li
nkifier, callback, loadedFromFile) | |
482 { | |
483 var imageElement = /** @type {?Element} */ (record.getUserObject("TimelineUI
Utils::preview-element") || null); | |
484 var relatedNode = null; | |
485 var recordData = record.data(); | |
486 var barrier = new CallbackBarrier(); | |
487 if (!imageElement && WebInspector.TimelineUIUtils.needsPreviewElement(record
.type())) | |
488 WebInspector.DOMPresentationUtils.buildImagePreviewContents(record.targe
t(), recordData["url"], false, barrier.createCallback(saveImage)); | |
489 if (recordData["backendNodeId"]) | |
490 record.target().domModel.pushNodesByBackendIdsToFrontend([recordData["ba
ckendNodeId"]], barrier.createCallback(setRelatedNode)); | |
491 barrier.callWhenDone(callbackWrapper); | |
492 | |
493 /** | |
494 * @param {!Element=} element | |
495 */ | |
496 function saveImage(element) | |
497 { | |
498 imageElement = element || null; | |
499 record.setUserObject("TimelineUIUtils::preview-element", element); | |
500 } | |
501 | |
502 /** | |
503 * @param {?Array.<!DOMAgent.NodeId>} nodeIds | |
504 */ | |
505 function setRelatedNode(nodeIds) | |
506 { | |
507 if (nodeIds) | |
508 relatedNode = record.target().domModel.nodeForId(nodeIds[0]); | |
509 } | |
510 | |
511 function callbackWrapper() | |
512 { | |
513 callback(WebInspector.TimelineUIUtils._generateDetailsContentSynchronous
ly(record, model, linkifier, imageElement, relatedNode, loadedFromFile)); | |
514 } | |
515 } | |
516 | |
517 /** | |
518 * @param {!WebInspector.TimelineModel.Record} record | |
519 * @param {!WebInspector.TimelineModel} model | |
520 * @param {!WebInspector.Linkifier} linkifier | |
521 * @param {?Element} imagePreviewElement | |
522 * @param {?WebInspector.DOMNode} relatedNode | |
523 * @param {boolean} loadedFromFile | |
524 * @return {!DocumentFragment} | |
525 */ | |
526 WebInspector.TimelineUIUtils._generateDetailsContentSynchronously = function(rec
ord, model, linkifier, imagePreviewElement, relatedNode, loadedFromFile) | |
527 { | |
528 var fragment = document.createDocumentFragment(); | |
529 if (record.children().length) | |
530 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats(), record.category(), record.selfTime())); | |
531 else | |
532 fragment.appendChild(WebInspector.TimelineUIUtils.generatePieChart(recor
d.aggregatedStats())); | |
533 | |
534 const recordTypes = WebInspector.TimelineModel.RecordType; | |
535 | |
536 // The messages may vary per record.type(); | |
537 var callSiteStackTraceLabel; | |
538 var callStackLabel; | |
539 var relatedNodeLabel; | |
540 | |
541 var contentHelper = new WebInspector.TimelineDetailsContentHelper(record.tar
get(), linkifier, true); | |
542 contentHelper.appendTextRow(WebInspector.UIString("Self Time"), Number.milli
sToString(record.selfTime(), true)); | |
543 contentHelper.appendTextRow(WebInspector.UIString("Start Time"), Number.mill
isToString(record.startTime() - model.minimumRecordTime())); | |
544 var recordData = record.data(); | |
545 | |
546 switch (record.type()) { | |
547 case recordTypes.GCEvent: | |
548 contentHelper.appendTextRow(WebInspector.UIString("Collected"), Numb
er.bytesToString(recordData["usedHeapSizeDelta"])); | |
549 break; | |
550 case recordTypes.TimerFire: | |
551 callSiteStackTraceLabel = WebInspector.UIString("Timer installed"); | |
552 // Fall-through intended. | |
553 | |
554 case recordTypes.TimerInstall: | |
555 case recordTypes.TimerRemove: | |
556 contentHelper.appendTextRow(WebInspector.UIString("Timer ID"), recor
dData["timerId"]); | |
557 if (record.type() === recordTypes.TimerInstall) { | |
558 contentHelper.appendTextRow(WebInspector.UIString("Timeout"), Nu
mber.millisToString(recordData["timeout"])); | |
559 contentHelper.appendTextRow(WebInspector.UIString("Repeats"), !r
ecordData["singleShot"]); | |
560 } | |
561 break; | |
562 case recordTypes.FireAnimationFrame: | |
563 callSiteStackTraceLabel = WebInspector.UIString("Animation frame req
uested"); | |
564 contentHelper.appendTextRow(WebInspector.UIString("Callback ID"), re
cordData["id"]); | |
565 break; | |
566 case recordTypes.FunctionCall: | |
567 if (recordData["scriptName"]) | |
568 contentHelper.appendLocationRow(WebInspector.UIString("Location"
), recordData["scriptName"], recordData["scriptLine"]); | |
569 break; | |
570 case recordTypes.ResourceSendRequest: | |
571 case recordTypes.ResourceReceiveResponse: | |
572 case recordTypes.ResourceReceivedData: | |
573 case recordTypes.ResourceFinish: | |
574 var url; | |
575 if (record.type() === recordTypes.ResourceSendRequest) | |
576 url = recordData["url"]; | |
577 else if (record.initiator()) | |
578 url = record.initiator().data()["url"]; | |
579 if (url) | |
580 contentHelper.appendElementRow(WebInspector.UIString("Resource")
, WebInspector.linkifyResourceAsNode(url)); | |
581 if (imagePreviewElement) | |
582 contentHelper.appendElementRow(WebInspector.UIString("Preview"),
imagePreviewElement); | |
583 if (recordData["requestMethod"]) | |
584 contentHelper.appendTextRow(WebInspector.UIString("Request Metho
d"), recordData["requestMethod"]); | |
585 if (typeof recordData["statusCode"] === "number") | |
586 contentHelper.appendTextRow(WebInspector.UIString("Status Code")
, recordData["statusCode"]); | |
587 if (recordData["mimeType"]) | |
588 contentHelper.appendTextRow(WebInspector.UIString("MIME Type"),
recordData["mimeType"]); | |
589 if (recordData["encodedDataLength"]) | |
590 contentHelper.appendTextRow(WebInspector.UIString("Encoded Data
Length"), WebInspector.UIString("%d Bytes", recordData["encodedDataLength"])); | |
591 break; | |
592 case recordTypes.EvaluateScript: | |
593 var url = recordData["url"]; | |
594 if (url) | |
595 contentHelper.appendLocationRow(WebInspector.UIString("Script"),
url, recordData["lineNumber"]); | |
596 break; | |
597 case recordTypes.Paint: | |
598 var clip = recordData["clip"]; | |
599 contentHelper.appendTextRow(WebInspector.UIString("Location"), WebIn
spector.UIString("(%d, %d)", clip[0], clip[1])); | |
600 var clipWidth = WebInspector.TimelineUIUtils._quadWidth(clip); | |
601 var clipHeight = WebInspector.TimelineUIUtils._quadHeight(clip); | |
602 contentHelper.appendTextRow(WebInspector.UIString("Dimensions"), Web
Inspector.UIString("%d × %d", clipWidth, clipHeight)); | |
603 // Fall-through intended. | |
604 | |
605 case recordTypes.PaintSetup: | |
606 case recordTypes.Rasterize: | |
607 case recordTypes.ScrollLayer: | |
608 relatedNodeLabel = WebInspector.UIString("Layer root"); | |
609 break; | |
610 case recordTypes.DecodeImage: | |
611 case recordTypes.ResizeImage: | |
612 relatedNodeLabel = WebInspector.UIString("Image element"); | |
613 var url = recordData["url"]; | |
614 if (url) | |
615 contentHelper.appendElementRow(WebInspector.UIString("Image URL"
), WebInspector.linkifyResourceAsNode(url)); | |
616 break; | |
617 case recordTypes.RecalculateStyles: // We don't want to see default deta
ils. | |
618 if (recordData["elementCount"]) | |
619 contentHelper.appendTextRow(WebInspector.UIString("Elements affe
cted"), recordData["elementCount"]); | |
620 callStackLabel = WebInspector.UIString("Styles recalculation forced"
); | |
621 break; | |
622 case recordTypes.Layout: | |
623 if (recordData["dirtyObjects"]) | |
624 contentHelper.appendTextRow(WebInspector.UIString("Nodes that ne
ed layout"), recordData["dirtyObjects"]); | |
625 if (recordData["totalObjects"]) | |
626 contentHelper.appendTextRow(WebInspector.UIString("Layout tree s
ize"), recordData["totalObjects"]); | |
627 if (typeof recordData["partialLayout"] === "boolean") { | |
628 contentHelper.appendTextRow(WebInspector.UIString("Layout scope"
), | |
629 recordData["partialLayout"] ? WebInspector.UIString("Partial"
) : WebInspector.UIString("Whole document")); | |
630 } | |
631 callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated"
); | |
632 callStackLabel = WebInspector.UIString("Layout forced"); | |
633 relatedNodeLabel = WebInspector.UIString("Layout root"); | |
634 break; | |
635 case recordTypes.ConsoleTime: | |
636 contentHelper.appendTextRow(WebInspector.UIString("Message"), record
Data["message"]); | |
637 break; | |
638 case recordTypes.WebSocketCreate: | |
639 case recordTypes.WebSocketSendHandshakeRequest: | |
640 case recordTypes.WebSocketReceiveHandshakeResponse: | |
641 case recordTypes.WebSocketDestroy: | |
642 var initiatorData = record.initiator() ? record.initiator().data() :
recordData; | |
643 if (typeof initiatorData["webSocketURL"] !== "undefined") | |
644 contentHelper.appendTextRow(WebInspector.UIString("URL"), initia
torData["webSocketURL"]); | |
645 if (typeof initiatorData["webSocketProtocol"] !== "undefined") | |
646 contentHelper.appendTextRow(WebInspector.UIString("WebSocket Pro
tocol"), initiatorData["webSocketProtocol"]); | |
647 if (typeof recordData["message"] !== "undefined") | |
648 contentHelper.appendTextRow(WebInspector.UIString("Message"), re
cordData["message"]); | |
649 break; | |
650 case recordTypes.EmbedderCallback: | |
651 contentHelper.appendTextRow(WebInspector.UIString("Callback Function
"), recordData["callbackName"]); | |
652 break; | |
653 default: | |
654 var detailsNode = WebInspector.TimelineUIUtils.buildDetailsNode(reco
rd, linkifier, loadedFromFile); | |
655 if (detailsNode) | |
656 contentHelper.appendElementRow(WebInspector.UIString("Details"),
detailsNode); | |
657 break; | |
658 } | |
659 | |
660 if (relatedNode) | |
661 contentHelper.appendElementRow(relatedNodeLabel || WebInspector.UIString
("Related node"), WebInspector.DOMPresentationUtils.linkifyNodeReference(related
Node)); | |
662 | |
663 if (recordData["scriptName"] && record.type() !== recordTypes.FunctionCall) | |
664 contentHelper.appendLocationRow(WebInspector.UIString("Function Call"),
recordData["scriptName"], recordData["scriptLine"]); | |
665 var callSiteStackTrace = record.callSiteStackTrace(); | |
666 if (callSiteStackTrace) | |
667 contentHelper.appendStackTrace(callSiteStackTraceLabel || WebInspector.U
IString("Call Site stack"), callSiteStackTrace); | |
668 var recordStackTrace = record.stackTrace(); | |
669 if (recordStackTrace) | |
670 contentHelper.appendStackTrace(callStackLabel || WebInspector.UIString("
Call Stack"), recordStackTrace); | |
671 | |
672 if (record.warnings()) { | |
673 var ul = document.createElement("ul"); | |
674 for (var i = 0; i < record.warnings().length; ++i) | |
675 ul.createChild("li").textContent = record.warnings()[i]; | |
676 contentHelper.appendElementRow(WebInspector.UIString("Warning"), ul); | |
677 } | |
678 fragment.appendChild(contentHelper.element); | |
679 return fragment; | |
680 } | |
681 | |
682 /** | |
683 * @param {!Array.<number>} quad | 488 * @param {!Array.<number>} quad |
684 * @return {number} | 489 * @return {number} |
685 */ | 490 */ |
686 WebInspector.TimelineUIUtils._quadWidth = function(quad) | 491 WebInspector.TimelineUIUtils._quadWidth = function(quad) |
687 { | 492 { |
688 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1
] - quad[3], 2))); | 493 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1
] - quad[3], 2))); |
689 } | 494 } |
690 | 495 |
691 /** | 496 /** |
692 * @param {!Array.<number>} quad | 497 * @param {!Array.<number>} quad |
693 * @return {number} | 498 * @return {number} |
694 */ | 499 */ |
695 WebInspector.TimelineUIUtils._quadHeight = function(quad) | 500 WebInspector.TimelineUIUtils._quadHeight = function(quad) |
696 { | 501 { |
697 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1
] - quad[7], 2))); | 502 return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1
] - quad[7], 2))); |
698 } | 503 } |
699 | 504 |
700 /** | 505 /** |
701 * @param {!WebInspector.TimelineModel.Record} record | |
702 * @param {!WebInspector.Linkifier} linkifier | |
703 * @param {boolean} loadedFromFile | |
704 * @return {?Node} | |
705 */ | |
706 WebInspector.TimelineUIUtils.buildDetailsNode = function(record, linkifier, load
edFromFile) | |
707 { | |
708 var details; | |
709 var detailsText; | |
710 var recordData = record.data(); | |
711 switch (record.type()) { | |
712 case WebInspector.TimelineModel.RecordType.GCEvent: | |
713 detailsText = WebInspector.UIString("%s collected", Number.bytesToString
(recordData["usedHeapSizeDelta"])); | |
714 break; | |
715 case WebInspector.TimelineModel.RecordType.TimerFire: | |
716 detailsText = recordData["timerId"]; | |
717 break; | |
718 case WebInspector.TimelineModel.RecordType.FunctionCall: | |
719 details = linkifyLocation(recordData["scriptId"], recordData["scriptName
"], recordData["scriptLine"], 0); | |
720 break; | |
721 case WebInspector.TimelineModel.RecordType.FireAnimationFrame: | |
722 detailsText = recordData["id"]; | |
723 break; | |
724 case WebInspector.TimelineModel.RecordType.EventDispatch: | |
725 detailsText = recordData ? recordData["type"] : null; | |
726 break; | |
727 case WebInspector.TimelineModel.RecordType.Paint: | |
728 var width = WebInspector.TimelineUIUtils._quadWidth(recordData.clip); | |
729 var height = WebInspector.TimelineUIUtils._quadHeight(recordData.clip); | |
730 if (width && height) | |
731 detailsText = WebInspector.UIString("%d\u2009\u00d7\u2009%d", width,
height); | |
732 break; | |
733 case WebInspector.TimelineModel.RecordType.TimerInstall: | |
734 case WebInspector.TimelineModel.RecordType.TimerRemove: | |
735 details = linkifyTopCallFrame(); | |
736 detailsText = recordData["timerId"]; | |
737 break; | |
738 case WebInspector.TimelineModel.RecordType.RequestAnimationFrame: | |
739 case WebInspector.TimelineModel.RecordType.CancelAnimationFrame: | |
740 details = linkifyTopCallFrame(); | |
741 detailsText = recordData["id"]; | |
742 break; | |
743 case WebInspector.TimelineModel.RecordType.ParseHTML: | |
744 case WebInspector.TimelineModel.RecordType.RecalculateStyles: | |
745 details = linkifyTopCallFrame(); | |
746 break; | |
747 case WebInspector.TimelineModel.RecordType.EvaluateScript: | |
748 var url = recordData["url"]; | |
749 if (url) | |
750 details = linkifyLocation("", url, recordData["lineNumber"], 0); | |
751 break; | |
752 case WebInspector.TimelineModel.RecordType.XHRReadyStateChange: | |
753 case WebInspector.TimelineModel.RecordType.XHRLoad: | |
754 case WebInspector.TimelineModel.RecordType.ResourceSendRequest: | |
755 case WebInspector.TimelineModel.RecordType.DecodeImage: | |
756 case WebInspector.TimelineModel.RecordType.ResizeImage: | |
757 var url = recordData["url"]; | |
758 if (url) | |
759 detailsText = WebInspector.displayNameForURL(url); | |
760 break; | |
761 case WebInspector.TimelineModel.RecordType.ResourceReceivedData: | |
762 case WebInspector.TimelineModel.RecordType.ResourceReceiveResponse: | |
763 case WebInspector.TimelineModel.RecordType.ResourceFinish: | |
764 var initiator = record.initiator(); | |
765 if (initiator) { | |
766 var url = initiator.data()["url"]; | |
767 if (url) | |
768 detailsText = WebInspector.displayNameForURL(url); | |
769 } | |
770 break; | |
771 case WebInspector.TimelineModel.RecordType.ConsoleTime: | |
772 detailsText = recordData["message"]; | |
773 break; | |
774 case WebInspector.TimelineModel.RecordType.EmbedderCallback: | |
775 detailsText = recordData["callbackName"]; | |
776 break; | |
777 default: | |
778 details = linkifyTopCallFrame(); | |
779 break; | |
780 } | |
781 | |
782 if (!details && detailsText) | |
783 details = document.createTextNode(detailsText); | |
784 return details; | |
785 | |
786 /** | |
787 * @param {string} scriptId | |
788 * @param {string} url | |
789 * @param {number} lineNumber | |
790 * @param {number=} columnNumber | |
791 */ | |
792 function linkifyLocation(scriptId, url, lineNumber, columnNumber) | |
793 { | |
794 if (!loadedFromFile && scriptId !== "0") { | |
795 var location = new WebInspector.DebuggerModel.Location( | |
796 record.target(), | |
797 scriptId, | |
798 lineNumber - 1, | |
799 (columnNumber || 1) - 1); | |
800 return linkifier.linkifyRawLocation(location, "timeline-details"); | |
801 } | |
802 | |
803 if (!url) | |
804 return null; | |
805 | |
806 // FIXME(62725): stack trace line/column numbers are one-based. | |
807 columnNumber = columnNumber ? columnNumber - 1 : 0; | |
808 return linkifier.linkifyLocation(record.target(), url, lineNumber - 1, c
olumnNumber, "timeline-details"); | |
809 } | |
810 | |
811 /** | |
812 * @param {!ConsoleAgent.CallFrame} callFrame | |
813 */ | |
814 function linkifyCallFrame(callFrame) | |
815 { | |
816 return linkifyLocation(callFrame.scriptId, callFrame.url, callFrame.line
Number, callFrame.columnNumber); | |
817 } | |
818 | |
819 /** | |
820 * @return {?Element} | |
821 */ | |
822 function linkifyTopCallFrame() | |
823 { | |
824 if (record.stackTrace()) | |
825 return linkifyCallFrame(record.stackTrace()[0]); | |
826 if (record.callSiteStackTrace()) | |
827 return linkifyCallFrame(record.callSiteStackTrace()[0]); | |
828 return null; | |
829 } | |
830 } | |
831 | |
832 /** | |
833 * @constructor | 506 * @constructor |
834 * @extends {WebInspector.Object} | 507 * @extends {WebInspector.Object} |
835 * @param {string} name | 508 * @param {string} name |
836 * @param {string} title | 509 * @param {string} title |
837 * @param {number} overviewStripGroupIndex | 510 * @param {number} overviewStripGroupIndex |
838 * @param {string} borderColor | 511 * @param {string} borderColor |
839 * @param {string} backgroundColor | 512 * @param {string} backgroundColor |
840 * @param {string} fillColorStop0 | 513 * @param {string} fillColorStop0 |
841 * @param {string} fillColorStop1 | 514 * @param {string} fillColorStop1 |
842 */ | 515 */ |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 for (var i = 0; i < stackTrace.length; ++i) { | 688 for (var i = 0; i < stackTrace.length; ++i) { |
1016 var stackFrame = stackTrace[i]; | 689 var stackFrame = stackTrace[i]; |
1017 var row = stackTraceElement.createChild("div"); | 690 var row = stackTraceElement.createChild("div"); |
1018 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); | 691 row.createTextChild(stackFrame.functionName || WebInspector.UIString
("(anonymous function)")); |
1019 row.createTextChild(" @ "); | 692 row.createTextChild(" @ "); |
1020 var urlElement = this._linkifier.linkifyLocation(this._target, stack
Frame.url, stackFrame.lineNumber - 1); | 693 var urlElement = this._linkifier.linkifyLocation(this._target, stack
Frame.url, stackFrame.lineNumber - 1); |
1021 row.appendChild(urlElement); | 694 row.appendChild(urlElement); |
1022 } | 695 } |
1023 } | 696 } |
1024 } | 697 } |
OLD | NEW |