Changeset 147218 in webkit


Ignore:
Timestamp:
Mar 29, 2013 8:02:17 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: gather accessor property getter and setter under a single tree node
https://bugs.webkit.org/show_bug.cgi?id=113357

Patch by Peter Rybin <prybin@chromium.org> on 2013-03-29
Reviewed by Yury Semikhatsky.

Source/WebCore:

A new tree element class AccessorPropertyTreeElemenet is added.
RemoteObjectProperty can now represent accessor property (if value is null).
New tree element is supported in CSS stylesheet.

Testing code is slightly modified for exploring new tree elements.

  • inspector/InjectedScriptSource.js:

(.):

  • inspector/front-end/ObjectPropertiesSection.js:

(WebInspector.ObjectPropertyTreeElement.populateWithProperties):
(WebInspector.AccessorPropertyTreeElement):
(WebInspector.AccessorPropertyTreeElement.prototype.onattach):
(WebInspector.AccessorPropertyTreeElement.prototype.update):
(WebInspector.AccessorPropertyTreeElement.prototype.onpopulate):

  • inspector/front-end/RemoteObject.js:
  • inspector/front-end/inspector.css:

(.accessor-property-name):

LayoutTests:

Expectations are fixed with changed functionality and changed tests.

  • inspector/debugger/properties-special-expected.txt:
  • inspector/debugger/properties-special.html:
  • inspector/runtime/runtime-getProperties-expected.txt:
  • inspector/runtime/runtime-getProperties.html:
  • platform/chromium/inspector/debugger/properties-special-expected.txt:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r147217 r147218  
     12013-03-29  Peter Rybin  <prybin@chromium.org>
     2
     3        Web Inspector: gather accessor property getter and setter under a single tree node
     4        https://bugs.webkit.org/show_bug.cgi?id=113357
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Expectations are fixed with changed functionality and changed tests.
     9
     10        * inspector/debugger/properties-special-expected.txt:
     11        * inspector/debugger/properties-special.html:
     12        * inspector/runtime/runtime-getProperties-expected.txt:
     13        * inspector/runtime/runtime-getProperties.html:
     14        * platform/chromium/inspector/debugger/properties-special-expected.txt:
     15
    1162013-03-29  Timothy Hatcher  <timothy@apple.com>
    217
  • trunk/LayoutTests/inspector/console/command-line-api-expected.txt

    r146840 r147218  
    1 CONSOLE MESSAGE: line 1222: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
     1CONSOLE MESSAGE: line 1226: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
    22Tests that command line api works.
    33
  • trunk/LayoutTests/inspector/debugger/properties-special-expected.txt

    r134914 r147218  
    66Watch expressions updated.
    77Nodes are expanded.
     8error: Function scope data is not available
     9Subnodes are expanded.
    810'Object(true)' => 'Boolean'
    911    '__proto__' => 'Boolean'
     
    1416    'name' => '""'
    1517    'prototype' => 'Object'
     18        'constructor' => 'function (a, b) { return a + b; }'
     19        '__proto__' => 'Object'
    1620    '__proto__' => 'function () {'
    1721    <function scope>
    1822'(function(a,b) { return a + b; }).bind({}, 2)' => 'function () {'
    19     'get arguments' => 'function () {'
    20     'get caller' => 'function () {'
     23    'arguments' => null
     24        'get' => 'function () {'
     25        'set' => 'function () {'
     26    'caller' => null
     27        'get' => 'function () {'
     28        'set' => 'function () {'
    2129    'length' => '1'
    2230    'name' => '""'
    23     'set arguments' => 'function () {'
    24     'set caller' => 'function () {'
    2531    '__proto__' => 'function () {'
    2632    <function scope>
  • trunk/LayoutTests/inspector/debugger/properties-special.html

    r141777 r147218  
    6565    {
    6666        InspectorTest.addResult("Nodes are expanded.");
     67        var treeNodes = watchExpressionsSection.propertiesTreeOutline.children;
     68        for (var i = 0; i < treeNodes.length; i++) {
     69            var children = treeNodes[i].children;
     70            for (var j = 0; j < children.length; j++) {
     71                if (children[j].nameElement && children[j].nameElement.textContent === "__proto__")
     72                    continue;
     73                children[j].expand();
     74            }
     75        }
     76        InspectorTest.runAfterPendingDispatches(subnodesExpanded);
     77    }
     78
     79    function subnodesExpanded()
     80    {
     81        InspectorTest.addResult("Subnodes are expanded.");
    6782        InspectorTest.dumpObjectPropertySectionDeep(watchExpressionsSection);
    6883
  • trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt

    r127147 r147218  
    77{
    88    enumerable : true
    9     name : "get foo"
    10     value : {
     9    getter : {
    1110        description : "function () { return 1; }"
    1211        objectId : <string>
    1312        type : "function"
    1413    }
    15     writable : false
    16 }
    17 {
    18     enumerable : true
    19     name : "set foo"
    20     value : {
     14    name : "foo"
     15    setter : {
    2116        description : "function (value) { }"
    2217        objectId : <string>
     
    2924{
    3025    enumerable : true
    31     name : "get foo"
    32     value : {
     26    getter : {
    3327        description : "function () { return 1; }"
    3428        objectId : <string>
    3529        type : "function"
    3630    }
    37     writable : false
    38 }
    39 {
    40     enumerable : true
    41     name : "set foo"
    42     value : {
     31    name : "foo"
     32    setter : {
    4333        description : "undefined"
    4434        objectId : <undefined>
  • trunk/LayoutTests/inspector/runtime/runtime-getProperties.html

    r102916 r147218  
    6161    ]);
    6262
     63    function convertPropertyValueForTest(propertyObject, fieldName)
     64    {
     65        var value = propertyObject[fieldName];
     66        if (value)
     67            propertyObject[fieldName] = { type: value.type, description: value.description.replace("function foo", "function "), objectId: value.objectId };
     68    }
     69
    6370    function dumpProperty(property)
    6471    {
     
    6673            return;
    6774
    68         var value = property.value;
    69         if (value)
    70             property.value = { type: value.type, description: value.description.replace("function foo", "function "), objectId: value.objectId };
     75        convertPropertyValueForTest(property, "value");
     76        convertPropertyValueForTest(property, "getter");
     77        convertPropertyValueForTest(property, "setter");
    7178        InspectorTest.dump(property, { objectId: "formatAsTypeName" });
    7279    }
  • trunk/LayoutTests/platform/chromium/inspector/debugger/properties-special-expected.txt

    r134914 r147218  
    66Watch expressions updated.
    77Nodes are expanded.
     8Subnodes are expanded.
    89'Object(true)' => 'Boolean'
    910    '__proto__' => 'Boolean'
     
    1516    'name' => '""'
    1617    'prototype' => 'Object'
     18        'constructor' => 'function (a,b) { return a + b; }'
     19        '__proto__' => 'Object'
    1720    '__proto__' => 'function Empty() {}'
    1821    <function scope>
     22        'With Block' => 'Object'
     23        Closure
     24        'Global' => 'Window'
    1925'(function(a,b) { return a + b; }).bind({}, 2)' => 'function () { [native code] }'
    20     'get arguments' => 'function ThrowTypeError() { [native code] }'
    21     'get caller' => 'function ThrowTypeError() { [native code] }'
     26    'arguments' => null
     27        'get' => 'function ThrowTypeError() { [native code] }'
     28        'set' => 'function ThrowTypeError() { [native code] }'
     29    'caller' => null
     30        'get' => 'function ThrowTypeError() { [native code] }'
     31        'set' => 'function ThrowTypeError() { [native code] }'
    2232    'length' => '1'
    2333    'name' => '""'
    24     'set arguments' => 'function ThrowTypeError() { [native code] }'
    25     'set caller' => 'function ThrowTypeError() { [native code] }'
    2634    '__proto__' => 'function Empty() {}'
    2735    '[[TargetFunction]]' => 'function (a,b) { return a + b; }'
     36        'arguments' => 'null'
     37        'caller' => 'null'
     38        'length' => '2'
     39        'name' => '""'
     40        'prototype' => 'Object'
     41        '__proto__' => 'function Empty() {}'
     42        <function scope>
    2843    '[[BoundThis]]' => 'Object'
     44        '__proto__' => 'Object'
    2945    '[[BoundArgs]]' => 'Array[1]'
     46        '0' => '2'
     47        'length' => '1'
     48        '__proto__' => 'Array[0]'
    3049Debugger was disabled.
    3150
  • trunk/Source/WebCore/ChangeLog

    r147213 r147218  
     12013-03-29  Peter Rybin  <prybin@chromium.org>
     2
     3        Web Inspector: gather accessor property getter and setter under a single tree node
     4        https://bugs.webkit.org/show_bug.cgi?id=113357
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        A new tree element class AccessorPropertyTreeElemenet is added.
     9        RemoteObjectProperty can now represent accessor property (if value is null).
     10        New tree element is supported in CSS stylesheet.
     11
     12        Testing code is slightly modified for exploring new tree elements.
     13
     14        * inspector/InjectedScriptSource.js:
     15        (.):
     16        * inspector/front-end/ObjectPropertiesSection.js:
     17        (WebInspector.ObjectPropertyTreeElement.populateWithProperties):
     18        (WebInspector.AccessorPropertyTreeElement):
     19        (WebInspector.AccessorPropertyTreeElement.prototype.onattach):
     20        (WebInspector.AccessorPropertyTreeElement.prototype.update):
     21        (WebInspector.AccessorPropertyTreeElement.prototype.onpopulate):
     22        * inspector/front-end/RemoteObject.js:
     23        * inspector/front-end/inspector.css:
     24        (.accessor-property-name):
     25
    1262013-03-29  Ilya Tikhonovsky  <loislo@chromium.org>
    227
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r146937 r147218  
    346346            return "Cannot resolve function by id.";
    347347        var details = InjectedScriptHost.functionDetails(func);
     348
     349        if (details === undefined)
     350            return "Function scope data is not available";
     351       
    348352        if ("rawScopes" in details) {
    349353            var objectGroupName = this._idToObjectGroupName[parsedFunctionId.id];
  • trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js

    r146900 r147218  
    479479            continue;
    480480        properties[i].parentObject = value;
    481         treeElement.appendChild(new treeElementConstructor(properties[i]));
     481        if (properties[i].value)
     482            treeElement.appendChild(new treeElementConstructor(properties[i]));
     483        else
     484            treeElement.appendChild(new WebInspector.AccessorPropertyTreeElement(properties[i]));
    482485    }
    483486    if (value && value.type === "function") {
     
    595598/**
    596599 * @constructor
     600 * @param {WebInspector.RemoteObjectProperty} property accessor property
     601 * @extends {TreeElement}
     602 */
     603WebInspector.AccessorPropertyTreeElement = function(property)
     604{
     605    TreeElement.call(this, "", null, false);
     606    this._property = property;
     607    this.toggleOnClick = true;
     608    this.selectable = false;
     609    this.hasChildren = true;
     610}
     611
     612WebInspector.AccessorPropertyTreeElement.prototype = {
     613    onattach: function()
     614    {
     615        this.update();
     616    },
     617
     618    update: function()
     619    {
     620        var markerElement = document.createElement("span");
     621        markerElement.textContent = "\u2388";
     622        markerElement.className = "name accessor-property-name";
     623
     624        var nameElement = document.createElement("span");
     625        nameElement.textContent = this._property.name;
     626        nameElement.className = "name accessor-property-name";
     627       
     628        this.listItemElement.removeChildren();
     629        this.listItemElement.appendChild(markerElement);
     630        this.listItemElement.appendChild(nameElement);
     631
     632        this.nameElement = nameElement;
     633    },
     634
     635    onpopulate: function()
     636    {
     637        this.removeChildren();
     638
     639        if (this._property.getter) {
     640            var getterProperty = new WebInspector.RemoteObjectProperty("get", this._property.getter);
     641            this.appendChild(new this.treeOutline.section.treeElementConstructor(getterProperty));
     642        }
     643        if (this._property.setter) {
     644            var setterProperty = new WebInspector.RemoteObjectProperty("set", this._property.setter);
     645            this.appendChild(new this.treeOutline.section.treeElementConstructor(setterProperty));
     646        }
     647    },
     648
     649    __proto__: TreeElement.prototype
     650}
     651
     652/**
     653 * @constructor
    597654 * @extends {TreeElement}
    598655 * @param {WebInspector.RemoteObject} remoteObject
  • trunk/Source/WebCore/inspector/front-end/RemoteObject.js

    r146759 r147218  
    216216            for (var i = 0; properties && i < properties.length; ++i) {
    217217                var property = properties[i];
    218                 if (property.get || property.set) {
    219                     if (property.get)
    220                         result.push(new WebInspector.RemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property));
    221                     if (property.set)
    222                         result.push(new WebInspector.RemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property));
    223                 } else
    224                     result.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property));
     218                result.push(new WebInspector.RemoteObjectProperty(property.name, null, property));
    225219            }
    226220            var internalPropertiesResult;
     
    445439 * @constructor
    446440 * @param {string} name
    447  * @param {WebInspector.RemoteObject} value
     441 * @param {?WebInspector.RemoteObject} value
    448442 * @param {Object=} descriptor
    449443 */
     
    451445{
    452446    this.name = name;
    453     this.value = value;
    454447    this.enumerable = descriptor ? !!descriptor.enumerable : true;
    455448    this.writable = descriptor ? !!descriptor.writable : true;
     449    if (value === null && descriptor) {
     450        if (descriptor.value)
     451            this.value = WebInspector.RemoteObject.fromPayload(descriptor.value)
     452        if (descriptor.get)
     453            this.getter = WebInspector.RemoteObject.fromPayload(descriptor.get);
     454        if (descriptor.set)
     455            this.setter = WebInspector.RemoteObject.fromPayload(descriptor.set);
     456    } else
     457        this.value = value;
     458
    456459    if (descriptor && descriptor.wasThrown)
    457460        this.wasThrown = true;
  • trunk/Source/WebCore/inspector/front-end/inspector.css

    r146918 r147218  
    18051805}
    18061806
     1807.accessor-property-name {
     1808    font-style: italic;
     1809}
     1810
    18071811.swatch {
    18081812    margin-left: 1px;
Note: See TracChangeset for help on using the changeset viewer.