Title: [180594] trunk
Revision
180594
Author
joep...@webkit.org
Date
2015-02-24 16:31:42 -0800 (Tue, 24 Feb 2015)

Log Message

Web Inspector: Make Getter/Setter RemoteObject property and ObjectPreview handling consistent
https://bugs.webkit.org/show_bug.cgi?id=141587

Reviewed by Timothy Hatcher.

Source/_javascript_Core:

Convert getProperties(ownAndGetterProperties) to getDisplayableProperties().
Mark PropertyDescriptors that are presumed to be native getters / bindings
separately so that the frontend may display them differently.

* inspector/InjectedScript.cpp:
(Inspector::InjectedScript::getProperties):
(Inspector::InjectedScript::getDisplayableProperties):
* inspector/InjectedScript.h:
* inspector/InjectedScriptSource.js:
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::getProperties):
(Inspector::InspectorRuntimeAgent::getDisplayableProperties):
* inspector/agents/InspectorRuntimeAgent.h:
* inspector/protocol/Runtime.json:

Source/WebInspectorUI:

* UserInterface/Models/CallFrame.js:
(WebInspector.CallFrame.prototype.collectScopeChainVariableNames):
* UserInterface/Models/PropertyDescriptor.js:
(WebInspector.PropertyDescriptor.prototype.get nativeGetter):
* UserInterface/Protocol/RemoteObject.js:
(WebInspector.RemoteObject.fromPayload):
(WebInspector.RemoteObject.prototype.getOwnPropertyDescriptors):
(WebInspector.RemoteObject.prototype.getAllPropertyDescriptors):
(WebInspector.RemoteObject.prototype.getDisplayablePropertyDescriptors):
(WebInspector.RemoteObject.prototype._getPropertyDescriptors):
(WebInspector.RemoteObject.prototype.if):
(WebInspector.RemoteObject.prototype.deprecatedGetOwnProperties):
(WebInspector.RemoteObject.prototype.deprecatedGetAllProperties):
(WebInspector.RemoteObject.prototype._deprecatedGetProperties):
(WebInspector.RemoteObject.prototype.getOwnAndGetterPropertyDescriptors): Deleted.
(WebInspector.RemoteObject.prototype.callback): Deleted.
(WebInspector.RemoteObject.prototype.getOwnProperties): Deleted.
(WebInspector.RemoteObject.prototype.getOwnAndGetterProperties): Deleted.
(WebInspector.RemoteObject.prototype.getAllProperties): Deleted.
(WebInspector.RemoteObject.prototype.set else): Deleted.
* UserInterface/Views/ConsoleMessageImpl.js:
(WebInspector.ConsoleMessageImpl.prototype._formatParameterAsArray):
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshProperties.nodePrototypesReady):
* UserInterface/Views/ObjectPropertiesSection.js:
(WebInspector.ObjectPropertiesSection.prototype.update):
(WebInspector.ObjectPropertyTreeElement.prototype.onpopulate):
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
(WebInspector.ObjectTreePropertyTreeElement.prototype.):
(WebInspector.ObjectTreePropertyTreeElement.prototype):
* UserInterface/Views/ObjectTreeView.js:
(WebInspector.ObjectTreeView.prototype.update):

LayoutTests:

* inspector/model/remote-object-get-properties-expected.txt:
* inspector/model/remote-object-get-properties.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (180593 => 180594)


--- trunk/LayoutTests/ChangeLog	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/LayoutTests/ChangeLog	2015-02-25 00:31:42 UTC (rev 180594)
@@ -1,3 +1,13 @@
+2015-02-24  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Make Getter/Setter RemoteObject property and ObjectPreview handling consistent
+        https://bugs.webkit.org/show_bug.cgi?id=141587
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/model/remote-object-get-properties-expected.txt:
+        * inspector/model/remote-object-get-properties.html:
+
 2015-02-24  Yusuke Suzuki  <utatane....@gmail.com>
 
         Constructor returning null should construct an object instead of null

Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt (180593 => 180594)


--- trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties-expected.txt	2015-02-25 00:31:42 UTC (rev 180594)
@@ -9,7 +9,7 @@
     b
     __proto__
 
-OWN AND GETTER PROPERTIES:
+DISPLAYABLE PROPERTIES:
     a
     b
     __proto__
@@ -40,7 +40,7 @@
     clipboardData
     __proto__
 
-OWN AND GETTER PROPERTIES:
+DISPLAYABLE PROPERTIES:
     clipboardData
     type
     target
@@ -116,12 +116,9 @@
     _foo
     __proto__
 
