Changeset 92671 in webkit


Ignore:
Timestamp:
Aug 9, 2011 3:26:02 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, rolling out r92670.
http://trac.webkit.org/changeset/92670
https://bugs.webkit.org/show_bug.cgi?id=65905

It broke 3 inspector tests (Requested by Ossy on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2011-08-09

Source/WebCore:

  • inspector/InjectedScript.cpp:

(WebCore::InjectedScript::getProperties):

  • inspector/InjectedScript.h:
  • inspector/InjectedScriptSource.js:

(.):

  • inspector/Inspector.json:
  • inspector/InspectorRuntimeAgent.cpp:

(WebCore::InspectorRuntimeAgent::getProperties):

  • inspector/InspectorRuntimeAgent.h:
  • inspector/front-end/ObjectPropertiesSection.js:

(WebInspector.ObjectPropertyTreeElement.prototype.ondblclick):
(WebInspector.ObjectPropertyTreeElement.prototype.update):

  • inspector/front-end/RemoteObject.js:

(WebInspector.RemoteObject.prototype.getOwnProperties):
(WebInspector.RemoteObject.prototype.getAllProperties):
(WebInspector.RemoteObject.prototype._getProperties.remoteObjectBinder):
(WebInspector.RemoteObject.prototype._getProperties):
(WebInspector.RemoteObjectProperty):

  • inspector/front-end/inspector.css:

(.section .properties .value.dimmed):

LayoutTests:

  • inspector/protocol/runtime-agent-expected.txt:
  • inspector/runtime/runtime-getProperties-expected.txt:
  • inspector/runtime/runtime-getProperties.html:
  • platform/chromium/inspector/runtime/runtime-getProperties-expected.txt: Added.
Location:
trunk
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r92670 r92671  
     12011-08-09  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r92670.
     4        http://trac.webkit.org/changeset/92670
     5        https://bugs.webkit.org/show_bug.cgi?id=65905
     6
     7        It broke 3 inspector tests (Requested by Ossy on #webkit).
     8
     9        * inspector/protocol/runtime-agent-expected.txt:
     10        * inspector/runtime/runtime-getProperties-expected.txt:
     11        * inspector/runtime/runtime-getProperties.html:
     12        * platform/chromium/inspector/runtime/runtime-getProperties-expected.txt: Added.
     13
    1142011-08-09  Pavel Feldman  <pfeldman@google.com>
    215
  • trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt

    r92670 r92671  
    168168    params : {
    169169        objectId : <string>
    170         ownProperties : false
     170        ignoreHasOwnProperty : false
    171171    }
    172172    id : <number>
     
    178178        result : [
    179179            {
     180                name : "assignedByCallFunctionOn"
    180181                value : {
    181182                    type : "string"
    182183                    value : "callFunctionOn function works fine"
    183184                }
    184                 writable : true
    185                 enumerable : true
    186                 configurable : true
    187                 name : "assignedByCallFunctionOn"
    188185            }
    189186            {
     187                name : "self"
    190188                value : {
    191189                    type : "object"
     
    194192                    description : "TestObject"
    195193                }
    196                 writable : true
    197                 enumerable : true
    198                 configurable : true
    199                 name : "self"
     194            }
     195            {
     196                name : "__proto__"
     197                value : {
     198                    type : "object"
     199                    objectId : <string>
     200                    className : <string>
     201                    description : "TestObject"
     202                }
    200203            }
    201204        ]
  • trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt

    r92670 r92671  
    1010        type : "function"
    1111        description : "function () { return 1; }"
    12         objectId : <string>
    1312    }
    14     enumerable : true
    15     writable : false
    1613}
    1714{
     
    2017        type : "function"
    2118        description : "function (value) { }"
    22         objectId : <string>
    2319    }
    24     enumerable : true
    25     writable : false
    2620}
    2721
     
    3226        type : "function"
    3327        description : "function () { return 1; }"
    34         objectId : <string>
    3528    }
    36     enumerable : true
    37     writable : false
    3829}
    3930
  • trunk/LayoutTests/inspector/runtime/runtime-getProperties.html

    r92670 r92671  
    6666            return;
    6767
    68         var value = property.value;
    69         if (value)
    70             property.value = { type: value.type, description: value.description.replace("function foo", "function "), objectId: value.objectId };
    71         InspectorTest.dump(property, { objectId: true });
     68        var propertyObj = {};
     69        propertyObj.name = property.name;
     70        propertyObj.value = {};
     71        propertyObj.value.type = property.value.type;
     72        propertyObj.value.description = property.value.description;
     73
     74        InspectorTest.dump(propertyObj);
    7275    }
    7376}
  • trunk/Source/WebCore/ChangeLog

    r92670 r92671  
     12011-08-09  Sheriff Bot  <webkit.review.bot@gmail.com>
     2
     3        Unreviewed, rolling out r92670.
     4        http://trac.webkit.org/changeset/92670
     5        https://bugs.webkit.org/show_bug.cgi?id=65905
     6
     7        It broke 3 inspector tests (Requested by Ossy on #webkit).
     8
     9        * inspector/InjectedScript.cpp:
     10        (WebCore::InjectedScript::getProperties):
     11        * inspector/InjectedScript.h:
     12        * inspector/InjectedScriptSource.js:
     13        (.):
     14        * inspector/Inspector.json:
     15        * inspector/InspectorRuntimeAgent.cpp:
     16        (WebCore::InspectorRuntimeAgent::getProperties):
     17        * inspector/InspectorRuntimeAgent.h:
     18        * inspector/front-end/ObjectPropertiesSection.js:
     19        (WebInspector.ObjectPropertyTreeElement.prototype.ondblclick):
     20        (WebInspector.ObjectPropertyTreeElement.prototype.update):
     21        * inspector/front-end/RemoteObject.js:
     22        (WebInspector.RemoteObject.prototype.getOwnProperties):
     23        (WebInspector.RemoteObject.prototype.getAllProperties):
     24        (WebInspector.RemoteObject.prototype._getProperties.remoteObjectBinder):
     25        (WebInspector.RemoteObject.prototype._getProperties):
     26        (WebInspector.RemoteObjectProperty):
     27        * inspector/front-end/inspector.css:
     28        (.section .properties .value.dimmed):
     29
    1302011-08-09  Pavel Feldman  <pfeldman@google.com>
    231
  • trunk/Source/WebCore/inspector/InjectedScript.cpp

    r92670 r92671  
    8686}
    8787
    88 void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* properties)
     88void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* properties)
    8989{
    9090    ScriptFunctionCall function(m_injectedScriptObject, "getProperties");
    9191    function.appendArgument(objectId);
    92     function.appendArgument(ownProperties);
     92    function.appendArgument(ignoreHasOwnProperty);
    9393
    9494    RefPtr<InspectorValue> result;
  • trunk/Source/WebCore/inspector/InjectedScript.h

    r92670 r92671  
    7171                        bool* wasThrown);
    7272    void evaluateOnCallFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown);
    73     void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* result);
     73    void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result);
    7474    Node* nodeForObjectId(const String& objectId);
    7575    void releaseObject(const String& objectId);
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r92670 r92671  
    1   /*
     1/*
    22 * Copyright (C) 2007 Apple Inc.  All rights reserved.
    33 *
     
    166166    },
    167167
    168     getProperties: function(objectId, ownProperties)
     168    getProperties: function(objectId, ignoreHasOwnProperty)
    169169    {
    170170        var parsedObjectId = this._parseObjectId(objectId);
     
    174174        if (!this._isDefined(object))
    175175            return false;
    176         var descriptors = [];
    177         this._populatePropertyDescriptors(object, descriptors, ownProperties);
    178 
    179         // Go over properties, wrap object values.
    180         for (var i = 0; i < descriptors.length; ++i) {
    181             var descriptor = descriptors[i];
    182             if (descriptor.get)
    183                 descriptor.get = this._wrapObject(descriptor.get, objectGroupName);
    184             if (descriptor.set)
    185                 descriptor.set = this._wrapObject(descriptor.set, objectGroupName);
    186             if ("value" in descriptor)
    187                 descriptor.value = this._wrapObject(descriptor.value, objectGroupName);
    188         }
    189         return descriptors;
     176        var properties = [];
     177
     178        var propertyNames = ignoreHasOwnProperty ? this._getPropertyNames(object) : Object.getOwnPropertyNames(object);
     179        if (!ignoreHasOwnProperty && object.__proto__)
     180            propertyNames.push("__proto__");
     181
     182        // Go over properties, prepare results.
     183        for (var i = 0; i < propertyNames.length; ++i) {
     184            var propertyName = propertyNames[i];
     185
     186            var getter = (typeof object["__lookupGetter__"] === "function") && object.__lookupGetter__(propertyName);
     187            var setter = (typeof object["__lookupSetter__"] === "function") && object.__lookupSetter__(propertyName);
     188            if (getter || setter) {
     189                if (getter) {
     190                    var property = {};
     191                    property.name = "get " + propertyName;
     192                    property.value = this._wrapObject(getter, objectGroupName);
     193                    properties.push(property);
     194                }
     195                if (setter) {
     196                    var property = {};
     197                    property.name = "set " + propertyName;
     198                    property.value = this._wrapObject(setter, objectGroupName);
     199                    properties.push(property);
     200                }
     201            } else {
     202                var property = {};
     203                property.name = propertyName;
     204                var value;
     205                try {
     206                    value = object[propertyName];
     207                } catch(e) {
     208                    var value = e;
     209                    property.wasThrown = true;
     210                }
     211                property.value = this._wrapObject(value, objectGroupName);
     212                properties.push(property);
     213            }
     214        }
     215        return properties;
    190216    },
    191217
     
    202228    },
    203229
    204     _populatePropertyDescriptors: function(object, descriptors, ownProperties)
    205     {
    206         var nameProcessed = {};
    207         nameProcessed.__proto__ = null;
    208         for (var o = object; this._isDefined(o); o = o.__proto__) {
    209             var names = Object.getOwnPropertyNames(o);
    210             for (var i = 0; i < names.length; ++i) {
    211                 var name = names[i];
    212                 if (nameProcessed[name])
    213                     continue;
    214 
    215                 try {
    216                     nameProcessed[name] = true;
    217                     var descriptor = Object.getOwnPropertyDescriptor(object, name);
    218                     if (!descriptor)
    219                         continue;
    220                 } catch (e) {
    221                     var descriptor = {};
    222                     descriptor.value = e;
    223                     descriptor.wasThrown = true;
    224                 }
    225 
    226                 descriptor.name = name;
    227                 descriptors.push(descriptor);
     230    _populatePropertyNames: function(object, resultSet)
     231    {
     232        for (var o = object; o; o = o.__proto__) {
     233            try {
     234                var names = Object.getOwnPropertyNames(o);
     235                for (var i = 0; i < names.length; ++i)
     236                    resultSet[names[i]] = true;
     237            } catch (e) {
    228238            }
    229             if (ownProperties) {
    230                 if (object.__proto__)
    231                     descriptors.push({ name: "__proto__", value: object.__proto__, writable: true, configurable: true, enumerable: false});
    232                 break;
    233             }
    234         }
     239        }
     240    },
     241
     242    _getPropertyNames: function(object, resultSet)
     243    {
     244        var propertyNameSet = {};
     245        this._populatePropertyNames(object, propertyNameSet);
     246        return Object.keys(propertyNameSet);
    235247    },
    236248
  • trunk/Source/WebCore/inspector/Inspector.json

    r92670 r92671  
    237237            },
    238238            {
    239                 "id": "PropertyDescriptor",
    240                 "type": "object",
    241                 "description": "Object property descriptor.",
    242                 "properties": [
    243                     { "name": "value", "$ref": "RemoteObject", "description": "The value associated with the property." },
    244                     { "name": "writable", "type": "boolean", "description": "True iff the value associated with the property may be changed (data descriptors only)." },
    245                     { "name": "get", "$ref": "RemoteObject", "description": "A function which serves as a getter for the property, or <code>undefined</code> if there is no getter (accessor descriptors only)." },
    246                     { "name": "set", "$ref": "RemoteObject", "description": "A function which serves as a setter for the property, or <code>undefined</code> if there is no setter (accessor descriptors only)." },
    247                     { "name": "configurable", "type": "boolean", "description": "True iff the type of this property descriptor may be changed and if the property may be deleted from the corresponding object." },
    248                     { "name": "enumerable", "type": "boolean", "description": "True iff this property shows up during enumeration of the properties on the corresponding object." }
     239                "id": "RemoteProperty",
     240                "type": "object",
     241                "description": "Mirror object property.",
     242                "properties": [
     243                    { "name": "name", "type": "string", "description": "Property name." },
     244                    { "name": "value", "$ref": "RemoteObject", "description": "Property value." },
     245                    { "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." }
    249246                ]
    250247            },
     
    294291                "parameters": [
    295292                    { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
    296                     { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." }
    297                 ],
    298                 "returns": [
    299                     { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." }
     293                    { "name": "ignoreHasOwnProperty", "type": "boolean", "description": "If true, returns properties belonging to any element of the prototype chain." }
     294                ],
     295                "returns": [
     296                    { "name": "result", "type": "array", "items": { "$ref": "RemoteProperty"}, "description": "Object properties." }
    300297                ],
    301298                "description": "Returns properties of a given object."
  • trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp

    r92670 r92671  
    110110}
    111111
    112 void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, const bool* const ownProperties, RefPtr<InspectorArray>* result)
     112void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result)
    113113{
    114114    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
     
    117117        return;
    118118    }
    119     injectedScript.getProperties(errorString, objectId, ownProperties ? *ownProperties : false, result);
     119    injectedScript.getProperties(errorString, objectId, ignoreHasOwnProperty, result);
    120120}
    121121
  • trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h

    r92670 r92671  
    7171                        bool* wasThrown);
    7272    void releaseObject(ErrorString*, const String& objectId);
    73     void getProperties(ErrorString*, const String& objectId, const bool* const ownProperties, RefPtr<InspectorArray>* result);
     73    void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result);
    7474    void releaseObjectGroup(ErrorString*, const String& objectGroup);
    7575
  • trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js

    r92670 r92671  
    167167    ondblclick: function(event)
    168168    {
    169         if (this.property.writable)
    170             this.startEditing();
     169        this.startEditing();
    171170    },
    172171
     
    181180        this.nameElement.className = "name";
    182181        this.nameElement.textContent = this.property.name;
    183         if (!this.property.enumerable)
    184             this.nameElement.addStyleClass("dimmed");
    185182
    186183        var separatorElement = document.createElement("span");
  • trunk/Source/WebCore/inspector/front-end/RemoteObject.js

    r92670 r92671  
    117117    getOwnProperties: function(callback)
    118118    {
     119        this._getProperties(false, callback);
     120    },
     121
     122    getAllProperties: function(callback)
     123    {
    119124        this._getProperties(true, callback);
    120125    },
    121126
    122     getAllProperties: function(callback)
    123     {
    124         this._getProperties(false, callback);
    125     },
    126 
    127     _getProperties: function(ownProperties, callback)
     127    _getProperties: function(ignoreHasOwnProperty, callback)
    128128    {
    129129        if (!this._objectId) {
     
    137137                return;
    138138            }
    139             var result = [];
    140             for (var i = 0; properties && i < properties.length; ++i) {
    141                 var property = properties[i];
    142                 if (property.get || property.set) {
    143                     if (property.get)
    144                         result.push(new WebInspector.RemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property));
    145                     if (property.set)
    146                         result.push(new WebInspector.RemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property));
    147                 } else
    148                     result.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property));
    149             }
    150             callback(result);
    151         }
    152         RuntimeAgent.getProperties(this._objectId, ownProperties, remoteObjectBinder);
     139            for (var i = 0; properties && i < properties.length; ++i)
     140                properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value);
     141            callback(properties);
     142        }
     143        RuntimeAgent.getProperties(this._objectId, !!ignoreHasOwnProperty, remoteObjectBinder);
    153144    },
    154145
     
    223214}
    224215
    225 WebInspector.RemoteObjectProperty = function(name, value, descriptor)
     216WebInspector.RemoteObjectProperty = function(name, value)
    226217{
    227218    this.name = name;
    228219    this.value = value;
    229     this.enumerable = descriptor ? !!descriptor.enumerable : true;
    230     this.writable = descriptor ? !!descriptor.writable : true;
    231     if (descriptor && descriptor.wasThrown)
    232         this.wasThrown = true;
    233220}
    234221
  • trunk/Source/WebCore/inspector/front-end/inspector.css

    r92670 r92671  
    16351635}
    16361636
    1637 .section .properties .dimmed {
    1638     opacity: 0.6;
     1637.section .properties .value.dimmed {
     1638    color: rgb(100, 100, 100);
    16391639}
    16401640
Note: See TracChangeset for help on using the changeset viewer.