| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 stepOver() { | 163 stepOver() { |
| 164 this._agent.stepOver(); | 164 this._agent.stepOver(); |
| 165 } | 165 } |
| 166 | 166 |
| 167 stepOut() { | 167 stepOut() { |
| 168 this._agent.stepOut(); | 168 this._agent.stepOut(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 scheduleStepIntoAsync() { |
| 172 this._agent.scheduleStepIntoAsync(); |
| 173 } |
| 174 |
| 171 resume() { | 175 resume() { |
| 172 this._agent.resume(); | 176 this._agent.resume(); |
| 173 this._isPausing = false; | 177 this._isPausing = false; |
| 174 } | 178 } |
| 175 | 179 |
| 176 pause() { | 180 pause() { |
| 177 this._isPausing = true; | 181 this._isPausing = true; |
| 178 this._skipAllPauses(false); | 182 this._skipAllPauses(false); |
| 179 this._agent.pause(); | 183 this._agent.pause(); |
| 180 } | 184 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 console.error('Failed to remove breakpoint: ' + error); | 267 console.error('Failed to remove breakpoint: ' + error); |
| 264 if (callback) | 268 if (callback) |
| 265 callback(); | 269 callback(); |
| 266 } | 270 } |
| 267 } | 271 } |
| 268 | 272 |
| 269 /** | 273 /** |
| 270 * @param {!SDK.DebuggerModel.Location} startLocation | 274 * @param {!SDK.DebuggerModel.Location} startLocation |
| 271 * @param {!SDK.DebuggerModel.Location} endLocation | 275 * @param {!SDK.DebuggerModel.Location} endLocation |
| 272 * @param {boolean} restrictToFunction | 276 * @param {boolean} restrictToFunction |
| 273 * @return {!Promise<!Array<!SDK.DebuggerModel.Location>>} | 277 * @return {!Promise<!Array<!SDK.DebuggerModel.BreakLocation>>} |
| 274 */ | 278 */ |
| 275 getPossibleBreakpoints(startLocation, endLocation, restrictToFunction) { | 279 getPossibleBreakpoints(startLocation, endLocation, restrictToFunction) { |
| 276 var fulfill; | 280 var fulfill; |
| 277 var promise = new Promise(resolve => fulfill = resolve); | 281 var promise = new Promise(resolve => fulfill = resolve); |
| 278 this._agent.invoke_getPossibleBreakpoints( | 282 this._agent.invoke_getPossibleBreakpoints( |
| 279 {start: startLocation.payload(), end: endLocation.payload(), restrictToF
unction: restrictToFunction}, | 283 {start: startLocation.payload(), end: endLocation.payload(), restrictToF
unction: restrictToFunction}, |
| 280 checkErrorAndReturn.bind(this)); | 284 checkErrorAndReturn.bind(this)); |
| 281 return promise; | 285 return promise; |
| 282 | 286 |
| 283 /** | 287 /** |
| 284 * @this {!SDK.DebuggerModel} | 288 * @this {!SDK.DebuggerModel} |
| 285 * @param {?Protocol.Error} error | 289 * @param {?Protocol.Error} error |
| 286 * @param {?Array<!Protocol.Debugger.Location>} locations | 290 * @param {?Array<!Protocol.Debugger.BreakLocation>} locations |
| 287 */ | 291 */ |
| 288 function checkErrorAndReturn(error, locations) { | 292 function checkErrorAndReturn(error, locations) { |
| 289 if (error || !locations) { | 293 if (error || !locations) { |
| 290 fulfill([]); | 294 fulfill([]); |
| 291 return; | 295 return; |
| 292 } | 296 } |
| 293 fulfill(locations.map(location => SDK.DebuggerModel.Location.fromPayload(t
his, location))); | 297 fulfill(locations.map(location => SDK.DebuggerModel.BreakLocation.fromPayl
oad(this, location))); |
| 294 } | 298 } |
| 295 } | 299 } |
| 296 | 300 |
| 297 /** | 301 /** |
| 298 * @param {!Protocol.Debugger.BreakpointId} breakpointId | 302 * @param {!Protocol.Debugger.BreakpointId} breakpointId |
| 299 * @param {!Protocol.Debugger.Location} location | 303 * @param {!Protocol.Debugger.Location} location |
| 300 */ | 304 */ |
| 301 _breakpointResolved(breakpointId, location) { | 305 _breakpointResolved(breakpointId, location) { |
| 302 this._breakpointResolvedEventTarget.dispatchEventToListeners( | 306 this._breakpointResolvedEventTarget.dispatchEventToListeners( |
| 303 breakpointId, SDK.DebuggerModel.Location.fromPayload(this, location)); | 307 breakpointId, SDK.DebuggerModel.Location.fromPayload(this, location)); |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 EventListener: 'EventListener', | 867 EventListener: 'EventListener', |
| 864 XHR: 'XHR', | 868 XHR: 'XHR', |
| 865 Exception: 'exception', | 869 Exception: 'exception', |
| 866 PromiseRejection: 'promiseRejection', | 870 PromiseRejection: 'promiseRejection', |
| 867 Assert: 'assert', | 871 Assert: 'assert', |
| 868 DebugCommand: 'debugCommand', | 872 DebugCommand: 'debugCommand', |
| 869 OOM: 'OOM', | 873 OOM: 'OOM', |
| 870 Other: 'other' | 874 Other: 'other' |
| 871 }; | 875 }; |
| 872 | 876 |
| 877 /** @enum {string} */ |
| 878 SDK.DebuggerModel.BreakLocationType = { |
| 879 Return: 'return', |
| 880 Call: 'call', |
| 881 DebuggerStatement: 'debuggerStatement' |
| 882 }; |
| 883 |
| 873 SDK.DebuggerEventTypes = { | 884 SDK.DebuggerEventTypes = { |
| 874 JavaScriptPause: 0, | 885 JavaScriptPause: 0, |
| 875 JavaScriptBreakpoint: 1, | 886 JavaScriptBreakpoint: 1, |
| 876 NativeBreakpoint: 2 | 887 NativeBreakpoint: 2 |
| 877 }; | 888 }; |
| 878 | 889 |
| 879 /** | 890 /** |
| 880 * @implements {Protocol.DebuggerDispatcher} | 891 * @implements {Protocol.DebuggerDispatcher} |
| 881 * @unrestricted | 892 * @unrestricted |
| 882 */ | 893 */ |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1026 } | 1037 } |
| 1027 | 1038 |
| 1028 /** | 1039 /** |
| 1029 * @return {string} | 1040 * @return {string} |
| 1030 */ | 1041 */ |
| 1031 id() { | 1042 id() { |
| 1032 return this.debuggerModel.target().id() + ':' + this.scriptId + ':' + this.l
ineNumber + ':' + this.columnNumber; | 1043 return this.debuggerModel.target().id() + ':' + this.scriptId + ':' + this.l
ineNumber + ':' + this.columnNumber; |
| 1033 } | 1044 } |
| 1034 }; | 1045 }; |
| 1035 | 1046 |
| 1047 /** |
| 1048 * @unrestricted |
| 1049 */ |
| 1050 SDK.DebuggerModel.BreakLocation = class extends SDK.DebuggerModel.Location { |
| 1051 /** |
| 1052 * @param {!SDK.DebuggerModel} debuggerModel |
| 1053 * @param {string} scriptId |
| 1054 * @param {number} lineNumber |
| 1055 * @param {number=} columnNumber |
| 1056 * @param {!Protocol.Debugger.BreakLocationType=} type |
| 1057 */ |
| 1058 constructor(debuggerModel, scriptId, lineNumber, columnNumber, type) { |
| 1059 super(debuggerModel, scriptId, lineNumber, columnNumber); |
| 1060 if (type) |
| 1061 this.type = type; |
| 1062 } |
| 1063 |
| 1064 /** |
| 1065 * @param {!SDK.DebuggerModel} debuggerModel |
| 1066 * @param {!Protocol.Debugger.BreakLocation} payload |
| 1067 * @return {!SDK.DebuggerModel.BreakLocation} |
| 1068 */ |
| 1069 static fromPayload(debuggerModel, payload) { |
| 1070 return new SDK.DebuggerModel.BreakLocation( |
| 1071 debuggerModel, payload.scriptId, payload.lineNumber, payload.columnNumbe
r, payload.type); |
| 1072 } |
| 1073 }; |
| 1036 | 1074 |
| 1037 /** | 1075 /** |
| 1038 * @unrestricted | 1076 * @unrestricted |
| 1039 */ | 1077 */ |
| 1040 SDK.DebuggerModel.CallFrame = class { | 1078 SDK.DebuggerModel.CallFrame = class { |
| 1041 /** | 1079 /** |
| 1042 * @param {!SDK.DebuggerModel} debuggerModel | 1080 * @param {!SDK.DebuggerModel} debuggerModel |
| 1043 * @param {!SDK.Script} script | 1081 * @param {!SDK.Script} script |
| 1044 * @param {!Protocol.Debugger.CallFrame} payload | 1082 * @param {!Protocol.Debugger.CallFrame} payload |
| 1045 */ | 1083 */ |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 stack.callFrames.shift(); | 1386 stack.callFrames.shift(); |
| 1349 if (previous && (!stack.callFrames.length && !stack.promiseCreationFrame)) | 1387 if (previous && (!stack.callFrames.length && !stack.promiseCreationFrame)) |
| 1350 previous.parent = stack.parent; | 1388 previous.parent = stack.parent; |
| 1351 else | 1389 else |
| 1352 previous = stack; | 1390 previous = stack; |
| 1353 stack = stack.parent; | 1391 stack = stack.parent; |
| 1354 } | 1392 } |
| 1355 return asyncStackTrace; | 1393 return asyncStackTrace; |
| 1356 } | 1394 } |
| 1357 }; | 1395 }; |
| OLD | NEW |