Title: [91754] trunk
Revision
91754
Author
[email protected]
Date
2011-07-26 07:44:13 -0700 (Tue, 26 Jul 2011)

Log Message

Web Inspector: Better represent custom getters in the properties pane
https://bugs.webkit.org/show_bug.cgi?id=16734

Reviewed by Yury Semikhatsky.

Source/WebCore:

Test: inspector/runtime/runtime-getProperties.html

* inspector/InjectedScriptSource.js:
(.):
* inspector/Inspector.json:
* inspector/front-end/ObjectPropertiesSection.js:
(WebInspector.ObjectPropertyTreeElement.prototype.update):

LayoutTests:

* inspector/runtime/runtime-getProperties-expected.txt: Added.
* inspector/runtime/runtime-getProperties.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (91753 => 91754)


--- trunk/LayoutTests/ChangeLog	2011-07-26 14:16:33 UTC (rev 91753)
+++ trunk/LayoutTests/ChangeLog	2011-07-26 14:44:13 UTC (rev 91754)
@@ -1,3 +1,13 @@
+2011-07-26  Pavel Feldman  <[email protected]>
+
+        Web Inspector: Better represent custom getters in the properties pane
+        https://bugs.webkit.org/show_bug.cgi?id=16734
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/runtime/runtime-getProperties-expected.txt: Added.
+        * inspector/runtime/runtime-getProperties.html: Added.
+
 2011-07-26  Csaba Osztrogonác  <[email protected]>
 
         [Qt] Unreviewed gardening.

Added: trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt (0 => 91754)


--- trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt	2011-07-26 14:44:13 UTC (rev 91754)
@@ -0,0 +1,30 @@
+Tests RemoteObject.getProperties.
+
+
+Running: testSetUp
+
+Running: testGetterAndSetter
+{
+    name : "get foo"
+    value : {
+        type : "function"
+        description : "function foo() { return 1; }"
+    }
+}
+{
+    name : "set foo"
+    value : {
+        type : "function"
+        description : "function foo(value) { }"
+    }
+}
+
+Running: testGetterOnly
+{
+    name : "get foo"
+    value : {
+        type : "function"
+        description : "function foo() { return 1; }"
+    }
+}
+
Property changes on: trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/inspector/runtime/runtime-getProperties.html (0 => 91754)


