Chromium Code Reviews| 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 var setterProperty = new WebInspector.RemoteObjectProperty(" set " + property.name, property.setter); | 565 var setterProperty = new WebInspector.RemoteObjectProperty(" set " + property.name, property.setter); |
| 566 setterProperty.parentObject = value; | 566 setterProperty.parentObject = value; |
| 567 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElem ent(setterProperty)); | 567 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElem ent(setterProperty)); |
| 568 } | 568 } |
| 569 } | 569 } |
| 570 } else { | 570 } else { |
| 571 property.parentObject = value; | 571 property.parentObject = value; |
| 572 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(prop erty)); | 572 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(prop erty)); |
| 573 } | 573 } |
| 574 } | 574 } |
| 575 var entries = null; | |
| 575 if (internalProperties) { | 576 if (internalProperties) { |
| 576 for (var i = 0; i < internalProperties.length; i++) { | 577 for (var i = 0; i < internalProperties.length; i++) { |
| 578 if (internalProperties[i].name === "[[Entries]]") { | |
| 579 entries = internalProperties[i].value; | |
| 580 continue; | |
| 581 } | |
| 577 internalProperties[i].parentObject = value; | 582 internalProperties[i].parentObject = value; |
| 578 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(inte rnalProperties[i])); | 583 treeNode.appendChild(new WebInspector.ObjectPropertyTreeElement(inte rnalProperties[i])); |
| 579 } | 584 } |
| 580 } | 585 } |
| 581 if (value && value.type === "function") { | 586 if (value && value.type === "function") { |
| 582 // Whether function has TargetFunction internal property. | 587 // Whether function has TargetFunction internal property. |
| 583 // This is a simple way to tell that the function is actually a bound fu nction (we are not told). | 588 // This is a simple way to tell that the function is actually a bound fu nction (we are not told). |
| 584 // Bound function never has inner scope and doesn't need corresponding U I node. | 589 // Bound function never has inner scope and doesn't need corresponding U I node. |
| 585 var hasTargetFunction = false; | 590 var hasTargetFunction = false; |
| 586 | 591 |
| 587 if (internalProperties) { | 592 if (internalProperties) { |
| 588 for (var i = 0; i < internalProperties.length; i++) { | 593 for (var i = 0; i < internalProperties.length; i++) { |
| 589 if (internalProperties[i].name === "[[TargetFunction]]") { | 594 if (internalProperties[i].name === "[[TargetFunction]]") { |
| 590 hasTargetFunction = true; | 595 hasTargetFunction = true; |
| 591 break; | 596 break; |
| 592 } | 597 } |
| 593 } | 598 } |
| 594 } | 599 } |
| 595 if (!hasTargetFunction) | 600 if (!hasTargetFunction) |
| 596 treeNode.appendChild(new WebInspector.FunctionScopeMainTreeElement(v alue)); | 601 treeNode.appendChild(new WebInspector.FunctionScopeMainTreeElement(v alue)); |
| 597 } | 602 } |
| 598 if (value && value.type === "object" && (value.subtype === "map" || value.su btype === "set" || value.subtype === "iterator")) | 603 if (entries) |
| 599 treeNode.appendChild(new WebInspector.CollectionEntriesMainTreeElement(v alue)); | 604 treeNode.appendChild(new WebInspector.CollectionEntriesMainTreeElement(e ntries)); |
| 600 | 605 |
| 601 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeN ode, emptyPlaceholder); | 606 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded(treeN ode, emptyPlaceholder); |
| 602 } | 607 } |
| 603 | 608 |
| 604 /** | 609 /** |
| 605 * @param {!TreeElement} treeNode | 610 * @param {!TreeElement} treeNode |
| 606 * @param {?string=} emptyPlaceholder | 611 * @param {?string=} emptyPlaceholder |
| 607 */ | 612 */ |
| 608 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio n(treeNode, emptyPlaceholder) | 613 WebInspector.ObjectPropertyTreeElement._appendEmptyPlaceholderIfNeeded = functio n(treeNode, emptyPlaceholder) |
| 609 { | 614 { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 723 | 728 |
| 724 this._remoteObject.functionDetails(didGetDetails.bind(this)); | 729 this._remoteObject.functionDetails(didGetDetails.bind(this)); |
| 725 }, | 730 }, |
| 726 | 731 |
| 727 __proto__: TreeElement.prototype | 732 __proto__: TreeElement.prototype |
| 728 } | 733 } |
| 729 | 734 |
| 730 /** | 735 /** |
| 731 * @constructor | 736 * @constructor |
| 732 * @extends {TreeElement} | 737 * @extends {TreeElement} |
| 733 * @param {!WebInspector.RemoteObject} remoteObject | 738 * @param {!WebInspector.RemoteObject} entries |
| 734 */ | 739 */ |
| 735 WebInspector.CollectionEntriesMainTreeElement = function(remoteObject) | 740 WebInspector.CollectionEntriesMainTreeElement = function(entries) |
| 736 { | 741 { |
| 737 TreeElement.call(this, "<entries>", true); | 742 TreeElement.call(this, "<entries>", true); |
| 738 this.toggleOnClick = true; | 743 this.toggleOnClick = true; |
| 739 this.selectable = false; | 744 this.selectable = false; |
| 740 this._remoteObject = remoteObject; | 745 this._entries = entries; |
| 741 this.expand(); | 746 this.expand(); |
| 742 } | 747 } |
| 743 | 748 |
| 744 WebInspector.CollectionEntriesMainTreeElement.prototype = { | 749 WebInspector.CollectionEntriesMainTreeElement.prototype = { |
| 745 onpopulate: function() | 750 onpopulate: function() |
| 746 { | 751 { |
| 747 /** | 752 /** |
| 748 * @param {?Array.<!DebuggerAgent.CollectionEntry>} entries | 753 * @param {?Array<!WebInspector.RemoteObjectProperty>} entries |
| 749 * @this {WebInspector.CollectionEntriesMainTreeElement} | 754 * @this {WebInspector.CollectionEntriesMainTreeElement} |
| 750 */ | 755 */ |
| 751 function didGetCollectionEntries(entries) | 756 function populateWithEntries(entries) |
| 752 { | 757 { |
| 753 if (!entries) | 758 if (!entries) |
| 754 return; | 759 return; |
| 755 this.removeChildren(); | 760 this.removeChildren(); |
| 756 | 761 |
| 757 var entriesLocalObject = []; | 762 var entriesLocalObject = []; |
| 758 var runtimeModel = this._remoteObject.target().runtimeModel; | 763 for (var entry of entries) { |
| 759 for (var i = 0; i < entries.length; ++i) { | 764 var name = entry.name; |
| 760 var entry = entries[i]; | 765 // Array index check according to the ES5-15.4. |
| 761 if (entry.key) { | 766 if (String(name >>> 0) !== name || name >>> 0 === 0xffffffff) |
|
dgozman
2016/06/28 01:20:46
Why do we have this check?
kozy
2016/06/28 18:41:49
getProperties return __proto__ and length properti
dgozman
2016/06/28 18:58:08
Let's have a variable |var isArrayIndex| and check
| |
| 762 entriesLocalObject.push(new WebInspector.MapEntryLocalJSONOb ject({ | 767 continue; |
| 763 key: runtimeModel.createRemoteObject(entry.key), | 768 var value = entry.value; |
| 764 value: runtimeModel.createRemoteObject(entry.value) | 769 entriesLocalObject.push(new WebInspector.EntryRemoteObject(value .target(), value.objectId, value.type, value.subtype, value.value, value.descrip tion, value.preview)); |
| 765 })); | |
| 766 } else { | |
| 767 entriesLocalObject.push(runtimeModel.createRemoteObject(entr y.value)); | |
| 768 } | |
| 769 } | 770 } |
| 770 WebInspector.ObjectPropertyTreeElement._populate(this, WebInspector. RemoteObject.fromLocalObject(entriesLocalObject), true, WebInspector.UIString("N o Entries")); | 771 WebInspector.ObjectPropertyTreeElement._populate(this, WebInspector. RemoteObject.fromLocalObject(entriesLocalObject), true, WebInspector.UIString("N o Entries")); |
| 771 this.title = "<entries>[" + entriesLocalObject.length + "]"; | 772 this.title = "<entries>[" + entriesLocalObject.length + "]"; |
| 772 } | 773 } |
| 773 | 774 |
| 774 this._remoteObject.collectionEntries(didGetCollectionEntries.bind(this)) ; | 775 this._entries.getOwnProperties(populateWithEntries.bind(this), true); |
| 775 }, | 776 }, |
| 776 | 777 |
| 777 __proto__: TreeElement.prototype | 778 __proto__: TreeElement.prototype |
| 778 } | 779 } |
| 779 | 780 |
| 780 /** | 781 /** |
| 781 * @constructor | 782 * @constructor |
| 782 * @extends {TreeElement} | 783 * @extends {TreeElement} |
| 783 * @param {string} title | 784 * @param {string} title |
| 784 * @param {!WebInspector.RemoteObject} remoteObject | 785 * @param {!WebInspector.RemoteObject} remoteObject |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1411 | 1412 |
| 1412 result = currentName + (result ? "." + result : ""); | 1413 result = currentName + (result ? "." + result : ""); |
| 1413 current = current.parent; | 1414 current = current.parent; |
| 1414 } | 1415 } |
| 1415 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; | 1416 var treeOutlineId = treeElement.treeOutline[WebInspector.ObjectPropertie sSectionExpandController._treeOutlineId]; |
| 1416 result = treeOutlineId + (result ? ":" + result : ""); | 1417 result = treeOutlineId + (result ? ":" + result : ""); |
| 1417 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; | 1418 treeElement[WebInspector.ObjectPropertiesSectionExpandController._cached PathSymbol] = result; |
| 1418 return result; | 1419 return result; |
| 1419 } | 1420 } |
| 1420 } | 1421 } |
| OLD | NEW |