OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Default number of frames to include in the response to backtrace request. | 5 // Default number of frames to include in the response to backtrace request. |
6 var kDefaultBacktraceLength = 10; | 6 var kDefaultBacktraceLength = 10; |
7 | 7 |
8 var Debug = {}; | 8 var Debug = {}; |
9 | 9 |
10 // Regular expression to skip "crud" at the beginning of a source line which is | 10 // Regular expression to skip "crud" at the beginning of a source line which is |
11 // not really code. Currently the regular expression matches whitespace and | 11 // not really code. Currently the regular expression matches whitespace and |
12 // comments. | 12 // comments. |
13 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; | 13 var sourceLineBeginningSkip = /^(?:\s*(?:\/\*.*?\*\/)*)*/; |
14 | 14 |
15 // Debug events which can occour in the V8 JavaScript engine. These originate | 15 // Debug events which can occour in the V8 JavaScript engine. These originate |
16 // from the API include file debug.h. | 16 // from the API include file debug.h. |
17 Debug.DebugEvent = { Break: 1, | 17 Debug.DebugEvent = { Break: 1, |
18 Exception: 2, | 18 Exception: 2, |
19 NewFunction: 3, | 19 NewFunction: 3, |
20 BeforeCompile: 4, | 20 BeforeCompile: 4, |
21 AfterCompile: 5, | 21 AfterCompile: 5, |
22 CompileError: 6 }; | 22 CompileError: 6, |
| 23 PromiseEvent: 7 }; |
23 | 24 |
24 // Types of exceptions that can be broken upon. | 25 // Types of exceptions that can be broken upon. |
25 Debug.ExceptionBreak = { Caught : 0, | 26 Debug.ExceptionBreak = { Caught : 0, |
26 Uncaught: 1 }; | 27 Uncaught: 1 }; |
27 | 28 |
28 // The different types of steps. | 29 // The different types of steps. |
29 Debug.StepAction = { StepOut: 0, | 30 Debug.StepAction = { StepOut: 0, |
30 StepNext: 1, | 31 StepNext: 1, |
31 StepIn: 2, | 32 StepIn: 2, |
32 StepMin: 3, | 33 StepMin: 3, |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 if (!IS_UNDEFINED(script.data())) { | 1193 if (!IS_UNDEFINED(script.data())) { |
1193 o.data = script.data(); | 1194 o.data = script.data(); |
1194 } | 1195 } |
1195 if (include_source) { | 1196 if (include_source) { |
1196 o.source = script.source(); | 1197 o.source = script.source(); |
1197 } | 1198 } |
1198 return o; | 1199 return o; |
1199 } | 1200 } |
1200 | 1201 |
1201 | 1202 |
| 1203 function MakePromiseEvent(event_data) { |
| 1204 if (event_data.type = "new Promise") { |
| 1205 return new NewPromiseEvent(event_data); |
| 1206 } |
| 1207 } |
| 1208 |
| 1209 |
| 1210 function PromiseGetter() { |
| 1211 return MakeMirror(this.promise_); |
| 1212 } |
| 1213 |
| 1214 |
| 1215 function NewPromiseEvent(event_data) { |
| 1216 this.resolver_ = event_data.resolver; |
| 1217 this.promise_ = event_data.promise; |
| 1218 } |
| 1219 |
| 1220 |
| 1221 NewPromiseEvent.prototype.promise = PromiseGetter; |
| 1222 |
| 1223 |
| 1224 NewPromiseEvent.prototype.resolver = function() { |
| 1225 return MakeMirror(this.resolver_); |
| 1226 } |
| 1227 |
| 1228 |
1202 function DebugCommandProcessor(exec_state, opt_is_running) { | 1229 function DebugCommandProcessor(exec_state, opt_is_running) { |
1203 this.exec_state_ = exec_state; | 1230 this.exec_state_ = exec_state; |
1204 this.running_ = opt_is_running || false; | 1231 this.running_ = opt_is_running || false; |
1205 } | 1232 } |
1206 | 1233 |
1207 | 1234 |
1208 DebugCommandProcessor.prototype.processDebugRequest = function (request) { | 1235 DebugCommandProcessor.prototype.processDebugRequest = function (request) { |
1209 return this.processDebugJSONRequest(request); | 1236 return this.processDebugJSONRequest(request); |
1210 }; | 1237 }; |
1211 | 1238 |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 | 2540 |
2514 default: | 2541 default: |
2515 json = null; | 2542 json = null; |
2516 } | 2543 } |
2517 return json; | 2544 return json; |
2518 } | 2545 } |
2519 | 2546 |
2520 Debug.TestApi = { | 2547 Debug.TestApi = { |
2521 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ | 2548 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ |
2522 }; | 2549 }; |
OLD | NEW |