-OWN AND GETTER PROPERTIES:
+DISPLAYABLE PROPERTIES:
     _bar
     _foo
-    getterProperty
-    foo
-    bar
     __proto__
 
 ALL PROPERTIES:
@@ -154,8 +151,7 @@
 OWN PROPERTIES:
     __proto__
 
-OWN AND GETTER PROPERTIES:
-    badGetter
+DISPLAYABLE PROPERTIES:
     __proto__
 
 ALL PROPERTIES:
@@ -187,7 +183,7 @@
     prototype
     __proto__
 
-OWN AND GETTER PROPERTIES:
+DISPLAYABLE PROPERTIES:
     arguments
     caller
     length
@@ -235,7 +231,7 @@
     boundThis
     boundArgs
 
-OWN AND GETTER PROPERTIES:
+DISPLAYABLE PROPERTIES:
     name
     length
     arguments

Modified: trunk/LayoutTests/inspector/model/remote-object-get-properties.html (180593 => 180594)


--- trunk/LayoutTests/inspector/model/remote-object-get-properties.html	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/LayoutTests/inspector/model/remote-object-get-properties.html	2015-02-25 00:31:42 UTC (rev 180594)
@@ -87,8 +87,8 @@
                 }
             });
 
-            remoteObject.getOwnAndGetterPropertyDescriptors(function(properties) {
-                InspectorTest.log("\nOWN AND GETTER PROPERTIES:");
+            remoteObject.getDisplayablePropertyDescriptors(function(properties) {
+                InspectorTest.log("\nDISPLAYABLE PROPERTIES:");
                 for (var property of properties) {
                     InspectorTest.assert(property instanceof WebInspector.PropertyDescriptor);
                     InspectorTest.log("    " + property.name);

Modified: trunk/Source/_javascript_Core/ChangeLog (180593 => 180594)


--- trunk/Source/_javascript_Core/ChangeLog	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-02-25 00:31:42 UTC (rev 180594)
@@ -1,3 +1,25 @@
+2015-02-24  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: Make Getter/Setter RemoteObject property and ObjectPreview handling consistent
+        https://bugs.webkit.org/show_bug.cgi?id=141587
+
+        Reviewed by Timothy Hatcher.
+
+        Convert getProperties(ownAndGetterProperties) to getDisplayableProperties().
+        Mark PropertyDescriptors that are presumed to be native getters / bindings
+        separately so that the frontend may display them differently.
+
+        * inspector/InjectedScript.cpp:
+        (Inspector::InjectedScript::getProperties):
+        (Inspector::InjectedScript::getDisplayableProperties):
+        * inspector/InjectedScript.h:
+        * inspector/InjectedScriptSource.js:
+        * inspector/agents/InspectorRuntimeAgent.cpp:
+        (Inspector::InspectorRuntimeAgent::getProperties):
+        (Inspector::InspectorRuntimeAgent::getDisplayableProperties):
+        * inspector/agents/InspectorRuntimeAgent.h:
+        * inspector/protocol/Runtime.json:
+
 2015-02-24  Mark Lam  <mark....@apple.com>
 
         Rolling out r179753.  The fix was invalid.

Modified: trunk/Source/_javascript_Core/inspector/InjectedScript.cpp (180593 => 180594)


--- trunk/Source/_javascript_Core/inspector/InjectedScript.cpp	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/_javascript_Core/inspector/InjectedScript.cpp	2015-02-25 00:31:42 UTC (rev 180594)
@@ -107,12 +107,11 @@
     *result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTF::move(resultValue));
 }
 
-void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool ownAndGetterProperties, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
+void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getProperties"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(objectId);
     function.appendArgument(ownProperties);
-    function.appendArgument(ownAndGetterProperties);
     function.appendArgument(generatePreview);
 
     RefPtr<InspectorValue> result;
@@ -125,6 +124,22 @@
     *properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTF::move(result));
 }
 
+void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>* properties)
+{
+    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getDisplayableProperties"), inspectorEnvironment()->functionCallHandler());
+    function.appendArgument(objectId);
+    function.appendArgument(generatePreview);
+
+    RefPtr<InspectorValue> result;
+    makeCall(function, &result);
+    if (!result || result->type() != InspectorValue::Type::Array) {
+        errorString = ASCIILiteral("Internal error");
+        return;
+    }
+
+    *properties = BindingTraits<Array<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTF::move(result));
+}
+
 void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>* properties)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getInternalProperties"), inspectorEnvironment()->functionCallHandler());

