OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.VBox} | 7 * @extends {WebInspector.VBox} |
8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
9 */ | 9 */ |
10 WebInspector.PromisePane = function() | 10 WebInspector.PromisePane = function() |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 /** | 593 /** |
594 * @param {!Element} anchor | 594 * @param {!Element} anchor |
595 * @param {!WebInspector.Popover} popover | 595 * @param {!WebInspector.Popover} popover |
596 */ | 596 */ |
597 _showPopover: function(anchor, popover) | 597 _showPopover: function(anchor, popover) |
598 { | 598 { |
599 var node = this._dataGrid.dataGridNodeFromNode(anchor); | 599 var node = this._dataGrid.dataGridNodeFromNode(anchor); |
600 var details = this._promiseDetailsByDebuggerModel.get(this._debuggerMode
l).get(node.promiseId()); | 600 var details = this._promiseDetailsByDebuggerModel.get(this._debuggerMode
l).get(node.promiseId()); |
601 | 601 |
602 var stackTrace; | 602 var stackTrace; |
603 var asyncStackTrace; | 603 if (anchor.classList.contains("created-column")) |
604 if (anchor.classList.contains("created-column")) { | |
605 stackTrace = details.creationStack; | 604 stackTrace = details.creationStack; |
606 asyncStackTrace = details.asyncCreationStack; | 605 else |
607 } else { | |
608 stackTrace = details.settlementStack; | 606 stackTrace = details.settlementStack; |
609 asyncStackTrace = details.asyncSettlementStack; | |
610 } | |
611 | 607 |
612 var content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo
ntents(this._debuggerModel.target(), this._linkifier, stackTrace, asyncStackTrac
e); | 608 var content = WebInspector.DOMPresentationUtils.buildStackTracePreviewCo
ntents(this._debuggerModel.target(), this._linkifier, stackTrace); |
613 popover.setCanShrink(true); | 609 popover.setCanShrink(true); |
614 popover.showForAnchor(content, anchor); | 610 popover.showForAnchor(content, anchor); |
615 }, | 611 }, |
616 | 612 |
617 __proto__: WebInspector.VBox.prototype | 613 __proto__: WebInspector.VBox.prototype |
618 } | 614 } |
619 | 615 |
620 /** | 616 /** |
621 * @constructor | 617 * @constructor |
622 * @extends {WebInspector.ViewportDataGridNode} | 618 * @extends {WebInspector.ViewportDataGridNode} |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 * @override | 679 * @override |
684 */ | 680 */ |
685 createCells: function() | 681 createCells: function() |
686 { | 682 { |
687 this._element.classList.toggle("promise-gc", !!this._details.isGarbageCo
llected); | 683 this._element.classList.toggle("promise-gc", !!this._details.isGarbageCo
llected); |
688 WebInspector.ViewportDataGridNode.prototype.createCells.call(this); | 684 WebInspector.ViewportDataGridNode.prototype.createCells.call(this); |
689 }, | 685 }, |
690 | 686 |
691 /** | 687 /** |
692 * @param {!Element} cell | 688 * @param {!Element} cell |
693 * @param {?ConsoleAgent.CallFrame=} callFrame | 689 * @param {?RuntimeAgent.CallFrame=} callFrame |
694 */ | 690 */ |
695 _appendCallFrameAnchor: function(cell, callFrame) | 691 _appendCallFrameAnchor: function(cell, callFrame) |
696 { | 692 { |
697 if (!callFrame) | 693 if (!callFrame) |
698 return; | 694 return; |
699 var anchor = this._linkifier.linkifyConsoleCallFrame(this._debuggerModel
.target(), callFrame); | 695 var anchor = this._linkifier.linkifyConsoleCallFrame(this._debuggerModel
.target(), callFrame); |
700 this._linkifiedAnchors.push(anchor); | 696 this._linkifiedAnchors.push(anchor); |
701 cell.appendChild(anchor); | 697 cell.appendChild(anchor); |
702 }, | 698 }, |
703 | 699 |
(...skipping 28 matching lines...) Expand all Loading... |
732 | 728 |
733 case "function": | 729 case "function": |
734 cell.createTextChild(WebInspector.beautifyFunctionName(details.callF
rame ? details.callFrame.functionName : "")); | 730 cell.createTextChild(WebInspector.beautifyFunctionName(details.callF
rame ? details.callFrame.functionName : "")); |
735 break; | 731 break; |
736 | 732 |
737 case "created": | 733 case "created": |
738 this._appendCallFrameAnchor(cell, details.callFrame); | 734 this._appendCallFrameAnchor(cell, details.callFrame); |
739 break; | 735 break; |
740 | 736 |
741 case "settled": | 737 case "settled": |
742 this._appendCallFrameAnchor(cell, details.settlementStack ? details.
settlementStack[0] : null); | 738 this._appendCallFrameAnchor(cell, details.settlementStack && details
.settlementStack.callFrames.length ? details.settlementStack.callFrames[0] : nul
l); |
743 break; | 739 break; |
744 | 740 |
745 case "tts": | 741 case "tts": |
746 cell.createTextChild(this._ttsCellText()); | 742 cell.createTextChild(this._ttsCellText()); |
747 break; | 743 break; |
748 } | 744 } |
749 | 745 |
750 return cell; | 746 return cell; |
751 }, | 747 }, |
752 | 748 |
753 /** | 749 /** |
754 * @return {string} | 750 * @return {string} |
755 */ | 751 */ |
756 _ttsCellText: function() | 752 _ttsCellText: function() |
757 { | 753 { |
758 var details = this._details; | 754 var details = this._details; |
759 if (details.creationTime && details.settlementTime && details.settlement
Time >= details.creationTime) | 755 if (details.creationTime && details.settlementTime && details.settlement
Time >= details.creationTime) |
760 return Number.millisToString(details.settlementTime - details.creati
onTime); | 756 return Number.millisToString(details.settlementTime - details.creati
onTime); |
761 return ""; | 757 return ""; |
762 }, | 758 }, |
763 | 759 |
764 /** | 760 /** |
765 * @param {?ConsoleAgent.CallFrame=} callFrame | 761 * @param {?RuntimeAgent.CallFrame=} callFrame |
766 * @return {string} | 762 * @return {string} |
767 */ | 763 */ |
768 _callFrameAnchorTextForSearch: function(callFrame) | 764 _callFrameAnchorTextForSearch: function(callFrame) |
769 { | 765 { |
770 if (!callFrame) | 766 if (!callFrame) |
771 return ""; | 767 return ""; |
772 var script = callFrame.scriptId && this._debuggerModel ? this._debuggerM
odel.scriptForId(callFrame.scriptId) : null; | 768 var script = callFrame.scriptId && this._debuggerModel ? this._debuggerM
odel.scriptForId(callFrame.scriptId) : null; |
773 var sourceURL = script ? script.sourceURL : callFrame.url; | 769 var sourceURL = script ? script.sourceURL : callFrame.url; |
774 var lineNumber = callFrame.lineNumber || 0; | 770 var lineNumber = callFrame.lineNumber || 0; |
775 return WebInspector.displayNameForURL(sourceURL) + ":" + lineNumber; | 771 return WebInspector.displayNameForURL(sourceURL) + ":" + lineNumber; |
776 }, | 772 }, |
777 | 773 |
778 /** | 774 /** |
779 * @return {string} | 775 * @return {string} |
780 */ | 776 */ |
781 dataTextForSearch: function() | 777 dataTextForSearch: function() |
782 { | 778 { |
783 var details = this._details; | 779 var details = this._details; |
784 var texts = [ | 780 var texts = [ |
785 WebInspector.beautifyFunctionName(details.callFrame ? details.callFr
ame.functionName : ""), | 781 WebInspector.beautifyFunctionName(details.callFrame ? details.callFr
ame.functionName : ""), |
786 this._callFrameAnchorTextForSearch(details.callFrame), | 782 this._callFrameAnchorTextForSearch(details.callFrame), |
787 this._callFrameAnchorTextForSearch(details.settlementStack ? details
.settlementStack[0] : null), | 783 this._callFrameAnchorTextForSearch(details.settlementStack && detail
s.settlementStack.callFrames.length ? details.settlementStack.callFrames[0] : nu
ll), |
788 this._ttsCellText().replace(/\u2009/g, " ") // \u2009 is a thin spac
e. | 784 this._ttsCellText().replace(/\u2009/g, " ") // \u2009 is a thin spac
e. |
789 ]; | 785 ]; |
790 return texts.join(" "); | 786 return texts.join(" "); |
791 }, | 787 }, |
792 | 788 |
793 __proto__: WebInspector.ViewportDataGridNode.prototype | 789 __proto__: WebInspector.ViewportDataGridNode.prototype |
794 } | 790 } |
OLD | NEW |