Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/function-details.html

Issue 2122423002: [DevTools] Remove functionDetails from protocol.json (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-generator-details-from-protocol
Patch Set: a Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script> 4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 5
6 <script> function firstLineFunction() 6 <script> function firstLineFunction()
7 7
8 { 8 {
9 } 9 }
10 10
(...skipping 27 matching lines...) Expand all
38 } catch (ex) { 38 } catch (ex) {
39 return function() { 39 return function() {
40 return String(p) + String(ex) + u + e; 40 return String(p) + String(ex) + u + e;
41 }; 41 };
42 } 42 }
43 } 43 }
44 })({}); 44 })({});
45 45
46 function test() 46 function test()
47 { 47 {
48 function dumpFunctionDetails(details) 48 function dumpFunctionDetails(properties)
49 { 49 {
50 var location = properties.get("[[FunctionLocation]]").value.value;
50 InspectorTest.addResult("Function details: "); 51 InspectorTest.addResult("Function details: ");
51 InspectorTest.addResult("lineNumber: " + details.location.lineNumber); 52 InspectorTest.addResult("lineNumber: " + location.lineNumber);
52 InspectorTest.addResult("columnNumber: " + details.location.columnNumber ); 53 InspectorTest.addResult("columnNumber: " + location.columnNumber);
53 InspectorTest.addResult("scriptId is valid: " + !!details.location.scrip tId); 54 InspectorTest.addResult("scriptId is valid: " + !!location.scriptId);
54 InspectorTest.addResult("functionName: " + details.functionName); 55 InspectorTest.addResult("functionName: " + properties.get("[[FunctionNam e]]").value.value);
55 InspectorTest.addResult("isGenerator: " + details.isGenerator); 56 InspectorTest.addResult("isGenerator: " + properties.get("[[IsGenerator] ]").value.value);
56 } 57 }
57 58
58 function dumpFunctionNoScopes() 59 function dumpFunctionNoScopes()
59 { 60 {
60 InspectorTest.addResult("scopeChain: n/a"); 61 InspectorTest.addResult("scopeChain: n/a");
61 } 62 }
62 63
63 function dumpFunctionScope(pos, type, propertyDescriptors) 64 function dumpFunctionScope(pos, type, propertyDescriptors)
64 { 65 {
65 var variables; 66 var variables;
66 if (type == "global") { 67 if (type == "Global") {
67 variables = "<global object properties omitted>"; 68 variables = "<global object properties omitted>";
68 } else { 69 } else {
69 var varArray = []; 70 var varArray = [];
70 for (var i = 0; i < propertyDescriptors.length; i++) { 71 for (var i = 0; i < propertyDescriptors.length; i++) {
71 var d = propertyDescriptors[i]; 72 var d = propertyDescriptors[i];
72 var valueStr; 73 var valueStr;
73 if (d.value) { 74 if (d.value) {
74 if (d.value.value) 75 if (d.value.value)
75 valueStr = JSON.stringify(d.value.value); 76 valueStr = JSON.stringify(d.value.value);
76 else 77 else
77 valueStr = "<no string representation>"; 78 valueStr = "<no string representation>";
78 } else { 79 } else {
79 valueStr = "<no value>"; 80 valueStr = "<no value>";
80 } 81 }
81 varArray.push(d.name + ": " + valueStr); 82 varArray.push(d.name + ": " + valueStr);
82 } 83 }
83 varArray.sort(); 84 varArray.sort();
84 variables = varArray.join(); 85 variables = varArray.join();
85 } 86 }
86 InspectorTest.addResult("scopeChain #" + pos + ": " + type + "; " + vari ables); 87 InspectorTest.addResult("scopeChain #" + pos + ": " + type + "; " + vari ables);
87 } 88 }
88 89
89 function loadAndDumpScopeObjects(scopeChain, end) 90 function loadAndDumpScopeObjects(scopeChain, end)
90 { 91 {
92 var scopes = [];
91 function loadScopeObject(pos, next) 93 function loadScopeObject(pos, next)
92 { 94 {
93 if (pos >= scopeChain.length) { 95 if (pos >= scopes.length) {
94 next(); 96 next();
95 return; 97 return;
96 } 98 }
97 var scopeJson = scopeChain[pos]; 99 InspectorTest.RuntimeAgent.getProperties(scopes[pos].objectId, true, didGetProperties);
98 InspectorTest.RuntimeAgent.getProperties(scopeJson.object.objectId, true, didGetProperties);
99 100
100 function didGetProperties(error, propertyDescriptors) 101 function didGetProperties(error, propertyDescriptors)
101 { 102 {
102 dumpFunctionScope(pos, scopeJson.type, propertyDescriptors); 103 dumpFunctionScope(pos, scopes[pos].description, propertyDescript ors);
103 loadScopeObject(pos + 1, next); 104 loadScopeObject(pos + 1, next);
104 } 105 }
105 } 106 }
106 107
107 if (scopeChain) { 108 if (scopeChain) {
108 loadScopeObject(0, end); 109 InspectorTest.RuntimeAgent.getProperties(scopeChain.value.objectId, true, didGetScopes);
109 } else { 110 } else {
110 dumpFunctionNoScopes(); 111 dumpFunctionNoScopes();
111 end(); 112 end();
112 } 113 }
114
115 function didGetScopes(error, properties)
116 {
117 for (var prop of properties) {
118 if (String(prop.name >>> 0) === prop.name)
119 scopes.push(prop.value);
120 }
121 loadScopeObject(0, end);
122 }
113 } 123 }
114 124
115 function performStandardTestCase(pageExpression, next) 125 function performStandardTestCase(pageExpression, next)
116 { 126 {
117 InspectorTest.evaluateInPage(pageExpression, didEvaluate); 127 InspectorTest.evaluateInPage(pageExpression, didEvaluate);
118 128
119 function didEvaluate(remote) 129 function didEvaluate(remote)
120 { 130 {
121 InspectorTest.addResult(pageExpression + " type = " + remote.type); 131 InspectorTest.addResult(pageExpression + " type = " + remote.type);
122 InspectorTest.DebuggerAgent.getFunctionDetails(remote.objectId, didG etDetails); 132 InspectorTest.RuntimeAgent.getProperties(remote.objectId, /* isOwnPr operty */ false, didGetDetails);
123 } 133 }
124 function didGetDetails(error, response) 134 function didGetDetails(error, properties, internalProperties)
125 { 135 {
126 dumpFunctionDetails(response); 136 var properties = internalProperties.reduce((map, object) => map.set( object.name, object), new Map());
dgozman 2016/07/07 19:59:23 For-loop.
kozy 2016/07/07 22:59:07 Done.
127 loadAndDumpScopeObjects(response.scopeChain, next); 137 // InspectorTest.addResult(properties);
dgozman 2016/07/07 19:59:23 Commented code.
kozy 2016/07/07 22:59:07 Done.
138 // InspectorTest.completeTest();
139 dumpFunctionDetails(properties);
140 loadAndDumpScopeObjects(properties.get("[[Scopes]]"), next);
128 } 141 }
129 } 142 }
130 143
131 InspectorTest.runDebuggerTestSuite([ 144 InspectorTest.runDebuggerTestSuite([
132 function testGetFirstLineFunctionDetails(next) 145 function testGetFirstLineFunctionDetails(next)
133 { 146 {
134 performStandardTestCase("firstLineFunction", next); 147 performStandardTestCase("firstLineFunction", next);
135 }, 148 },
136 function testGetNonFirstLineFunctionDetails(next) 149 function testGetNonFirstLineFunctionDetails(next)
137 { 150 {
(...skipping 24 matching lines...) Expand all
162 175
163 </script> 176 </script>
164 </head> 177 </head>
165 178
166 <body onload="runTest()"> 179 <body onload="runTest()">
167 <p>Tests that Debugger.getFunctionDetails command returns correct location. 180 <p>Tests that Debugger.getFunctionDetails command returns correct location.
168 <a href="https://bugs.webkit.org/show_bug.cgi?id=71808">Bug 71808</a> 181 <a href="https://bugs.webkit.org/show_bug.cgi?id=71808">Bug 71808</a>
169 </p> 182 </p>
170 </body> 183 </body>
171 </html> 184 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698