| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 for (var i = 0; i < internalProperties.length; i++) { | 584 for (var i = 0; i < internalProperties.length; i++) { |
| 585 internalProperties[i].parentObject = value; | 585 internalProperties[i].parentObject = value; |
| 586 var treeElement = new WebInspector.ObjectPropertyTreeElement(interna
lProperties[i], linkifier); | 586 var treeElement = new WebInspector.ObjectPropertyTreeElement(interna
lProperties[i], linkifier); |
| 587 if (internalProperties[i].name === "[[Entries]]") { | 587 if (internalProperties[i].name === "[[Entries]]") { |
| 588 treeElement.setExpandable(true); | 588 treeElement.setExpandable(true); |
| 589 treeElement.expand(); | 589 treeElement.expand(); |
| 590 } | 590 } |
| 591 treeNode.appendChild(treeElement); | 591 treeNode.appendChild(treeElement); |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 if (value && value.type === "function") { | |
| 595 // Whether function has TargetFunction internal property. | |
| 596 // This is a simple way to tell that the function is actually a bound fu
nction (we are not told). | |
| 597 // Bound function never has inner scope and doesn't need corresponding U
I node. | |
| 598 var hasTargetFunction = false; | |
| 599 | |
| 600 if (internalProperties) { | |
| 601 for (var i = 0; i < internalProperties.length; i++) { | |
| 602 if (internalProperties[i].name === "[[TargetFunction]]") { | |
| 603 hasTargetFunction = true; | |
| 604 break; | |
| 605 } | |
| 606 } | |
| 607 } | |
| 608 if (!hasTargetFunction) | |
| 609 treeNode.appendChild(new WebInspector.FunctionScopeMainTreeElement(v
alue, linkifier)); | |
| 610 } | |
| 611 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeN
ode, emptyPlaceholder); | 594 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeN
ode, emptyPlaceholder); |
| 612 } | 595 } |
| 613 | 596 |
| 614 /** | 597 /** |
| 615 * @param {!TreeElement} treeNode | 598 * @param {!TreeElement} treeNode |
| 616 * @param {?string=} emptyPlaceholder | 599 * @param {?string=} emptyPlaceholder |
| 617 */ | 600 */ |
| 618 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio
n(treeNode, emptyPlaceholder) | 601 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio
n(treeNode, emptyPlaceholder) |
| 619 { | 602 { |
| 620 if (treeNode.childCount()) | 603 if (treeNode.childCount()) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 647 event.consume(); | 630 event.consume(); |
| 648 object.getProperty(propertyPath, callback); | 631 object.getProperty(propertyPath, callback); |
| 649 } | 632 } |
| 650 | 633 |
| 651 return rootElement; | 634 return rootElement; |
| 652 } | 635 } |
| 653 | 636 |
| 654 /** | 637 /** |
| 655 * @constructor | 638 * @constructor |
| 656 * @extends {TreeElement} | 639 * @extends {TreeElement} |
| 657 * @param {!WebInspector.RemoteObject} remoteObject | |
| 658 * @param {!WebInspector.Linkifier=} linkifier | |
| 659 */ | |
| 660 WebInspector.FunctionScopeMainTreeElement = function(remoteObject, linkifier) | |
| 661 { | |
| 662 TreeElement.call(this, "<function scope>", true); | |
| 663 this.toggleOnClick = true; | |
| 664 this.selectable = false; | |
| 665 this._remoteObject = remoteObject; | |
| 666 this._linkifier = linkifier; | |
| 667 } | |
| 668 | |
| 669 WebInspector.FunctionScopeMainTreeElement.prototype = { | |
| 670 onpopulate: function() | |
| 671 { | |
| 672 /** | |
| 673 * @param {?WebInspector.DebuggerModel.FunctionDetails} response | |
| 674 * @this {WebInspector.FunctionScopeMainTreeElement} | |
| 675 */ | |
| 676 function didGetDetails(response) | |
| 677 { | |
| 678 if (!response) | |
| 679 return; | |
| 680 this.removeChildren(); | |
| 681 | |
| 682 var scopeChain = response.scopeChain || []; | |
| 683 for (var i = 0; i < scopeChain.length; ++i) { | |
| 684 var scope = scopeChain[i]; | |
| 685 var title = null; | |
| 686 var isTrueObject = false; | |
| 687 | |
| 688 switch (scope.type) { | |
| 689 case DebuggerAgent.ScopeType.Local: | |
| 690 // Not really expecting this scope type here. | |
| 691 title = WebInspector.UIString("Local"); | |
| 692 break; | |
| 693 case DebuggerAgent.ScopeType.Closure: | |
| 694 title = WebInspector.UIString("Closure"); | |
| 695 break; | |
| 696 case DebuggerAgent.ScopeType.Catch: | |
| 697 title = WebInspector.UIString("Catch"); | |
| 698 break; | |
| 699 case DebuggerAgent.ScopeType.Block: | |
| 700 title = WebInspector.UIString("Block"); | |
| 701 break; | |
| 702 case DebuggerAgent.ScopeType.Script: | |
| 703 title = WebInspector.UIString("Script"); | |
| 704 break; | |
| 705 case DebuggerAgent.ScopeType.With: | |
| 706 title = WebInspector.UIString("With Block"); | |
| 707 isTrueObject = true; | |
| 708 break; | |
| 709 case DebuggerAgent.ScopeType.Global: | |
| 710 title = WebInspector.UIString("Global"); | |
| 711 isTrueObject = true; | |
| 712 break; | |
| 713 default: | |
| 714 console.error("Unknown scope type: " + scope.type); | |
| 715 continue; | |
| 716 } | |
| 717 | |
| 718 var runtimeModel = this._remoteObject.target().runtimeModel; | |
| 719 if (isTrueObject) { | |
| 720 var remoteObject = runtimeModel.createRemoteObject(scope.obj
ect); | |
| 721 var property = new WebInspector.RemoteObjectProperty(title,
remoteObject); | |
| 722 property.writable = false; | |
| 723 property.parentObject = null; | |
| 724 this.appendChild(new WebInspector.ObjectPropertyTreeElement(
property, this._linkifier)); | |
| 725 } else { | |
| 726 var scopeRef = new WebInspector.ScopeRef(i, undefined); | |
| 727 var remoteObject = runtimeModel.createScopeRemoteObject(scop
e.object, scopeRef); | |
| 728 var scopeTreeElement = new WebInspector.ScopeTreeElement(tit
le, remoteObject); | |
| 729 this.appendChild(scopeTreeElement); | |
| 730 } | |
| 731 } | |
| 732 | |
| 733 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeed
ed(this, WebInspector.UIString("No Scopes")); | |
| 734 } | |
| 735 | |
| 736 this._remoteObject.functionDetails(didGetDetails.bind(this)); | |
| 737 }, | |
| 738 | |
| 739 __proto__: TreeElement.prototype | |
| 740 } | |
| 741 | |
| 742 /** | |
| 743 * @constructor | |
| 744 * @extends {TreeElement} | |
| 745 * @param {string} title | |
| 746 * @param {!WebInspector.RemoteObject} remoteObject | |
| 747 */ | |
| 748 WebInspector.ScopeTreeElement = function(title, remoteObject) | |
| 749 { | |
| 750 TreeElement.call(this, title, true); | |
| 751 this.toggleOnClick = true; | |
| 752 this.selectable = false; | |
| 753 this._remoteObject = remoteObject; | |
| 754 } | |
| 755 | |
| 756 WebInspector.ScopeTreeElement.prototype = { | |
| 757 onpopulate: function() | |
| 758 { | |
| 759 WebInspector.ObjectPropertyTreeElement._populate(this, this._remoteObjec
t, false); | |
| 760 }, | |
| 761 | |
| 762 __proto__: TreeElement.prototype | |
| 763 } | |
| 764 | |
| 765 /** | |
| 766 * @constructor | |
| 767 * @extends {TreeElement} | |
| 768 * @param {!WebInspector.RemoteObject} object | 640 * @param {!WebInspector.RemoteObject} object |
| 769 * @param {number} fromIndex | 641 * @param {number} fromIndex |
| 770 * @param {number} toIndex | 642 * @param {number} toIndex |
| 771 * @param {number} propertyCount | 643 * @param {number} propertyCount |
| 772 * @param {!WebInspector.Linkifier=} linkifier | 644 * @param {!WebInspector.Linkifier=} linkifier |
| 773 */ | 645 */ |
| 774 WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, pro
pertyCount, linkifier) | 646 WebInspector.ArrayGroupingTreeElement = function(object, fromIndex, toIndex, pro
pertyCount, linkifier) |
| 775 { | 647 { |
| 776 TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex),
true); | 648 TreeElement.call(this, String.sprintf("[%d \u2026 %d]", fromIndex, toIndex),
true); |
| 777 this.toggleOnClick = true; | 649 this.toggleOnClick = true; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1185 | 1057 |
| 1186 if (type === "object" && subtype === "node" && description) { | 1058 if (type === "object" && subtype === "node" && description) { |
| 1187 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(valueElement,
description); | 1059 WebInspector.DOMPresentationUtils.createSpansForNodeTitle(valueElement,
description); |
| 1188 valueElement.addEventListener("click", mouseClick, false); | 1060 valueElement.addEventListener("click", mouseClick, false); |
| 1189 valueElement.addEventListener("mousemove", mouseMove, false); | 1061 valueElement.addEventListener("mousemove", mouseMove, false); |
| 1190 valueElement.addEventListener("mouseleave", mouseLeave, false); | 1062 valueElement.addEventListener("mouseleave", mouseLeave, false); |
| 1191 } else { | 1063 } else { |
| 1192 valueElement.title = description || ""; | 1064 valueElement.title = description || ""; |
| 1193 } | 1065 } |
| 1194 | 1066 |
| 1195 if (type === "object" && subtype === "internal#location" && linkifier) | 1067 if (type === "object" && subtype === "internal#location") { |
| 1196 return linkifier.linkifyScriptLocation(value.target(), value.value.scrip
tId, "", value.value.lineNumber, value.value.columnNumber); | 1068 var rawLocation = value.debuggerModel().createRawLocationByScriptId(valu
e.value.scriptId, value.value.lineNumber, value.value.columnNumber); |
| 1069 if (rawLocation && linkifier) |
| 1070 return linkifier.linkifyRawLocation(rawLocation, ""); |
| 1071 else |
| 1072 valueElement.textContent = "<unknown>"; |
| 1073 } |
| 1197 | 1074 |
| 1198 function mouseMove() | 1075 function mouseMove() |
| 1199 { | 1076 { |
| 1200 WebInspector.DOMModel.highlightObjectAsDOMNode(value); | 1077 WebInspector.DOMModel.highlightObjectAsDOMNode(value); |
| 1201 } | 1078 } |
| 1202 | 1079 |
| 1203 function mouseLeave() | 1080 function mouseLeave() |
| 1204 { | 1081 { |
| 1205 WebInspector.DOMModel.hideDOMNodeHighlight(); | 1082 WebInspector.DOMModel.hideDOMNodeHighlight(); |
| 1206 } | 1083 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1218 } | 1095 } |
| 1219 | 1096 |
| 1220 /** | 1097 /** |
| 1221 * @param {!WebInspector.RemoteObject} func | 1098 * @param {!WebInspector.RemoteObject} func |
| 1222 * @param {!Element} element | 1099 * @param {!Element} element |
| 1223 * @param {boolean} linkify | 1100 * @param {boolean} linkify |
| 1224 * @param {boolean=} includePreview | 1101 * @param {boolean=} includePreview |
| 1225 */ | 1102 */ |
| 1226 WebInspector.ObjectPropertiesSection.formatObjectAsFunction = function(func, ele
ment, linkify, includePreview) | 1103 WebInspector.ObjectPropertiesSection.formatObjectAsFunction = function(func, ele
ment, linkify, includePreview) |
| 1227 { | 1104 { |
| 1228 func.functionDetails(didGetDetails); | 1105 func.debuggerModel().functionDetailsPromise(func).then(didGetDetails); |
| 1229 | 1106 |
| 1230 /** | 1107 /** |
| 1231 * @param {?WebInspector.DebuggerModel.FunctionDetails} response | 1108 * @param {?WebInspector.DebuggerModel.FunctionDetails} response |
| 1232 */ | 1109 */ |
| 1233 function didGetDetails(response) | 1110 function didGetDetails(response) |
| 1234 { | 1111 { |
| 1235 if (!response) { | 1112 if (!response) { |
| 1236 var valueText = WebInspector.ObjectPropertiesSection.valueTextForFun
ctionDescription(func.description); | 1113 var valueText = WebInspector.ObjectPropertiesSection.valueTextForFun
ctionDescription(func.description); |
| 1237 element.createTextChild(valueText); | 1114 element.createTextChild(valueText); |
| 1238 return; | 1115 return; |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1384 | 1261 |
| 1385 result = currentName + (result ? "." + result : ""); | 1262 result = currentName + (result ? "." + result : ""); |
| 1386 current = current.parent; | 1263 current = current.parent; |
| 1387 } | 1264 } |
| 1388 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie
sSectionExpandController._treeOutlineId]; | 1265 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie
sSectionExpandController._treeOutlineId]; |
| 1389 result = treeOutlineId + (result ? ":" + result : ""); | 1266 result = treeOutlineId + (result ? ":" + result : ""); |
| 1390 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached
PathSymbol] = result; | 1267 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached
PathSymbol] = result; |
| 1391 return result; | 1268 return result; |
| 1392 } | 1269 } |
| 1393 } | 1270 } |
| OLD | NEW |