Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/ObjectPropertiesSection.js

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: a Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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]]") {
dgozman 2016/07/07 19:59:23 Just to check - where did this logic go?
kozy 2016/07/07 22:59:07 scopeCount for bound function is zero in DebuggerS
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
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, null);
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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 1258
1387 result = currentName + (result ? "." + result : ""); 1259 result = currentName + (result ? "." + result : "");
1388 current = current.parent; 1260 current = current.parent;
1389 } 1261 }
1390 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; 1262 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId];
1391 result = treeOutlineId + (result ? ":" + result : ""); 1263 result = treeOutlineId + (result ? ":" + result : "");
1392 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; 1264 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result;
1393 return result; 1265 return result;
1394 } 1266 }
1395 } 1267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698