Diff
Modified: trunk/LayoutTests/ChangeLog (134913 => 134914)
--- trunk/LayoutTests/ChangeLog 2012-11-16 08:37:20 UTC (rev 134913)
+++ trunk/LayoutTests/ChangeLog 2012-11-16 09:06:31 UTC (rev 134914)
@@ -1,3 +1,19 @@
+2012-11-16 Peter Rybin <pry...@chromium.org>
+
+ Web Inspector: show internal properties in inspector frontend
+ https://bugs.webkit.org/show_bug.cgi?id=100021
+
+ Reviewed by Yury Semikhatsky.
+
+ A new test is added. InspectorTest.dumpObjectPropertySectionDeep function is added.
+
+ * http/tests/inspector/elements-test.js:
+ (initialize_ElementTest.InspectorTest.dumpObjectPropertySectionDeep):
+ (initialize_ElementTest.InspectorTest.dumpObjectPropertySectionDeep.dumpTreeElement):
+ * inspector/debugger/properties-special-expected.txt: Added.
+ * inspector/debugger/properties-special.html: Added.
+ * platform/chromium/inspector/debugger/properties-special-expected.txt: Added.
+
2012-11-16 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r134865.
Modified: trunk/LayoutTests/http/tests/inspector/elements-test.js (134913 => 134914)
--- trunk/LayoutTests/http/tests/inspector/elements-test.js 2012-11-16 08:37:20 UTC (rev 134913)
+++ trunk/LayoutTests/http/tests/inspector/elements-test.js 2012-11-16 09:06:31 UTC (rev 134914)
@@ -261,6 +261,29 @@
}
}
+InspectorTest.dumpObjectPropertySectionDeep = function(section)
+{
+ function domNodeToString(node) {
+ if (node)
+ return "'" + node.textContent + "'";
+ else
+ return "null";
+ }
+ function dumpTreeElementRecursively(treeElement, prefix) {
+ if ("nameElement" in treeElement)
+ InspectorTest.addResult(prefix + domNodeToString(treeElement.nameElement) + " => " + domNodeToString(treeElement.valueElement));
+ else
+ InspectorTest.addResult(prefix + treeElement.title);
+ for (var i = 0; i < treeElement.children.length; i++)
+ dumpTreeElementRecursively(treeElement.children[i], prefix + " ");
+ }
+
+ var childNodes = section.propertiesTreeOutline.children;
+ for (var i = 0; i < childNodes.length; i++) {
+ dumpTreeElementRecursively(childNodes[i], "");
+ }
+}
+
// FIXME: this returns the first tree item found (may fail for same-named properties in a style).
InspectorTest.getElementStylePropertyTreeItem = function(propertyName)
{
Added: trunk/LayoutTests/inspector/debugger/properties-special-expected.txt (0 => 134914)
--- trunk/LayoutTests/inspector/debugger/properties-special-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/debugger/properties-special-expected.txt 2012-11-16 09:06:31 UTC (rev 134914)
@@ -0,0 +1,28 @@
+Tests how debugger presents special properties of closures, bound functions and object wrappers.
+
+Debugger was enabled.
+Script source was shown.
+Set timer for test function.
+Watch expressions updated.
+Nodes are expanded.
+'Object(true)' => 'Boolean'
+ '__proto__' => 'Boolean'
+'(function(a,b) { return a + b; })' => 'function (a, b) { return a + b; }'
+ 'arguments' => 'null'
+ 'caller' => 'null'
+ 'length' => '2'
+ 'name' => '""'
+ 'prototype' => 'Object'
+ '__proto__' => 'function () {'
+ <function scope>
+'(function(a,b) { return a + b; }).bind({}, 2)' => 'function () {'
+ 'get arguments' => 'function () {'
+ 'get caller' => 'function () {'
+ 'length' => '1'
+ 'name' => '""'
+ 'set arguments' => 'function () {'
+ 'set caller' => 'function () {'
+ '__proto__' => 'function () {'
+ <function scope>
+Debugger was disabled.
+
Added: trunk/LayoutTests/inspector/debugger/properties-special.html (0 => 134914)
--- trunk/LayoutTests/inspector/debugger/properties-special.html (rev 0)
+++ trunk/LayoutTests/inspector/debugger/properties-special.html 2012-11-16 09:06:31 UTC (rev 134914)
@@ -0,0 +1,79 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+<script>
+function testFunction()
+{
+ var x = Math.sqrt(10);
+ return x;
+}
+
+var test = function()
+{
+ InspectorTest.setQuiet(true);
+ InspectorTest.startDebuggerTest(step1);
+
+ var currentSourceFrame;
+ var watchExpressionsSection;
+
+ function step1()
+ {
+ // We need to initialize scripts panel so that watch expressions section is created.
+ WebInspector.showPanel("scripts");
+
+ watchExpressionsSection = WebInspector.panels.scripts.sidebarPanes.watchExpressions.section;
+ watchExpressionsSection.watchExpressions = [];
+ watchExpressionsSection.watchExpressions.push("Object(true)");
+ watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; })");
+ watchExpressionsSection.watchExpressions.push("(function(a,b) { return a + b; }).bind({}, 2)");
+ watchExpressionsSection.update();
+
+ var testName = WebInspector.inspectedPageURL;
+ testName = testName.substring(testName.lastIndexOf('/') + 1);
+ InspectorTest.showScriptSource(testName, didShowScriptSource);
+ }
+
+ function didShowScriptSource(sourceFrame)
+ {
+ currentSourceFrame = sourceFrame;
+ InspectorTest.addResult("Script source was shown.");
+ InspectorTest.setBreakpoint(currentSourceFrame, 9, "", true);
+ InspectorTest.addSniffer(WebInspector.WatchExpressionsSection.prototype, "update", watchExpressionsUpdated);
+ InspectorTest.runTestFunctionAndWaitUntilPaused(didPaused);
+ }
+
+ function didPaused(callFrames)
+ {
+ }
+
+ function watchExpressionsUpdated()
+ {
+ InspectorTest.addResult("Watch expressions updated.");
+ var treeNodes = watchExpressionsSection.propertiesTreeOutline.children;
+ for (var i = 0; i < treeNodes.length; i++) {
+ treeNodes[i].expand();
+ }
+ InspectorTest.runAfterPendingDispatches(nodesExpanded);
+ }
+
+ function nodesExpanded()
+ {
+ InspectorTest.addResult("Nodes are expanded.");
+ InspectorTest.dumpObjectPropertySectionDeep(watchExpressionsSection);
+
+ // Clear watch expressions after execution.
+ watchExpressionsSection.watchExpressions = [];
+ watchExpressionsSection.update();
+
+ InspectorTest.completeDebuggerTest();
+ }
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests how debugger presents special properties of closures, bound functions and object wrappers.</p>
+</body>
+</html>
Added: trunk/LayoutTests/platform/chromium/inspector/debugger/properties-special-expected.txt (0 => 134914)
--- trunk/LayoutTests/platform/chromium/inspector/debugger/properties-special-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/chromium/inspector/debugger/properties-special-expected.txt 2012-11-16 09:06:31 UTC (rev 134914)
@@ -0,0 +1,31 @@
+Tests how debugger presents special properties of closures, bound functions and object wrappers.
+
+Debugger was enabled.
+Script source was shown.
+Set timer for test function.
+Watch expressions updated.
+Nodes are expanded.
+'Object(true)' => 'Boolean'
+ '__proto__' => 'Boolean'
+ '[[PrimitiveValue]]' => 'true'
+'(function(a,b) { return a + b; })' => 'function (a,b) { return a + b; }'
+ 'arguments' => 'null'
+ 'caller' => 'null'
+ 'length' => '2'
+ 'name' => '""'
+ 'prototype' => 'Object'
+ '__proto__' => 'function Empty() {}'
+ <function scope>
+'(function(a,b) { return a + b; }).bind({}, 2)' => 'function () { [native code] }'
+ 'get arguments' => 'function ThrowTypeError() { [native code] }'
+ 'get caller' => 'function ThrowTypeError() { [native code] }'
+ 'length' => '1'
+ 'name' => '""'
+ 'set arguments' => 'function ThrowTypeError() { [native code] }'
+ 'set caller' => 'function ThrowTypeError() { [native code] }'
+ '__proto__' => 'function Empty() {}'
+ '[[TargetFunction]]' => 'function (a,b) { return a + b; }'
+ '[[BoundThis]]' => 'Object'
+ '[[BoundArgs]]' => 'Array[1]'
+Debugger was disabled.
+
Modified: trunk/Source/WebCore/ChangeLog (134913 => 134914)
--- trunk/Source/WebCore/ChangeLog 2012-11-16 08:37:20 UTC (rev 134913)
+++ trunk/Source/WebCore/ChangeLog 2012-11-16 09:06:31 UTC (rev 134914)
@@ -1,3 +1,25 @@
+2012-11-16 Peter Rybin <pry...@chromium.org>
+
+ Web Inspector: show internal properties in inspector frontend
+ https://bugs.webkit.org/show_bug.cgi?id=100021
+
+ Reviewed by Yury Semikhatsky.
+
+ New field 'internalProperties' is parsed and passed via all callbacks to Object Properties section.
+
+ Test: inspector/debugger/properties-special.html
+
+ * inspector/front-end/ObjectPropertiesSection.js:
+ (WebInspector.ObjectPropertiesSection.prototype.update.callback):
+ (WebInspector.ObjectPropertiesSection.prototype.update):
+ (.callback):
+ (WebInspector.ObjectPropertyTreeElement.populate):
+ (.processProperties):
+ (WebInspector.ArrayGroupingTreeElement._populateAsFragment):
+ (WebInspector.ArrayGroupingTreeElement._populateNonIndexProperties):
+ * inspector/front-end/RemoteObject.js:
+ (WebInspector.RemoteObject.prototype.set else):
+
2012-11-06 Alexander Pavlov <apav...@chromium.org>
Web Inspector: metrics, geolocation, orientation overrides do not belong to the settings panel
Modified: trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js (134913 => 134914)
--- trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2012-11-16 08:37:20 UTC (rev 134913)
+++ trunk/Source/WebCore/inspector/front-end/ObjectPropertiesSection.js 2012-11-16 09:06:31 UTC (rev 134914)
@@ -76,7 +76,7 @@
return;
}
- function callback(properties)
+ function callback(properties, internalProperties)
{
if (!properties)
return;
@@ -428,7 +428,11 @@
return;
}
- function callback(properties)
+ /**
+ * @param {Array.<WebInspector.RemoteObjectProperty>} properties
+ * @param {Array.<WebInspector.RemoteObjectProperty>=} internalProperties
+ */
+ function callback(properties, internalProperties)
{
treeElement.removeChildren();
if (!properties)
@@ -441,8 +445,29 @@
properties[i].parentObject = value;
treeElement.appendChild(new treeElement.treeOutline.section.treeElementConstructor(properties[i]));
}
- if (value.type === "function")
- treeElement.appendChild(new WebInspector.FunctionScopeMainTreeElement(value));
+ if (value.type === "function") {
+ // Whether function has TargetFunction internal property.
+ // This is a simple way to tell that the function is actually a bound function (we are not told).
+ // Bound function never has inner scope and doesn't need corresponding UI node.
+ var hasTargetFunction = false;
+
+ if (internalProperties) {
+ for (var i = 0; i < internalProperties.length; i++) {
+ if (internalProperties[i].name == "[[TargetFunction]]") {
+ hasTargetFunction = true;
+ break;
+ }
+ }
+ }
+ if (!hasTargetFunction)
+ treeElement.appendChild(new WebInspector.FunctionScopeMainTreeElement(value));
+ }
+ if (internalProperties) {
+ for (var i = 0; i < internalProperties.length; i++) {
+ internalProperties[i].parentObject = value;
+ treeElement.appendChild(new treeElement.treeOutline.section.treeElementConstructor(internalProperties[i]));
+ }
+ }
}
value.getOwnProperties(callback);
@@ -688,7 +713,7 @@
}
/** @this {WebInspector.ArrayGroupingTreeElement} */
- function processProperties(properties)
+ function processProperties(properties, internalProperties)
{
if (!properties)
return;
@@ -733,7 +758,7 @@
}
/** @this {WebInspector.ArrayGroupingTreeElement} */
- function processProperties(properties)
+ function processProperties(properties, internalProperties)
{
if (!properties)
return;
Modified: trunk/Source/WebCore/inspector/front-end/RemoteObject.js (134913 => 134914)
--- trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2012-11-16 08:37:20 UTC (rev 134913)
+++ trunk/Source/WebCore/inspector/front-end/RemoteObject.js 2012-11-16 09:06:31 UTC (rev 134914)
@@ -99,7 +99,7 @@
}
/**
- * @param {RuntimeAgent.RemoteObject} payload
+ * @param {RuntimeAgent.RemoteObject=} payload
* @return {WebInspector.RemoteObject}
*/
WebInspector.RemoteObject.fromPayload = function(payload)
@@ -163,7 +163,7 @@
},
/**
- * @param {function(Array.<WebInspector.RemoteObjectProperty>)} callback
+ * @param {function(Array.<WebInspector.RemoteObjectProperty>, Array.<WebInspector.RemoteObjectProperty>=)} callback
*/
getOwnProperties: function(callback)
{
@@ -171,7 +171,7 @@
},
/**
- * @param {function(Array.<WebInspector.RemoteObjectProperty>)} callback
+ * @param {function(Array.<WebInspector.RemoteObjectProperty>, Array.<WebInspector.RemoteObjectProperty>=)} callback
*/
getAllProperties: function(callback)
{
@@ -180,7 +180,7 @@
/**
* @param {boolean} ownProperties
- * @param {function(Array.<RuntimeAgent.RemoteObject>)} callback
+ * @param {function(Array.<WebInspector.RemoteObjectProperty>, Array.<WebInspector.RemoteObjectProperty>=)} callback
*/
_getProperties: function(ownProperties, callback)
{
@@ -191,9 +191,10 @@
/**
* @param {?Protocol.Error} error
- * @param {Array.<WebInspector.RemoteObjectProperty>} properties
+ * @param {Array.<RuntimeAgent.PropertyDescriptor>} properties
+ * @param {Array.<RuntimeAgent.InternalPropertyDescriptor>=} internalProperties
*/
- function remoteObjectBinder(error, properties)
+ function remoteObjectBinder(error, properties, internalProperties)
{
if (error) {
callback(null);
@@ -210,7 +211,15 @@
} else
result.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value), property));
}
- callback(result);
+ var internalPropertiesResult;
+ if (internalProperties) {
+ internalPropertiesResult = [];
+ for (var i = 0; i < internalProperties.length; i++) {
+ var property = internalProperties[i];
+ internalPropertiesResult.push(new WebInspector.RemoteObjectProperty(property.name, WebInspector.RemoteObject.fromPayload(property.value)));
+ }
+ }
+ callback(result, internalPropertiesResult);
}
RuntimeAgent.getProperties(this._objectId, ownProperties, remoteObjectBinder);
},