Modified: trunk/Source/_javascript_Core/inspector/InjectedScript.h (180593 => 180594)


--- trunk/Source/_javascript_Core/inspector/InjectedScript.h	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/_javascript_Core/inspector/InjectedScript.h	2015-02-25 00:31:42 UTC (rev 180594)
@@ -56,7 +56,8 @@
     void callFunctionOn(ErrorString&, const String& objectId, const String& _expression_, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown);
     void evaluateOnCallFrame(ErrorString&, const Deprecated::ScriptValue& callFrames, const String& callFrameId, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>* result, Protocol::OptOutput<bool>* wasThrown);
     void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>* result);
-    void getProperties(ErrorString&, const String& objectId, bool ownProperties, bool ownAndGetterProperties, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
+    void getProperties(ErrorString&, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
+    void getDisplayableProperties(ErrorString&, const String& objectId, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::PropertyDescriptor>>* result);
     void getInternalProperties(ErrorString&, const String& objectId, bool generatePreview, RefPtr<Protocol::Array<Protocol::Runtime::InternalPropertyDescriptor>>* result);
     void getCollectionEntries(ErrorString&, const String& objectId, const String& objectGroup, int startIndex, int numberToFetch, RefPtr<Protocol::Array<Protocol::Runtime::CollectionEntry>>* entries);
 

Modified: trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js (180593 => 180594)


--- trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/_javascript_Core/inspector/InjectedScriptSource.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -68,9 +68,9 @@
 }
 
 InjectedScript.CollectionMode = {
-    OwnProperties: 1 << 0,    // own properties.
-    GetterProperties: 1 << 1, // getter properties in the prototype chain.
-    AllProperties: 1 << 2,    // all properties in the prototype chain.
+    OwnProperties: 1 << 0,          // own properties.
+    NativeGetterProperties: 1 << 1, // native getter properties in the prototype chain.
+    AllProperties: 1 << 2,          // all properties in the prototype chain.
 }
 
 InjectedScript.prototype = {
@@ -196,7 +196,7 @@
         return result;
     },
 
-    getProperties: function(objectId, ownProperties, ownAndGetterProperties, generatePreview)
+    _getProperties: function(objectId, collectionMode, generatePreview)
     {
         var parsedObjectId = this._parseObjectId(objectId);
         var object = this._objectForId(parsedObjectId);
@@ -208,12 +208,6 @@
         if (isSymbol(object))
             return false;
 
-        var collectionMode = InjectedScript.CollectionMode.AllProperties;
-        if (ownProperties)
-            collectionMode = InjectedScript.CollectionMode.OwnProperties;
-        else if (ownAndGetterProperties)
-            collectionMode = InjectedScript.CollectionMode.OwnProperties | InjectedScript.CollectionMode.GetterProperties;
-
         var descriptors = this._propertyDescriptors(object, collectionMode);
 
         // Go over properties, wrap object values.
@@ -234,6 +228,18 @@
         return descriptors;
     },
 
+    getProperties: function(objectId, ownProperties, generatePreview)
+    {
+        var collectionMode = ownProperties ? InjectedScript.CollectionMode.OwnProperties : InjectedScript.CollectionMode.AllProperties;
+        return this._getProperties(objectId, collectionMode, generatePreview);
+    },
+
+    getDisplayableProperties: function(objectId, generatePreview)
+    {
+        var collectionMode = InjectedScript.CollectionMode.OwnProperties | InjectedScript.CollectionMode.NativeGetterProperties;
+        return this._getProperties(objectId, collectionMode, generatePreview);
+    },
+
     getInternalProperties: function(objectId, generatePreview)
     {
         var parsedObjectId = this._parseObjectId(objectId);
@@ -564,10 +570,13 @@
         var nameProcessed = {};
         nameProcessed["__proto__"] = null;
 
-        function createFakeValueDescriptor(name, descriptor, isOwnProperty)
+        function createFakeValueDescriptor(name, descriptor, isOwnProperty, possibleNativeBindingGetter)
         {
             try {
-                return {name: name, value: object[name], writable: descriptor.writable || false, configurable: descriptor.configurable || false, enumerable: descriptor.enumerable || false};
+                var descriptor = {name: name, value: object[name], writable: descriptor.writable || false, configurable: descriptor.configurable || false, enumerable: descriptor.enumerable || false};
+                if (possibleNativeBindingGetter)
+                    descriptor.nativeGetter = true;
+                return descriptor;
             } catch (e) {
                 var errorDescriptor = {name: name, value: e, wasThrown: true};
                 if (isOwnProperty)
@@ -590,13 +599,10 @@
                 return;
             }
 
-            // Getter properties.
-            if (collectionMode & InjectedScript.CollectionMode.GetterProperties) {
-                if (descriptor.hasOwnProperty("get") && descriptor.get) {
-                    // Getter property in the prototype chain. Create a fake value descriptor.
-                    descriptors.push(createFakeValueDescriptor(descriptor.name, descriptor, isOwnProperty));
-                    return;
-                }
+            // Native Getter properties.
+            if (collectionMode & InjectedScript.CollectionMode.NativeGetterProperties) {
+                // FIXME: <https://webkit.org/b/140575> Web Inspector: Native Bindings Descriptors are Incomplete
+                // if (descriptor.hasOwnProperty("get") && descriptor.get && isNativeFunction(descriptor.get)) { ... }
 
                 if (possibleNativeBindingGetter) {
                     // Possible getter property in the prototype chain.
@@ -628,7 +634,7 @@
                     // FIXME: <https://webkit.org/b/140575> Web Inspector: Native Bindings Descriptors are Incomplete
                     // Developers may create such a descriptors, so we should be resilient:
                     // var x = {}; Object.defineProperty(x, "p", {get:undefined}); Object.getOwnPropertyDescriptor(x, "p")
-                    var fakeDescriptor = createFakeValueDescriptor(name, descriptor, isOwnProperty);
+                    var fakeDescriptor = createFakeValueDescriptor(name, descriptor, isOwnProperty, true);
                     processDescriptor(fakeDescriptor, isOwnProperty, true);
                     continue;
                 }

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp (180593 => 180594)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.cpp	2015-02-25 00:31:42 UTC (rev 180594)
@@ -160,7 +160,7 @@
     }
 }
 
-void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const ownAndGetterProperties, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
+void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -171,13 +171,31 @@
     ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
     muteConsole();
 
-    injectedScript.getProperties(errorString, objectId, asBool(ownProperties), asBool(ownAndGetterProperties), asBool(generatePreview), &result);
+    injectedScript.getProperties(errorString, objectId, asBool(ownProperties), asBool(generatePreview), &result);
     injectedScript.getInternalProperties(errorString, objectId, asBool(generatePreview), &internalProperties);
 
     unmuteConsole();
     setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
 }
 
+void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, const String& objectId, const bool* const generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
+{
+    InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
+    if (injectedScript.hasNoValue()) {
+        errorString = ASCIILiteral("Inspected frame has gone");
+        return;
+    }
+
+    ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = setPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExceptions);
+    muteConsole();
+
+    injectedScript.getDisplayableProperties(errorString, objectId, asBool(generatePreview), &result);
+    injectedScript.getInternalProperties(errorString, objectId, asBool(generatePreview), &internalProperties);
+
+    unmuteConsole();
+    setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
+}
+
 void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::CollectionEntry>>& entries)
 {
     InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);

Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h (180593 => 180594)


--- trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorRuntimeAgent.h	2015-02-25 00:31:42 UTC (rev 180594)
@@ -63,7 +63,8 @@
     virtual void evaluate(ErrorString&, const String& _expression_, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
     virtual void callFunctionOn(ErrorString&, const String& objectId, const String& _expression_, const RefPtr<Inspector::InspectorArray>&& optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) override final;
     virtual void releaseObject(ErrorString&, const ErrorString& objectId) override final;
-    virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* ownAndGetterProperties, const bool* generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
+    virtual void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
+    virtual void getDisplayableProperties(ErrorString&, const String& objectId, const bool* generatePreview, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) override final;
     virtual void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Runtime::CollectionEntry>>& entries) override final;
     virtual void releaseObjectGroup(ErrorString&, const String& objectGroup) override final;
     virtual void run(ErrorString&) override;

Modified: trunk/Source/_javascript_Core/inspector/protocol/Runtime.json (180593 => 180594)


--- trunk/Source/_javascript_Core/inspector/protocol/Runtime.json	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/_javascript_Core/inspector/protocol/Runtime.json	2015-02-25 00:31:42 UTC (rev 180594)
@@ -76,7 +76,8 @@
                 { "name": "configurable", "type": "boolean", "description": "True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object." },
                 { "name": "enumerable", "type": "boolean", "description": "True if this property shows up during enumeration of the properties on the corresponding object." },
                 { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." },
-                { "name": "isOwn", "optional": true, "type": "boolean", "description": "True if the property is owned for the object." }
+                { "name": "isOwn", "optional": true, "type": "boolean", "description": "True if the property is owned for the object." },
+                { "name": "nativeGetter", "optional": true, "type": "boolean", "description": "True if the property value came from a native getter." }
             ]
         },
         {
@@ -237,7 +238,6 @@
             "parameters": [
                 { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
                 { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the object itself, not to its prototype chain." },
-                { "name": "ownAndGetterProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging to the object itself, and getters in its prototype chain." },
                 { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for property values." }
             ],
             "returns": [
@@ -247,6 +247,18 @@
             "description": "Returns properties of a given object. Object group of the result is inherited from the target object."
         },
         {
+            "name": "getDisplayableProperties",
+            "parameters": [
+                { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
+                { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for property values." }
+            ],
+            "returns": [
+                { "name": "properties", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." },
+                { "name": "internalProperties", "optional": true, "type": "array", "items": { "$ref": "InternalPropertyDescriptor"}, "description": "Internal object properties." }
+            ],
+            "description": "Returns displayable properties of a given object. Object group of the result is inherited from the target object. Displayable properties are own properties, internal properties, and native getters in the prototype chain (assumed to be bindings and treated like own properties for the frontend)."
+        },
+        {
             "name": "getCollectionEntries",
             "description": "Returns entries of given Map / Set collection.",
             "parameters": [

Modified: trunk/Source/WebInspectorUI/ChangeLog (180593 => 180594)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-02-25 00:31:42 UTC (rev 180594)
@@ -1,5 +1,45 @@
 2015-02-24  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: Make Getter/Setter RemoteObject property and ObjectPreview handling consistent
+        https://bugs.webkit.org/show_bug.cgi?id=141587
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/CallFrame.js:
+        (WebInspector.CallFrame.prototype.collectScopeChainVariableNames):
+        * UserInterface/Models/PropertyDescriptor.js:
+        (WebInspector.PropertyDescriptor.prototype.get nativeGetter):
+        * UserInterface/Protocol/RemoteObject.js:
+        (WebInspector.RemoteObject.fromPayload):
+        (WebInspector.RemoteObject.prototype.getOwnPropertyDescriptors):
+        (WebInspector.RemoteObject.prototype.getAllPropertyDescriptors):
+        (WebInspector.RemoteObject.prototype.getDisplayablePropertyDescriptors):
+        (WebInspector.RemoteObject.prototype._getPropertyDescriptors):
+        (WebInspector.RemoteObject.prototype.if):
+        (WebInspector.RemoteObject.prototype.deprecatedGetOwnProperties):
+        (WebInspector.RemoteObject.prototype.deprecatedGetAllProperties):
+        (WebInspector.RemoteObject.prototype._deprecatedGetProperties):
+        (WebInspector.RemoteObject.prototype.getOwnAndGetterPropertyDescriptors): Deleted.
+        (WebInspector.RemoteObject.prototype.callback): Deleted.
+        (WebInspector.RemoteObject.prototype.getOwnProperties): Deleted.
+        (WebInspector.RemoteObject.prototype.getOwnAndGetterProperties): Deleted.
+        (WebInspector.RemoteObject.prototype.getAllProperties): Deleted.
+        (WebInspector.RemoteObject.prototype.set else): Deleted.
+        * UserInterface/Views/ConsoleMessageImpl.js:
+        (WebInspector.ConsoleMessageImpl.prototype._formatParameterAsArray):
+        * UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
+        (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshProperties.nodePrototypesReady):
+        * UserInterface/Views/ObjectPropertiesSection.js:
+        (WebInspector.ObjectPropertiesSection.prototype.update):
+        (WebInspector.ObjectPropertyTreeElement.prototype.onpopulate):
+        * UserInterface/Views/ObjectTreePropertyTreeElement.js:
+        (WebInspector.ObjectTreePropertyTreeElement.prototype.):
+        (WebInspector.ObjectTreePropertyTreeElement.prototype):
+        * UserInterface/Views/ObjectTreeView.js:
+        (WebInspector.ObjectTreeView.prototype.update):
+
+2015-02-24  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: New Object Tree View UI
         https://bugs.webkit.org/show_bug.cgi?id=141932
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/CallFrame.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -98,7 +98,7 @@
         }
 
         for (var i = 0; i < this._scopeChain.length; ++i)
-            this._scopeChain[i].object.getAllProperties(propertiesCollected);
+            this._scopeChain[i].object.deprecatedGetAllProperties(propertiesCollected);
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/PropertyDescriptor.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -23,7 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.PropertyDescriptor = function(descriptor, isOwnProperty, wasThrown, isInternalProperty)
+WebInspector.PropertyDescriptor = function(descriptor, isOwnProperty, wasThrown, nativeGetter, isInternalProperty)
 {
     WebInspector.Object.call(this);
 
@@ -45,6 +45,7 @@
 
     this._own = isOwnProperty || false;
     this._wasThrown = wasThrown || false;
+    this._nativeGetterValue = nativeGetter || false;
     this._internal = isInternalProperty || false;
 };
 
@@ -64,7 +65,7 @@
         payload.isOwn = true;
     }
 
-    return new WebInspector.PropertyDescriptor(payload, payload.isOwn, payload.wasThrown, internal);
+    return new WebInspector.PropertyDescriptor(payload, payload.isOwn, payload.wasThrown, payload.nativeGetter, internal);
 };
 
 WebInspector.PropertyDescriptor.prototype = {
@@ -118,6 +119,11 @@
         return this._wasThrown;
     },
 
+    get nativeGetter()
+    {
+        return this._nativeGetterValue;
+    },
+
     get isInternalProperty()
     {
         return this._internal;

Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -72,9 +72,9 @@
         // COMPATIBILITY (iOS 8): iOS 7 and 8 did not have type/subtype/description on
         // Runtime.ObjectPreview. Copy them over from the RemoteObject.
         if (!payload.preview.type) {
-            payload.preview.type = obj.type;
-            payload.preview.subtype = obj.subtype;
-            payload.preview.description = obj.description;
+            payload.preview.type = payload.type;
+            payload.preview.subtype = payload.subtype;
+            payload.preview.description = payload.description;
         }
         payload.preview = WebInspector.ObjectPreview.fromPayload(payload.preview);
     }
@@ -147,132 +147,112 @@
 
     getOwnPropertyDescriptors: function(callback)
     {
-        this._getPropertyDescriptors(true, false, callback);
+        this._getPropertyDescriptors(true, callback);
     },
 
-    getOwnAndGetterPropertyDescriptors: function(callback)
-    {
-        this._getPropertyDescriptors(false, true, callback);
-    },
-
     getAllPropertyDescriptors: function(callback)
     {
-        this._getPropertyDescriptors(false, false, callback);
+        this._getPropertyDescriptors(false, callback);
     },
 
-    _getPropertyDescriptors: function(ownProperties, ownAndGetterProperties, callback)
+    getDisplayablePropertyDescriptors: function(callback)
     {
         if (!this._objectId || this._isSymbol()) {
             callback([]);
             return;
         }
 
-        function remoteObjectBinder(error, properties, internalProperties)
-        {
-            if (error) {
-                callback(null);
-                return;
-            }
-
-            var descriptors = properties.map(function(payload) {
-                return WebInspector.PropertyDescriptor.fromPayload(payload);
-            });
-
-            if (internalProperties) {
-                descriptors = descriptors.concat(internalProperties.map(function(payload) {
-                    return WebInspector.PropertyDescriptor.fromPayload(payload, true);
-                }));
-            }
-
-            callback(descriptors);
-        }
-
-        // COMPATIBILITY (iOS 8): RuntimeAgent.getProperties did not support ownerAndGetterProperties.
+        // COMPATIBILITY (iOS 8): RuntimeAgent.getDisplayableProperties did not exist.
         // Here we do our best to reimplement it by getting all properties and reducing them down.
-        if (ownAndGetterProperties && !RuntimeAgent.getProperties.supports("ownAndGetterProperties")) {
+        if (!RuntimeAgent.getDisplayableProperties) {
             RuntimeAgent.getProperties(this._objectId, function(error, allProperties) {
                 var ownOrGetterPropertiesList = [];
                 if (allProperties) {
                     for (var property of allProperties) {
-                        if (property.isOwn || property.get || property.name === "__proto__") {
+                        if (property.isOwn || property.name === "__proto__") {
                             // Own property or getter property in prototype chain.
                             ownOrGetterPropertiesList.push(property);
                         } else if (property.value && property.name !== property.name.toUpperCase()) {
                             var type = property.value.type;
                             if (type && type !== "function" && property.name !== "constructor") {
                                 // Possible native binding getter property converted to a value. Also, no CONSTANT name style and not "constructor".
+                                // There is no way of knowing if this is native or not, so just go with it.
                                 ownOrGetterPropertiesList.push(property);
                             }
                         }
                     }
                 }
-                remoteObjectBinder(error, ownOrGetterPropertiesList);
-            });
+                this._getPropertyDescriptorsResolver(callback, error, ownOrGetterPropertiesList);
+            }.bind(this));
             return;
         }
 
-        RuntimeAgent.getProperties(this._objectId, ownProperties, ownAndGetterProperties, true, remoteObjectBinder);
+        RuntimeAgent.getDisplayableProperties(this._objectId, true, this._getPropertyDescriptorsResolver.bind(this, callback));
     },
 
-    // FIXME: Phase out these functions. They return RemoteObjectProperty instead of PropertyDescriptors.
+    _getPropertyDescriptors: function(ownProperties, callback)
+    {
+        if (!this._objectId || this._isSymbol()) {
+            callback([]);
+            return;
+        }
 
-    getOwnProperties: function(callback)
+
+        RuntimeAgent.getProperties(this._objectId, ownProperties, true, this._getPropertyDescriptorsResolver.bind(this, callback));
+    },
+
+    _getPropertyDescriptorsResolver: function(callback, error, properties, internalProperties)
     {
-        this._getProperties(true, false, callback);
+        if (error) {
+            callback(null);
+            return;
+        }
+
+        var descriptors = properties.map(function(payload) {
+            return WebInspector.PropertyDescriptor.fromPayload(payload);
+        });
+
+        if (internalProperties) {
+            descriptors = descriptors.concat(internalProperties.map(function(payload) {
+                return WebInspector.PropertyDescriptor.fromPayload(payload, true);
+            }));
+        }
+
+        callback(descriptors);
     },
 
-    getOwnAndGetterProperties: function(callback)
+    // FIXME: Phase out these functions. They return RemoteObjectProperty instead of PropertyDescriptors.
+
+    deprecatedGetOwnProperties: function(callback)
     {
-        this._getProperties(false, true, callback);
+        this._deprecatedGetProperties(true, callback);
     },
 
-    getAllProperties: function(callback)
+    deprecatedGetAllProperties: function(callback)
     {
-        this._getProperties(false, false, callback);
+        this._deprecatedGetProperties(false, callback);
     },
 
-    _getProperties: function(ownProperties, ownAndGetterProperties, callback)
+    _deprecatedGetProperties: function(ownProperties, callback)
     {
         if (!this._objectId || this._isSymbol()) {
             callback([]);
             return;
         }
 
-        function remoteObjectBinder(error, properties, internalProperties)
-        {
-            if (error) {
-                callback(null);
-                return;
-            }
+        RuntimeAgent.getProperties(this._objectId, ownProperties, this._deprecatedGetPropertiesResolver.bind(this, callback));
+    },
 
-            // FIXME: WebInspector.PropertyDescriptor instead of RemoteObjectProperty.
-            if (internalProperties) {
-                properties = properties.concat(internalProperties.map(function(descriptor) {
-                    descriptor.writable = false;
-                    descriptor.configurable = false;
-                    descriptor.enumerable = false;
-                    descriptor.isOwn = true;
-                    return descriptor;
-                }));
-            }
-
-            var result = [];
-            for (var i = 0; properties && i < properties.length; ++i) {
-                var property = properties[i];
-                if (property.get || property.set) {
-                    if (property.get)
-                        result.push(new WebInspector.RemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property));
-                    if (property.set)
-                        result.push(new WebInspector.RemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property));
-                } else
-                    result.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property));
-            }
-            callback(result);
+    deprecatedGetDisplayableProperties: function(callback)
+    {
+        if (!this._objectId || this._isSymbol()) {
+            callback([]);
+            return;
         }
 
         // COMPATIBILITY (iOS 8): RuntimeAgent.getProperties did not support ownerAndGetterProperties.
         // Here we do our best to reimplement it by getting all properties and reducing them down.
-        if (ownAndGetterProperties && !RuntimeAgent.getProperties.supports("ownAndGetterProperties")) {
+        if (!RuntimeAgent.getDisplayableProperties) {
             RuntimeAgent.getProperties(this._objectId, function(error, allProperties) {
                 var ownOrGetterPropertiesList = [];
                 if (allProperties) {
@@ -289,14 +269,45 @@
                         }
                     }
                 }
-                remoteObjectBinder(error, ownOrGetterPropertiesList);
-            });
+                this._deprecatedGetPropertiesResolver(callback, error, ownOrGetterPropertiesList);
+            }.bind(this));
             return;
         }
 
-        RuntimeAgent.getProperties(this._objectId, ownProperties, ownAndGetterProperties, remoteObjectBinder);
+        RuntimeAgent.getDisplayableProperties(this._objectId, this._deprecatedGetPropertiesResolver.bind(this, callback));
     },
 
