Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1141 * @this {SDK.DebuggerModel.CallFrame} | 1141 * @this {SDK.DebuggerModel.CallFrame} |
| 1142 */ | 1142 */ |
| 1143 function protocolCallback(error, callFrames, asyncStackTrace) { | 1143 function protocolCallback(error, callFrames, asyncStackTrace) { |
| 1144 if (!error) | 1144 if (!error) |
| 1145 this.debuggerModel.stepInto(); | 1145 this.debuggerModel.stepInto(); |
| 1146 if (callback) | 1146 if (callback) |
| 1147 callback(error); | 1147 callback(error); |
| 1148 } | 1148 } |
| 1149 this._debuggerAgent.restartFrame(this._payload.callFrameId, protocolCallback .bind(this)); | 1149 this._debuggerAgent.restartFrame(this._payload.callFrameId, protocolCallback .bind(this)); |
| 1150 } | 1150 } |
| 1151 | |
| 1152 /** | |
| 1153 * @param {function(!Object)} callback | |
| 1154 */ | |
| 1155 variableNames(callback) { | |
| 1156 var result = {this: true}; | |
| 1157 | |
| 1158 function propertiesCollected(properties) { | |
| 1159 for (var i = 0; properties && i < properties.length; ++i) | |
| 1160 result[properties[i].name] = true; | |
| 1161 if (--pendingRequests === 0) | |
| 1162 callback(result); | |
| 1163 } | |
| 1164 | |
| 1165 var scopeChain = this.scopeChain(); | |
| 1166 var pendingRequests = scopeChain.length; | |
| 1167 for (var i = 0; i < scopeChain.length; ++i) { | |
| 1168 var scope = scopeChain[i]; | |
| 1169 var object = scope.object(); | |
| 1170 object.getAllProperties(false, propertiesCollected); | |
| 1171 } | |
| 1172 } | |
| 1173 }; | 1151 }; |
| 1174 | 1152 |
| 1175 | 1153 |
| 1176 /** | 1154 /** |
| 1177 * @unrestricted | 1155 * @unrestricted |
| 1178 */ | 1156 */ |
| 1179 SDK.DebuggerModel.Scope = class { | 1157 SDK.DebuggerModel.Scope = class { |
| 1180 /** | 1158 /** |
| 1181 * @param {!SDK.DebuggerModel.CallFrame} callFrame | 1159 * @param {!SDK.DebuggerModel.CallFrame} callFrame |
| 1182 * @param {number} ordinal | 1160 * @param {number} ordinal |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 1203 } | 1181 } |
| 1204 | 1182 |
| 1205 /** | 1183 /** |
| 1206 * @return {string} | 1184 * @return {string} |
| 1207 */ | 1185 */ |
| 1208 type() { | 1186 type() { |
| 1209 return this._type; | 1187 return this._type; |
| 1210 } | 1188 } |
| 1211 | 1189 |
| 1212 /** | 1190 /** |
| 1191 * @return {string} | |
| 1192 */ | |
| 1193 typeName() { | |
| 1194 switch (this._type) { | |
| 1195 case Protocol.Debugger.ScopeType.Local: | |
| 1196 return Common.UIString('Local'); | |
| 1197 case Protocol.Debugger.ScopeType.Closure: | |
| 1198 return Common.UIString('Closure'); | |
| 1199 case Protocol.Debugger.ScopeType.Catch: | |
| 1200 return Common.UIString('Catch'); | |
| 1201 case Protocol.Debugger.ScopeType.Block: | |
| 1202 return Common.UIString('Block'); | |
| 1203 case Protocol.Debugger.ScopeType.Script: | |
| 1204 return Common.UIString('Script'); | |
| 1205 case Protocol.Debugger.ScopeType.With: | |
| 1206 return Common.UIString('With Block'); | |
| 1207 case Protocol.Debugger.ScopeType.Global: | |
| 1208 return Common.UIString('Global'); | |
| 1209 } | |
| 1210 return ''; | |
|
einbinder
2016/12/07 20:10:51
Fails silently. Maybe a warning?
pfeldman
2016/12/08 00:29:06
We don't really do asserts for code correctness in
| |
| 1211 } | |
| 1212 | |
| 1213 | |
| 1214 /** | |
| 1213 * @return {string|undefined} | 1215 * @return {string|undefined} |
| 1214 */ | 1216 */ |
| 1215 name() { | 1217 name() { |
| 1216 return this._name; | 1218 return this._name; |
| 1217 } | 1219 } |
| 1218 | 1220 |
| 1219 /** | 1221 /** |
| 1220 * @return {?SDK.DebuggerModel.Location} | 1222 * @return {?SDK.DebuggerModel.Location} |
| 1221 */ | 1223 */ |
| 1222 startLocation() { | 1224 startLocation() { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1305 stack.callFrames.shift(); | 1307 stack.callFrames.shift(); |
| 1306 if (previous && !stack.callFrames.length) | 1308 if (previous && !stack.callFrames.length) |
| 1307 previous.parent = stack.parent; | 1309 previous.parent = stack.parent; |
| 1308 else | 1310 else |
| 1309 previous = stack; | 1311 previous = stack; |
| 1310 stack = stack.parent; | 1312 stack = stack.parent; |
| 1311 } | 1313 } |
| 1312 return asyncStackTrace; | 1314 return asyncStackTrace; |
| 1313 } | 1315 } |
| 1314 }; | 1316 }; |
| OLD | NEW |