Web Inspector: ES6: Show Symbol properties on Objects
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / TypePropertiesSection.js
index cd7ada5..02af481 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +27,7 @@ WebInspector.TypePropertiesSection = function(types, title, subtitle)
 {
     this.emptyPlaceholder = WebInspector.UIString("No Properties");
     this.types = types;
+    this._typeSet = WebInspector.TypeSet.fromPayload(this.types);
 
     WebInspector.PropertiesSection.call(this, title, subtitle);
 };
@@ -39,7 +40,7 @@ WebInspector.TypePropertiesSection.prototype = {
     {
         this.propertiesTreeOutline.removeChildren();
 
-        var primitiveTypeNames = this.types.primitiveTypeNames;
+        var primitiveTypeNames = this._typeSet.primitiveTypeNames;
         var structures = this.types.structures;
         var properties = [];
         for (var struct of structures) {
@@ -67,7 +68,7 @@ WebInspector.TypePropertiesSection.prototype = {
             var title = document.createElement("div");
             title.className = "info";
             title.textContent = this.emptyPlaceholder;
-            var infoElement = new TreeElement(title, null, false);
+            var infoElement = new WebInspector.TreeElement(title, null, false);
             this.propertiesTreeOutline.appendChild(infoElement);
         }
 
@@ -78,7 +79,7 @@ WebInspector.TypePropertiesSection.prototype = {
     }
 };
 
-// This is mostly identical to ObjectPropertiesSection.compareProperties.
+// This is mostly identical to ObjectTreeView.compareProperties.
 // But this checks for equality because we can have two objects named the same thing.
 WebInspector.TypePropertiesSection.PropertyComparator = function(propertyA, propertyB)
 {
@@ -89,7 +90,7 @@ WebInspector.TypePropertiesSection.PropertyComparator = function(propertyA, prop
     if (b.indexOf("__proto__") !== -1)
         return -1;
     if (a === b)
-        return 1;
+        return 0;
 
     var diff = 0;
     var chunk = /^\d+|^\D+/;
@@ -124,25 +125,23 @@ WebInspector.TypePropertiesSection.PropertyComparator = function(propertyA, prop
     return diff;
 };
 
-WebInspector.TypePropertyTreeElement = function(property)
+WebInspector.TypePropertyTreeElement = class TypePropertyTreeElement extends WebInspector.TreeElement
 {
-    this.property = property;
-
-    this.nameElement = document.createElement("span");
-    this.nameElement.className = "name";
-    this.nameElement.textContent = this.property.name;
+    constructor(property)
+    {
+        var titleElement = document.createElement("span");
+        super(titleElement, null, false);
 
-    TreeElement.call(this, this.nameElement, null, false);
+        this.property = property;
 
-    this.toggleOnClick = true;
-    this.hasChildren = !!this.property.structure;
-};
+        titleElement.className = "name";
+        titleElement.textContent = this.property.name;
 
-WebInspector.TypePropertyTreeElement.prototype = {
-    constructor: WebInspector.TypePropertyTreeElement,
-    __proto__: TreeElement.prototype,
+        this.toggleOnClick = true;
+        this.hasChildren = !!this.property.structure;
+    }
 
-    onpopulate: function()
+    onpopulate()
     {
         this.removeChildren();
 
@@ -183,4 +182,3 @@ WebInspector.TypePropertyTreeElement.prototype = {
             this.appendChild(new WebInspector.TypePropertyTreeElement(property));
     }
 };
-