+    _deprecatedGetPropertiesResolver: function(callback, error, properties, internalProperties)
+    {
+        if (error) {
+            callback(null);
+            return;
+        }
+
+        if (internalProperties) {
+            properties = properties.concat(internalProperties.map(function(descriptor) {
+                descriptor.writable = false;
+                descriptor.configurable = false;
+                descriptor.enumerable = false;
+                descriptor.isOwn = true;
+                return descriptor;
+            }));
+        }
+
+        var result = [];
+        for (var i = 0; properties && i < properties.length; ++i) {
+            var property = properties[i];
+            if (property.get || property.set) {
+                if (property.get)
+                    result.push(new WebInspector.RemoteObjectProperty("get " + property.name, WebInspector.RemoteObject.fromPayload(property.get), property));
+                if (property.set)
+                    result.push(new WebInspector.RemoteObjectProperty("set " + property.name, WebInspector.RemoteObject.fromPayload(property.set), property));
+            } else
+                result.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property));
+        }
+        callback(result);
+    },
+
     setPropertyValue: function(name, value, callback)
     {
         if (!this._objectId || this._isSymbol()) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageImpl.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -332,7 +332,7 @@
     _formatParameterAsArray: function(arr, elem)
     {
         // FIXME: Array previews look poor. Keep doing what we currently do for arrays.
-        arr.getOwnProperties(this._printArray.bind(this, arr, elem));
+        arr.deprecatedGetOwnProperties(this._printArray.bind(this, arr, elem));
     },
 
     _userProvidedColumnNames: function(columnNamesArgument)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -175,7 +175,7 @@
             if (this.domNode !== domNode)
                 return;
 
-            object.getOwnProperties(fillSection.bind(this));
+            object.deprecatedGetOwnProperties(fillSection.bind(this));
         }
 
         function fillSection(prototypes)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesSection.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesSection.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectPropertiesSection.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -52,9 +52,9 @@
         }
 
         if (this.getAllProperties)
