Diff
Modified: trunk/LayoutTests/ChangeLog (92764 => 92765)
--- trunk/LayoutTests/ChangeLog 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/LayoutTests/ChangeLog 2011-08-10 13:41:30 UTC (rev 92765)
@@ -1,3 +1,16 @@
+2011-08-10 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: there should be a way to tell what properties are non-enumerable when expanding objects.
+ https://bugs.webkit.org/show_bug.cgi?id=65518
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/debugger/debugger-expand-scope-expected.txt:
+ * 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: Removed.
+
2011-08-10 Alexander Pavlov <apav...@chromium.org>
Web Inspector: [REGRESSION] Editor lost after committing a CSS property value for inline style
Modified: trunk/LayoutTests/inspector/debugger/debugger-expand-scope-expected.txt (92764 => 92765)
--- trunk/LayoutTests/inspector/debugger/debugger-expand-scope-expected.txt 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/LayoutTests/inspector/debugger/debugger-expand-scope-expected.txt 2011-08-10 13:41:30 UTC (rev 92765)
@@ -12,7 +12,7 @@
this: DOMWindow
x: 2010
DOMWindowWith Block
- innerFunction: function innerFunction(x) {
+ No Properties
Closure
arguments: Arguments[1]
makeClosureLocalVar: "local.TextParam"
Modified: trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt (92764 => 92765)
--- trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/LayoutTests/inspector/protocol/runtime-agent-expected.txt 2011-08-10 13:41:30 UTC (rev 92765)
@@ -167,7 +167,7 @@
method : "Runtime.getProperties"
params : {
objectId : <string>
- ignoreHasOwnProperty : false
+ ownProperties : false
}
id : <number>
}
@@ -177,30 +177,27 @@
result : {
result : [
{
- name : "assignedByCallFunctionOn"
value : {
type : "string"
value : "callFunctionOn function works fine"
}
+ writable : true
+ enumerable : true
+ configurable : true
+ name : "assignedByCallFunctionOn"
}
{
- name : "self"
value : {
type : "object"
objectId : <string>
className : <string>
description : "TestObject"
}
+ writable : true
+ enumerable : true
+ configurable : true
+ name : "self"
}
- {
- name : "__proto__"
- value : {
- type : "object"
- objectId : <string>
- className : <string>
- description : "TestObject"
- }
- }
]
}
id : <number>
Modified: trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt (92764 => 92765)
--- trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/LayoutTests/inspector/runtime/runtime-getProperties-expected.txt 2011-08-10 13:41:30 UTC (rev 92765)
@@ -9,14 +9,20 @@
value : {
type : "function"
description : "function () { return 1; }"
+ objectId : <string>
}
+ enumerable : true
+ writable : false
}
{
name : "set foo"
value : {
type : "function"
description : "function (value) { }"
+ objectId : <string>
}
+ enumerable : true
+ writable : false
}
Running: testGetterOnly
@@ -25,6 +31,9 @@
value : {
type : "function"
description : "function () { return 1; }"
+ objectId : <string>
}
+ enumerable : true
+ writable : false
}
Modified: trunk/LayoutTests/inspector/runtime/runtime-getProperties.html (92764 => 92765)
--- trunk/LayoutTests/inspector/runtime/runtime-getProperties.html 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/LayoutTests/inspector/runtime/runtime-getProperties.html 2011-08-10 13:41:30 UTC (rev 92765)
@@ -65,13 +65,10 @@
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);
+ var value = property.value;
+ if (value)
+ property.value = { type: value.type, description: value.description.replace("function foo", "function "), objectId: value.objectId };
+ InspectorTest.dump(property, { objectId: true });
}
}
Deleted: trunk/LayoutTests/platform/chromium/inspector/runtime/runtime-getProperties-expected.txt (92764 => 92765)
--- trunk/LayoutTests/platform/chromium/inspector/runtime/runtime-getProperties-expected.txt 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/LayoutTests/platform/chromium/inspector/runtime/runtime-getProperties-expected.txt 2011-08-10 13:41:30 UTC (rev 92765)
@@ -1,30 +0,0 @@
-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; }"
- }
-}
-
Modified: trunk/Source/WebCore/ChangeLog (92764 => 92765)
--- trunk/Source/WebCore/ChangeLog 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/ChangeLog 2011-08-10 13:41:30 UTC (rev 92765)
@@ -1,3 +1,29 @@
+2011-08-10 Pavel Feldman <pfeld...@chromium.org>
+
+ Web Inspector: there should be a way to tell what properties are non-enumerable when expanding objects.
+ https://bugs.webkit.org/show_bug.cgi?id=65518
+
+ Reviewed by Yury Semikhatsky.
+
+ * 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.RemoteObjectProperty):
+ * inspector/front-end/inspector.css:
+ (.section .properties .dimmed):
+
2011-08-10 Alexander Pavlov <apav...@chromium.org>
Web Inspector: [REGRESSION] Editor lost after committing a CSS property value for inline style
Modified: trunk/Source/WebCore/inspector/InjectedScript.cpp (92764 => 92765)
--- trunk/Source/WebCore/inspector/InjectedScript.cpp 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/InjectedScript.cpp 2011-08-10 13:41:30 UTC (rev 92765)
@@ -85,11 +85,11 @@
makeEvalCall(errorString, function, result, wasThrown);
}
-void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* properties)
+void InjectedScript::getProperties(ErrorString* errorString, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* properties)
{
ScriptFunctionCall function(m_injectedScriptObject, "getProperties");
function.appendArgument(objectId);
- function.appendArgument(ignoreHasOwnProperty);
+ function.appendArgument(ownProperties);
RefPtr<InspectorValue> result;
makeCall(function, &result);
Modified: trunk/Source/WebCore/inspector/InjectedScript.h (92764 => 92765)
--- trunk/Source/WebCore/inspector/InjectedScript.h 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/InjectedScript.h 2011-08-10 13:41:30 UTC (rev 92765)
@@ -70,7 +70,7 @@
RefPtr<InspectorObject>* result,
bool* wasThrown);
void evaluateOnCallFrame(ErrorString*, const ScriptValue& callFrames, const String& callFrameId, const String& _expression_, const String& objectGroup, bool includeCommandLineAPI, RefPtr<InspectorObject>* result, bool* wasThrown);
- void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result);
+ void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* result);
Node* nodeForObjectId(const String& objectId);
void releaseObject(const String& objectId);
Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (92764 => 92765)
--- trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js 2011-08-10 13:41:30 UTC (rev 92765)
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -165,7 +165,7 @@
return result;
},
- getProperties: function(objectId, ignoreHasOwnProperty)
+ getProperties: function(objectId, ownProperties)
{
var parsedObjectId = this._parseObjectId(objectId);
var object = this._objectForId(parsedObjectId);
@@ -173,46 +173,25 @@
if (!this._isDefined(object))
return false;
- var properties = [];
+ var descriptors = this._propertyDescriptors(object, ownProperties);
- var propertyNames = ignoreHasOwnProperty ? this._getPropertyNames(object) : Object.getOwnPropertyNames(object);
- if (!ignoreHasOwnProperty && object.__proto__)
- propertyNames.push("__proto__");
+ // Go over properties, wrap object values.
+ if (descriptors.length === 0 && "arguments" in object) {
+ // Fill in JSC scope object.
+ for (var key in object)
+ descriptors.push({ name: key, value: object[key], writable: false, configurable: false, enumerable: true});
+ }
- // Go over properties, prepare results.
- for (var i = 0; i < propertyNames.length; ++i) {
- var propertyName = propertyNames[i];
-
- var getter = (typeof object["__lookupGetter__"] === "function") && object.__lookupGetter__(propertyName);
- var setter = (typeof object["__lookupSetter__"] === "function") && 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 {
- value = object[propertyName];
- } catch(e) {
- var value = e;
- property.wasThrown = true;
- }
- property.value = this._wrapObject(value, objectGroupName);
- properties.push(property);
- }
+ for (var i = 0; i < descriptors.length; ++i) {
+ var descriptor = descriptors[i];
+ if (descriptor.get)
+ descriptor.get = this._wrapObject(descriptor.get, objectGroupName);
+ if (descriptor.set)
+ descriptor.set = this._wrapObject(descriptor.set, objectGroupName);
+ if ("value" in descriptor)
+ descriptor.value = this._wrapObject(descriptor.value, objectGroupName);
}
- return properties;
+ return descriptors;
},
releaseObject: function(objectId)
@@ -227,25 +206,41 @@
delete this._idToObjectGroupName[id];
},
- _populatePropertyNames: function(object, resultSet)
+ _propertyDescriptors: function(object, ownProperties)
{
- for (var o = object; o; o = o.__proto__) {
- try {
- var names = Object.getOwnPropertyNames(o);
- for (var i = 0; i < names.length; ++i)
- resultSet[names[i]] = true;
- } catch (e) {
+ var descriptors = [];
+ var nameProcessed = {};
+ nameProcessed.__proto__ = null;
+ for (var o = object; this._isDefined(o); o = o.__proto__) {
+ var names = Object.getOwnPropertyNames(o);
+ for (var i = 0; i < names.length; ++i) {
+ var name = names[i];
+ if (nameProcessed[name])
+ continue;
+
+ try {
+ nameProcessed[name] = true;
+ var descriptor = Object.getOwnPropertyDescriptor(object, name);
+ if (!descriptor)
+ continue;
+ } catch (e) {
+ var descriptor = {};
+ descriptor.value = e;
+ descriptor.wasThrown = true;
+ }
+
+ descriptor.name = name;
+ descriptors.push(descriptor);
}
+ if (ownProperties) {
+ if (object.__proto__)
+ descriptors.push({ name: "__proto__", value: object.__proto__, writable: true, configurable: true, enumerable: false});
+ break;
+ }
}
+ return descriptors;
},
- _getPropertyNames: function(object, resultSet)
- {
- var propertyNameSet = {};
- this._populatePropertyNames(object, propertyNameSet);
- return Object.keys(propertyNameSet);
- },
-
evaluate: function(_expression_, objectGroup, injectCommandLineAPI, returnByValue)
{
return this._evaluateAndWrap(InjectedScriptHost.evaluate, InjectedScriptHost, _expression_, objectGroup, false, injectCommandLineAPI, returnByValue);
Modified: trunk/Source/WebCore/inspector/Inspector.json (92764 => 92765)
--- trunk/Source/WebCore/inspector/Inspector.json 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/Inspector.json 2011-08-10 13:41:30 UTC (rev 92765)
@@ -236,13 +236,16 @@
]
},
{
- "id": "RemoteProperty",
+ "id": "PropertyDescriptor",
"type": "object",
- "description": "Mirror object property.",
+ "description": "Object property descriptor.",
"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": "value", "$ref": "RemoteObject", "description": "The value associated with the property." },
+ { "name": "writable", "type": "boolean", "description": "True iff the value associated with the property may be changed (data descriptors only)." },
+ { "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)." },
+ { "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)." },
+ { "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." },
+ { "name": "enumerable", "type": "boolean", "description": "True iff this property shows up during enumeration of the properties on the corresponding object." }
]
},
{
@@ -290,10 +293,10 @@
"name": "getProperties",
"parameters": [
{ "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to return properties for." },
- { "name": "ignoreHasOwnProperty", "type": "boolean", "description": "If true, returns properties belonging to any element of the prototype chain." }
+ { "name": "ownProperties", "optional": true, "type": "boolean", "description": "If true, returns properties belonging only to the element itself, not to its prototype chain." }
],
"returns": [
- { "name": "result", "type": "array", "items": { "$ref": "RemoteProperty"}, "description": "Object properties." }
+ { "name": "result", "type": "array", "items": { "$ref": "PropertyDescriptor"}, "description": "Object properties." }
],
"description": "Returns properties of a given object."
},
Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp (92764 => 92765)
--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp 2011-08-10 13:41:30 UTC (rev 92765)
@@ -109,14 +109,14 @@
injectedScript.callFunctionOn(errorString, objectId, _expression_, arguments, asBool(returnByValue), result, wasThrown);
}
-void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result)
+void InspectorRuntimeAgent::getProperties(ErrorString* errorString, const String& objectId, const bool* const ownProperties, RefPtr<InspectorArray>* result)
{
InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(objectId);
if (injectedScript.hasNoValue()) {
*errorString = "Inspected frame has gone";
return;
}
- injectedScript.getProperties(errorString, objectId, ignoreHasOwnProperty, result);
+ injectedScript.getProperties(errorString, objectId, ownProperties ? *ownProperties : false, result);
}
void InspectorRuntimeAgent::releaseObject(ErrorString*, const String& objectId)
Modified: trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h (92764 => 92765)
--- trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/InspectorRuntimeAgent.h 2011-08-10 13:41:30 UTC (rev 92765)
@@ -70,7 +70,7 @@
RefPtr<InspectorObject>* result,
bool* wasThrown);
void releaseObject(ErrorString*, const String& objectId);
- void getProperties(ErrorString*, const String& objectId, bool ignoreHasOwnProperty, RefPtr<InspectorArray>* result);
+ void getProperties(ErrorString*, const String& objectId, const bool* const ownProperties, RefPtr<InspectorArray>* result);
void releaseObjectGroup(ErrorString*, const String& objectGroup);
#if ENABLE(_javascript__DEBUGGER)
Modified: trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js (92764 => 92765)
--- trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2011-08-10 13:41:30 UTC (rev 92765)
@@ -166,7 +166,8 @@
ondblclick: function(event)
{
- this.startEditing();
+ if (this.property.writable)
+ this.startEditing();
},
onattach: function()
@@ -179,6 +180,8 @@
this.nameElement = document.createElement("span");
this.nameElement.className = "name";
this.nameElement.textContent = this.property.name;
+ if (!this.property.enumerable)
+ this.nameElement.addStyleClass("dimmed");
var separatorElement = document.createElement("span");
separatorElement.className = "separator";
Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (92764 => 92765)
--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2011-08-10 13:41:30 UTC (rev 92765)
@@ -116,15 +116,15 @@
getOwnProperties: function(callback)
{
- this._getProperties(false, callback);
+ this._getProperties(true, callback);
},
getAllProperties: function(callback)
{
- this._getProperties(true, callback);
+ this._getProperties(false, callback);
},
- _getProperties: function(ignoreHasOwnProperty, callback)
+ _getProperties: function(ownProperties, callback)
{
if (!this._objectId) {
callback([]);
@@ -136,11 +136,20 @@
callback(null);
return;
}
- for (var i = 0; properties && i < properties.length; ++i)
- properties[i].value = WebInspector.RemoteObject.fromPayload(properties[i].value);
- callback(properties);
+ 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);
}
- RuntimeAgent.getProperties(this._objectId, !!ignoreHasOwnProperty, remoteObjectBinder);
+ RuntimeAgent.getProperties(this._objectId, ownProperties, remoteObjectBinder);
},
setPropertyValue: function(name, value, callback)
@@ -213,10 +222,14 @@
}
}
-WebInspector.RemoteObjectProperty = function(name, value)
+WebInspector.RemoteObjectProperty = function(name, value, descriptor)
{
this.name = name;
this.value = value;
+ this.enumerable = descriptor ? !!descriptor.enumerable : true;
+ this.writable = descriptor ? !!descriptor.writable : true;
+ if (descriptor && descriptor.wasThrown)
+ this.wasThrown = true;
}
WebInspector.RemoteObjectProperty.fromPrimitiveValue = function(name, value)
Modified: trunk/Source/WebCore/inspector/front-end/inspector.css (92764 => 92765)
--- trunk/Source/WebCore/inspector/front-end/inspector.css 2011-08-10 13:36:50 UTC (rev 92764)
+++ trunk/Source/WebCore/inspector/front-end/inspector.css 2011-08-10 13:41:30 UTC (rev 92765)
@@ -1634,8 +1634,8 @@
color: rgb(136, 19, 145);
}
-.section .properties .value.dimmed {
- color: rgb(100, 100, 100);
+.section .properties .dimmed {
+ opacity: 0.6;
}
.section .properties .value.error {