Web Inspector: ES6: Show Symbol properties on Objects
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / ObjectTreeBaseTreeElement.js
index 55a4fbe..7d11825 100644 (file)
@@ -113,12 +113,18 @@ WebInspector.ObjectTreeBaseTreeElement = class ObjectTreeBaseTreeElement extends
         return propertyPath.displayPath(this.propertyPathType());
     }
 
-    createInteractiveGetterElement()
+    createGetterElement(interactive)
     {
         var getterElement = document.createElement("img");
         getterElement.className = "getter";
-        getterElement.title = WebInspector.UIString("Invoke getter");
 
+        if (!interactive) {
+            getterElement.classList.add("disabled");
+            getterElement.title = WebInspector.UIString("Getter");
+            return getterElement;
+        }
+
+        getterElement.title = WebInspector.UIString("Invoke getter");
         getterElement.addEventListener("click", function(event) {
             event.stopPropagation();
             var lastNonPrototypeObject = this._propertyPath.lastNonPrototypeObject;
@@ -134,16 +140,30 @@ WebInspector.ObjectTreeBaseTreeElement = class ObjectTreeBaseTreeElement extends
         return getterElement;
     }
 
-    createReadOnlyIconElement()
+    createSetterElement(interactive)
     {
-        var readOnlyElement = document.createElement("img");
-        readOnlyElement.className = "read-only";
-        readOnlyElement.title = WebInspector.UIString("Read only");
-        return readOnlyElement;
+        var setterElement = document.createElement("img");
+        setterElement.className = "setter";
+        setterElement.title = WebInspector.UIString("Setter");
+
+        if (!interactive)
+            setterElement.classList.add("disabled");
+
+        return setterElement;
     }
 
     // Private
 
+    _logSymbolProperty()
+    {
+        var symbol = this._property.symbol;
+        if (!symbol)
+            return;
+
+        var text = WebInspector.UIString("Selected Symbol");
+        WebInspector.consoleLogViewController.appendImmediateExecutionWithResult(text, symbol);
+    }
+
     _logValue(value)
     {
         var resolvedValue = value || this.resolvedValue();
@@ -167,6 +187,10 @@ WebInspector.ObjectTreeBaseTreeElement = class ObjectTreeBaseTreeElement extends
             return;
 
         var contextMenu = new WebInspector.ContextMenu(event);
+
+        if (this._property && this._property.symbol)
+            contextMenu.appendItem(WebInspector.UIString("Log Symbol"), this._logSymbolProperty.bind(this));
+
         contextMenu.appendItem(WebInspector.UIString("Log Value"), this._logValue.bind(this));
 
         var propertyPath = this.resolvedValuePropertyPath();