-            this.object.getAllProperties(callback.bind(this));
+            this.object.deprecatedGetAllProperties(callback.bind(this));
         else
-            this.object.getOwnAndGetterProperties(callback.bind(this));
+            this.object.deprecatedGetDisplayableProperties(callback.bind(this));
     },
 
     updateProperties: function(properties, rootTreeElementConstructor, rootPropertyComparer)
@@ -171,9 +171,9 @@
         };
 
         if (this.property.name === "__proto__")
-            this.property.value.getOwnProperties(callback.bind(this));
+            this.property.value.deprecatedGetOwnProperties(callback.bind(this));
         else
-            this.property.value.getOwnAndGetterProperties(callback.bind(this));
+            this.property.value.deprecatedGetDisplayableProperties(callback.bind(this));
     },
 
     ondblclick: function(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -403,9 +403,17 @@
                     prototypeName = this._sanitizedPrototypeString(resolvedValue);
             }
 
+            var isAPI = mode === WebInspector.ObjectTreeView.Mode.API;
+
             properties.sort(WebInspector.ObjectTreeView.ComparePropertyDescriptors);
-            for (var propertyDescriptor of properties)
+            for (var propertyDescriptor of properties) {
+                // FIXME: If this is a pure API ObjectTree, we should show the native getters.
+                // For now, just skip native binding getters in API mode, since we likely
+                // already showed them in the Properties section.
+                if (isAPI && propertyDescriptor.nativeGetter)
+                    continue;
                 this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, resolvedValuePropertyPath, mode, prototypeName));
+            }
 
             // FIXME: Re-enable Collection Entries with new UI.
             // if (mode === WebInspector.ObjectTreeView.Mode.Properties) {
@@ -417,6 +425,6 @@
         if (this._property.name === "__proto__")
             resolvedValue.getOwnPropertyDescriptors(callback.bind(this, WebInspector.ObjectTreeView.Mode.API));
         else
-            resolvedValue.getOwnPropertyDescriptors(callback.bind(this, this._mode));
+            resolvedValue.getDisplayablePropertyDescriptors(callback.bind(this, this._mode));
     },
 };

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (180593 => 180594)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js	2015-02-25 00:31:38 UTC (rev 180593)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js	2015-02-25 00:31:42 UTC (rev 180594)
@@ -171,7 +171,7 @@
 
     update: function()
     {
-        this._object.getOwnPropertyDescriptors(this._updateProperties.bind(this));
+        this._object.getDisplayablePropertyDescriptors(this._updateProperties.bind(this));
     },
 
     // Private
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to