| Index: third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/function-details.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/function-details.html b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/function-details.html
|
| index 10d9760378fbf64ee81b8d7d271c05d8c08de3fc..0e7aa5239fa1fbd62f3f114694a2242c4a2b15ee 100644
|
| --- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/function-details.html
|
| +++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/function-details.html
|
| @@ -43,16 +43,20 @@ var bigClosure = (function(p) {
|
| }
|
| })({});
|
|
|
| +function* gen() { yield [1,2,3] }
|
| +
|
| function test()
|
| {
|
| - function dumpFunctionDetails(details)
|
| + function dumpFunctionDetails(properties)
|
| {
|
| + var location = properties.get("[[FunctionLocation]]").value.value;
|
| InspectorTest.addResult("Function details: ");
|
| - InspectorTest.addResult("lineNumber: " + details.location.lineNumber);
|
| - InspectorTest.addResult("columnNumber: " + details.location.columnNumber);
|
| - InspectorTest.addResult("scriptId is valid: " + !!details.location.scriptId);
|
| - InspectorTest.addResult("functionName: " + details.functionName);
|
| - InspectorTest.addResult("isGenerator: " + details.isGenerator);
|
| + InspectorTest.addResult("lineNumber: " + location.lineNumber);
|
| + InspectorTest.addResult("columnNumber: " + location.columnNumber);
|
| + InspectorTest.addResult("scriptId is valid: " + !!location.scriptId);
|
| + InspectorTest.addResult("functionName: " + properties.get("name").value.value);
|
| + if (properties.has("[[IsGenerator]]"))
|
| + InspectorTest.addResult("isGenerator: " + properties.get("[[IsGenerator]]").value.value);
|
| }
|
|
|
| function dumpFunctionNoScopes()
|
| @@ -63,7 +67,7 @@ function test()
|
| function dumpFunctionScope(pos, type, propertyDescriptors)
|
| {
|
| var variables;
|
| - if (type == "global") {
|
| + if (type == "Global") {
|
| variables = "<global object properties omitted>";
|
| } else {
|
| var varArray = [];
|
| @@ -88,28 +92,37 @@ function test()
|
|
|
| function loadAndDumpScopeObjects(scopeChain, end)
|
| {
|
| + var scopes = [];
|
| function loadScopeObject(pos, next)
|
| {
|
| - if (pos >= scopeChain.length) {
|
| + if (pos >= scopes.length) {
|
| next();
|
| return;
|
| }
|
| - var scopeJson = scopeChain[pos];
|
| - InspectorTest.RuntimeAgent.getProperties(scopeJson.object.objectId, true, didGetProperties);
|
| + InspectorTest.RuntimeAgent.getProperties(scopes[pos].objectId, true, didGetProperties);
|
|
|
| function didGetProperties(error, propertyDescriptors)
|
| {
|
| - dumpFunctionScope(pos, scopeJson.type, propertyDescriptors);
|
| + dumpFunctionScope(pos, scopes[pos].description, propertyDescriptors);
|
| loadScopeObject(pos + 1, next);
|
| }
|
| }
|
|
|
| if (scopeChain) {
|
| - loadScopeObject(0, end);
|
| + InspectorTest.RuntimeAgent.getProperties(scopeChain.value.objectId, true, didGetScopes);
|
| } else {
|
| dumpFunctionNoScopes();
|
| end();
|
| }
|
| +
|
| + function didGetScopes(error, properties)
|
| + {
|
| + for (var prop of properties) {
|
| + if (String(prop.name >>> 0) === prop.name)
|
| + scopes.push(prop.value);
|
| + }
|
| + loadScopeObject(0, end);
|
| + }
|
| }
|
|
|
| function performStandardTestCase(pageExpression, next)
|
| @@ -119,12 +132,23 @@ function test()
|
| function didEvaluate(remote)
|
| {
|
| InspectorTest.addResult(pageExpression + " type = " + remote.type);
|
| - InspectorTest.DebuggerAgent.getFunctionDetails(remote.objectId, didGetDetails);
|
| + InspectorTest.RuntimeAgent.getProperties(remote.objectId, /* isOwnProperty */ false, didGetDetails);
|
| }
|
| - function didGetDetails(error, response)
|
| + function didGetDetails(error, properties, internalProperties)
|
| {
|
| - dumpFunctionDetails(response);
|
| - loadAndDumpScopeObjects(response.scopeChain, next);
|
| + var propertiesMap = new Map();
|
| + for (var prop of internalProperties)
|
| + propertiesMap.set(prop.name, prop);
|
| + for (var prop of properties) {
|
| + if (prop.name === "name" && prop.value && prop.value.type === "string")
|
| + propertiesMap.set("name", prop);
|
| + if (prop.name === "displayName" && prop.value && prop.value.type === "string") {
|
| + propertiesMap.set("name", prop);
|
| + break;
|
| + }
|
| + }
|
| + dumpFunctionDetails(propertiesMap);
|
| + loadAndDumpScopeObjects(propertiesMap.get("[[Scopes]]"), next);
|
| }
|
| }
|
|
|
| @@ -156,6 +180,10 @@ function test()
|
| function testBigClosure(next)
|
| {
|
| performStandardTestCase("bigClosure", next);
|
| + },
|
| + function testGenFunction(next)
|
| + {
|
| + performStandardTestCase("gen", next);
|
| }
|
| ]);
|
| };
|
|
|