--- trunk/LayoutTests/inspector/runtime/runtime-getProperties.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/runtime/runtime-getProperties.html	2011-07-26 14:44:13 UTC (rev 91754)
@@ -0,0 +1,87 @@
+<html>
+<head>
+<script src=""
+<script>
+
+var object1 = { get foo() { return 1; }, set foo(value) { } };
+var object2 = { get foo() { return 1; } };
+
+function test()
+{
+    var obj1, obj2;
+
+    InspectorTest.runTestSuite([
+        function testSetUp(next)
+        {
+            InspectorTest.evaluateInPage("dumpObjects('Initial')", step0);
+
+            function step0()
+            {
+                RuntimeAgent.evaluate("object1", step1);
+            }
+
+            function step1(error, result, wasThrown)
+            {
+                obj1 = WebInspector.RemoteObject.fromPayload(result);
+                RuntimeAgent.evaluate("object2", step2);
+            }
+
+            function step2(error, result, wasThrown)
+            {
+                obj2 = WebInspector.RemoteObject.fromPayload(result);
+                next();
+            }
+        },
+
+        function testGetterAndSetter(next)
+        {
+            obj1.getOwnProperties(step1);
+
+            function step1(properties)
+            {
+                for (var i = 0; i < properties.length; ++i)
+                    dumpProperty(properties[i]);
+
+                next();
+            }
+        },
+
+        function testGetterOnly(next)
+        {
+            obj2.getOwnProperties(step1);
+
+            function step1(properties)
+            {
+                for (var i = 0; i < properties.length; ++i)
+                    dumpProperty(properties[i]);
+
+                next();
+            }
+        }
+    ]);
+
+    function dumpProperty(property)
+    {
+        if (property.name === "__proto__")
+            return;
+
+        var propertyObj = {};
+        propertyObj.name = property.name;
+        propertyObj.value = {};
+        propertyObj.value.type = property.value.type;
+        propertyObj.value.description = property.value.description;
+
+        InspectorTest.dump(propertyObj);
+    }
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+<p>
+Tests RemoteObject.getProperties.
+</p>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/inspector/runtime/runtime-getProperties.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue.html (91753 => 91754)


--- trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue.html	2011-07-26 14:16:33 UTC (rev 91753)
+++ trunk/LayoutTests/inspector/runtime/runtime-setPropertyValue.html	2011-07-26 14:44:13 UTC (rev 91754)
@@ -31,7 +31,7 @@
             function step1(error, result, wasThrown)
             {
                 obj1 = WebInspector.RemoteObject.fromPayload(result);
-                RuntimeAgent.evaluate("object1", step2);
+                RuntimeAgent.evaluate("object2", step2);
             }
 
             function step2(error, result, wasThrown)

Modified: trunk/Source/WebCore/ChangeLog (91753 => 91754)


--- trunk/Source/WebCore/ChangeLog	2011-07-26 14:16:33 UTC (rev 91753)
+++ trunk/Source/WebCore/ChangeLog	2011-07-26 14:44:13 UTC (rev 91754)
@@ -1,3 +1,18 @@
+2011-07-26  Pavel Feldman  <[email protected]>
+
+        Web Inspector: Better represent custom getters in the properties pane
+        https://bugs.webkit.org/show_bug.cgi?id=16734
+
+        Reviewed by Yury Semikhatsky.
+
+        Test: inspector/runtime/runtime-getProperties.html
+
+        * inspector/InjectedScriptSource.js:
+        (.):
+        * inspector/Inspector.json:
+        * inspector/front-end/ObjectPropertiesSection.js:
+        (WebInspector.ObjectPropertyTreeElement.prototype.update):
+
 2011-07-26  Alexis Menard  <[email protected]>
 
         Reviewed by Andreas Kling.

Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (91753 => 91754)


--- trunk/Source/WebCore/inspector/InjectedScriptSource.js	2011-07-26 14:16:33 UTC (rev 91753)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js	2011-07-26 14:44:13 UTC (rev 91754)
@@ -183,23 +183,34 @@
         for (var i = 0; i < propertyNames.length; ++i) {
             var propertyName = propertyNames[i];
 
-            var property = {};
-            property.name = propertyName + "";
-            var isGetter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
-            if (!isGetter) {
+            var getter = object["__lookupGetter__"] && object.__lookupGetter__(propertyName);
+            var setter = object["__lookupSetter__"] && object.__lookupSetter__(propertyName);
+            if (getter || setter) {
+                if (getter) {
+                    var property = {};
+                    property.name = "get " + propertyName;
+                    property.value = this._wrapObject(getter, objectGroupName);
+                    properties.push(property);
+                }
+                if (setter) {
+                    var property = {};
+                    property.name = "set " + propertyName;
+                    property.value = this._wrapObject(setter, objectGroupName);
+                    properties.push(property);
+                }
+            } else {
+                var property = {};
+                property.name = propertyName;
+                var value;
                 try {
-                    var value = object[propertyName];
+                    value = object[propertyName];
                 } catch(e) {
                     var value = e;
                     property.wasThrown = true;
                 }
                 property.value = this._wrapObject(value, objectGroupName);
-            } else {
-                // FIXME: this should show something like "getter" (bug 16734).
-                property.value = new InjectedScript.RemoteObject("\u2014"); // em dash
-                property.isGetter = true;
+                properties.push(property);
             }
-            properties.push(property);
         }
         return properties;
     },

Modified: trunk/Source/WebCore/inspector/Inspector.json (91753 => 91754)


--- trunk/Source/WebCore/inspector/Inspector.json	2011-07-26 14:16:33 UTC (rev 91753)
+++ trunk/Source/WebCore/inspector/Inspector.json	2011-07-26 14:44:13 UTC (rev 91754)
@@ -242,8 +242,7 @@
                 "properties": [
                     { "name": "name", "type": "string", "description": "Property name." },
                     { "name": "value", "$ref": "RemoteObject", "description": "Property value." },
-                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if exception was thrown on attempt to get the property value, in that case the value propery will contain thrown value." },
-                    { "name": "isGetter", "type": "boolean", "optional": true, "description": "True if this property is getter." }
+                    { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if exception was thrown on attempt to get the property value, in that case the value propery will contain thrown value." }
                 ]
             },
             {

Modified: trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js (91753 => 91754)


--- trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js	2011-07-26 14:16:33 UTC (rev 91753)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js	2011-07-26 14:44:13 UTC (rev 91754)
@@ -198,8 +198,6 @@
         } else
             this.valueElement.textContent = description;
 
-        if (this.property.isGetter)
-            this.valueElement.addStyleClass("dimmed");
         if (this.property.wasThrown)
             this.valueElement.addStyleClass("error");
         if (this.property.value.subtype)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to