diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-19 16:18:09 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-19 16:18:09 +0000 |
commit | 7d489139cb1039373a51b20ca6637132043ded72 (patch) | |
tree | a4e9c8280f563367b5d6fd339697a023349dce6b /webkit | |
parent | 08b4daee6f44fca6eb71c82e2d6f68a195cbcad0 (diff) | |
download | chromium_src-7d489139cb1039373a51b20ca6637132043ded72.zip chromium_src-7d489139cb1039373a51b20ca6637132043ded72.tar.gz chromium_src-7d489139cb1039373a51b20ca6637132043ded72.tar.bz2 |
DevTools: allow expanding constructor property
BUG=24895
TEST=DevToolsSanityTest.TestDebugIntrinsicProperties
Review URL: http://codereview.chromium.org/292014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29404 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 3 | ||||
-rw-r--r-- | webkit/glue/devtools/js/tests.js | 148 |
2 files changed, 83 insertions, 68 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index 366f452..4d89176 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -1166,10 +1166,9 @@ devtools.DebuggerAgent.formatObjectProperties_ = function(object, result, result.push(new WebInspector.ObjectPropertyProxy('__proto__', devtools.DebuggerAgent.formatObjectProxy_(object.protoObject))); - result.push(new WebInspector.ObjectPropertyProxy('prototype', - devtools.DebuggerAgent.formatObjectProxy_(object.prototypeObject))); result.push(new WebInspector.ObjectPropertyProxy('constructor', devtools.DebuggerAgent.formatObjectProxy_(object.constructorFunction))); + // Don't add 'prototype' property since it is one of the regualar properties. }; diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js index 8056842..4253078 100644 --- a/webkit/glue/devtools/js/tests.js +++ b/webkit/glue/devtools/js/tests.js @@ -1290,9 +1290,12 @@ TestSuite.prototype.testExpandScope = function() { * Returns child tree element for a property with given name. * @param {TreeElement} parent Parent tree element. * @param {string} childName + * @param {string} objectPath Path to the object. Will be printed in the case + * of failure. * @return {TreeElement} */ -TestSuite.prototype._findChildProperty = function(parent, childName) { +TestSuite.prototype._findChildProperty = function( + parent, childName, objectPath) { var children = parent.children; for (var i = 0; i < children.length; i++) { var treeElement = children[i]; @@ -1301,7 +1304,7 @@ TestSuite.prototype._findChildProperty = function(parent, childName) { return treeElement; } } - this.fail('Cannot find ' + childName); + this.fail('Cannot find property "' + childName + '" in ' + objectPath); }; @@ -1365,84 +1368,97 @@ TestSuite.prototype.testDebugIntrinsicProperties = function() { } function examineLocalScope() { - var aTreeElement = test._findChildProperty( - localScopeSection.propertiesTreeOutline, 'a'); - test.assertTrue(!!aTreeElement, 'Not found'); - - test._hookGetPropertiesCallback( - checkA.bind(null, aTreeElement), - function () { - aTreeElement.expand(); - }); - - } - - function checkA(aTreeElement) { - checkIntrinsicProperties(aTreeElement, - [ - 'constructor', 'function Child()', - '__proto__', 'Object', - 'prototype', 'undefined', - 'parentField', '10', - 'childField', '20', - ]); - expandProto(aTreeElement, checkAProto); - } - - function checkAProto(treeElement) { - checkIntrinsicProperties(treeElement, - [ - 'constructor', 'function Child()', - '__proto__', 'Object', - 'prototype', 'undefined', - 'childProtoField', '21', - ]); - expandProto(treeElement, checkAProtoProto); - } + var scopeExpectations = [ + 'a', 'Object', [ + 'constructor', 'function Child()', [ + 'constructor', 'function Function()', null, + 'name', 'Child', null, + 'prototype', 'Object', [ + 'childProtoField', '21', null + ] + ], + + '__proto__', 'Object', [ + '__proto__', 'Object', [ + '__proto__', 'Object', [ + '__proto__', 'null', null, + 'constructor', 'function Object()', null, + ], + 'constructor', 'function Parent()', [ + 'name', 'Parent', null, + 'prototype', 'Object', [ + 'parentProtoField', '11', null, + ] + ], + 'parentProtoField', '11', null, + ], + 'constructor', 'function Child()', null, + 'childProtoField', '21', null, + ], + + 'parentField', '10', null, + 'childField', '20', null, + ] + ]; - function checkAProtoProto(treeElement) { - checkIntrinsicProperties(treeElement, - [ - 'constructor', 'function Parent()', - '__proto__', 'Object', - 'prototype', 'undefined', - 'parentProtoField', '11', - ]); - expandProto(treeElement, checkAProtoProtoProto); + checkProperty( + localScopeSection.propertiesTreeOutline, + '<Local Scope>', + scopeExpectations); } - function checkAProtoProtoProto(treeElement) { - checkIntrinsicProperties(treeElement, - [ - 'constructor', 'function Object()', - '__proto__', 'null', - 'prototype', 'undefined', - ]); - test.releaseControl(); - } + var propQueue = []; + var index = 0; + var expectedFinalIndex = 8; + + function expandAndCheckNextProperty() { + if (index == propQueue.length) { + test.assertEquals(expectedFinalIndex, index, + 'Unexpected number of expanded objects.'); + test.releaseControl(); + return; + } - function expandProto(treeElement, callback) { - var proto = test._findChildProperty(treeElement, '__proto__'); - test.assertTrue(proto, '__proro__ not found'); + // Read next property data from the queue. + var treeElement = propQueue[index].treeElement; + var path = propQueue[index].path; + var expectations = propQueue[index].expectations; + index++; - test._hookGetPropertiesCallback(callback.bind(null, proto), + // Expand the property. + test._hookGetPropertiesCallback(function() { + checkProperty(treeElement, path, expectations); + }, function() { - proto.expand(); + treeElement.expand(); }); } - function checkIntrinsicProperties(treeElement, expectations) { - for (var i = 0; i < expectations.length; i += 2) { + function checkProperty(treeElement, path, expectations) { + for (var i = 0; i < expectations.length; i += 3) { var name = expectations[i]; - var value = expectations[i+1]; + var description = expectations[i+1]; + var value = expectations[i+2]; - var propertyTreeElement = test._findChildProperty(treeElement, name); + var propertyPath = path + '.' + name; + var propertyTreeElement = test._findChildProperty( + treeElement, name, path); test.assertTrue(propertyTreeElement, - 'Property "' + name + '" not found.'); - test.assertEquals(value, + 'Property "' + propertyPath + '" not found.'); + test.assertEquals(description, propertyTreeElement.property.value.description, - 'Unexpected "' + name + '" value.'); + 'Unexpected "' + propertyPath + '" description.'); + if (value) { + // Schedule property content check. + propQueue.push({ + treeElement: propertyTreeElement, + path: propertyPath, + expectations: value, + }); + } } + // Check next property in the queue. + expandAndCheckNextProperty(); } test.takeControl(); |