js_protocol/debugger/mod.rs
1//! Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing
2//! breakpoints, stepping through execution, exploring stack traces, etc.
3
4use serde::{Serialize, Deserialize};
5
6/// Breakpoint identifier.
7
8pub type BreakpointId = String;
9
10/// Call frame identifier.
11
12pub type CallFrameId = String;
13
14/// Location in the source code.
15
16#[derive(Debug, Clone, Serialize, Deserialize, Default)]
17#[serde(rename_all = "camelCase")]
18pub struct Location {
19 /// Script identifier as reported in the 'Debugger.scriptParsed'.
20
21 pub scriptId: crate::runtime::ScriptId,
22 /// Line number in the script (0-based).
23
24 pub lineNumber: i64,
25 /// Column number in the script (0-based).
26
27 #[serde(skip_serializing_if = "Option::is_none")]
28 pub columnNumber: Option<i64>,
29}
30
31/// Location in the source code.
32
33#[derive(Debug, Clone, Serialize, Deserialize, Default)]
34#[serde(rename_all = "camelCase")]
35pub struct ScriptPosition {
36
37 pub lineNumber: i64,
38
39 pub columnNumber: i64,
40}
41
42/// Location range within one script.
43
44#[derive(Debug, Clone, Serialize, Deserialize, Default)]
45#[serde(rename_all = "camelCase")]
46pub struct LocationRange {
47
48 pub scriptId: crate::runtime::ScriptId,
49
50 pub start: ScriptPosition,
51
52 pub end: ScriptPosition,
53}
54
55/// JavaScript call frame. Array of call frames form the call stack.
56
57#[derive(Debug, Clone, Serialize, Deserialize, Default)]
58#[serde(rename_all = "camelCase")]
59pub struct CallFrame {
60 /// Call frame identifier. This identifier is only valid while the virtual machine is paused.
61
62 pub callFrameId: CallFrameId,
63 /// Name of the JavaScript function called on this call frame.
64
65 pub functionName: String,
66 /// Location in the source code.
67
68 #[serde(skip_serializing_if = "Option::is_none")]
69 pub functionLocation: Option<Location>,
70 /// Location in the source code.
71
72 pub location: Location,
73 /// JavaScript script name or url.
74 /// Deprecated in favor of using the 'location.scriptId' to resolve the URL via a previously
75 /// sent 'Debugger.scriptParsed' event.
76
77 pub url: String,
78 /// Scope chain for this call frame.
79
80 pub scopeChain: Vec<Scope>,
81 /// 'this' object for this call frame.
82
83 pub this: crate::runtime::RemoteObject,
84 /// The value being returned, if the function is at return point.
85
86 #[serde(skip_serializing_if = "Option::is_none")]
87 pub returnValue: Option<crate::runtime::RemoteObject>,
88 /// Valid only while the VM is paused and indicates whether this frame
89 /// can be restarted or not. Note that a 'true' value here does not
90 /// guarantee that Debugger#restartFrame with this CallFrameId will be
91 /// successful, but it is very likely.
92
93 #[serde(skip_serializing_if = "Option::is_none")]
94 pub canBeRestarted: Option<bool>,
95}
96
97/// Scope description.
98
99#[derive(Debug, Clone, Serialize, Deserialize, Default)]
100#[serde(rename_all = "camelCase")]
101pub struct Scope {
102 /// Scope type.
103
104 #[serde(rename = "type")]
105 pub type_: String,
106 /// Object representing the scope. For 'global' and 'with' scopes it represents the actual
107 /// object; for the rest of the scopes, it is artificial transient object enumerating scope
108 /// variables as its properties.
109
110 pub object: crate::runtime::RemoteObject,
111
112 #[serde(skip_serializing_if = "Option::is_none")]
113 pub name: Option<String>,
114 /// Location in the source code where scope starts
115
116 #[serde(skip_serializing_if = "Option::is_none")]
117 pub startLocation: Option<Location>,
118 /// Location in the source code where scope ends
119
120 #[serde(skip_serializing_if = "Option::is_none")]
121 pub endLocation: Option<Location>,
122}
123
124/// Search match for resource.
125
126#[derive(Debug, Clone, Serialize, Deserialize, Default)]
127#[serde(rename_all = "camelCase")]
128pub struct SearchMatch {
129 /// Line number in resource content.
130
131 pub lineNumber: f64,
132 /// Line with match content.
133
134 pub lineContent: String,
135}
136
137
138#[derive(Debug, Clone, Serialize, Deserialize, Default)]
139#[serde(rename_all = "camelCase")]
140pub struct BreakLocation {
141 /// Script identifier as reported in the 'Debugger.scriptParsed'.
142
143 pub scriptId: crate::runtime::ScriptId,
144 /// Line number in the script (0-based).
145
146 pub lineNumber: i64,
147 /// Column number in the script (0-based).
148
149 #[serde(skip_serializing_if = "Option::is_none")]
150 pub columnNumber: Option<i64>,
151
152 #[serde(skip_serializing_if = "Option::is_none")]
153 #[serde(rename = "type")]
154 pub type_: Option<String>,
155}
156
157
158#[derive(Debug, Clone, Serialize, Deserialize, Default)]
159#[serde(rename_all = "camelCase")]
160pub struct WasmDisassemblyChunk {
161 /// The next chunk of disassembled lines.
162
163 pub lines: Vec<String>,
164 /// The bytecode offsets describing the start of each line.
165
166 pub bytecodeOffsets: Vec<i64>,
167}
168
169/// Enum of possible script languages.
170
171#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
172pub enum ScriptLanguage {
173 #[default]
174 JavaScript,
175 WebAssembly,
176}
177
178/// Debug symbols available for a wasm script.
179
180#[derive(Debug, Clone, Serialize, Deserialize, Default)]
181#[serde(rename_all = "camelCase")]
182pub struct DebugSymbols {
183 /// Type of the debug symbols.
184
185 #[serde(rename = "type")]
186 pub type_: String,
187 /// URL of the external symbol source.
188
189 #[serde(skip_serializing_if = "Option::is_none")]
190 pub externalURL: Option<String>,
191}
192
193
194#[derive(Debug, Clone, Serialize, Deserialize, Default)]
195#[serde(rename_all = "camelCase")]
196pub struct ResolvedBreakpoint {
197 /// Breakpoint unique identifier.
198
199 pub breakpointId: BreakpointId,
200 /// Actual breakpoint location.
201
202 pub location: Location,
203}
204
205/// Continues execution until specific location is reached.
206
207#[derive(Debug, Clone, Serialize, Deserialize, Default)]
208#[serde(rename_all = "camelCase")]
209pub struct ContinueToLocationParams {
210 /// Location to continue to.
211
212 pub location: Location,
213
214 #[serde(skip_serializing_if = "Option::is_none")]
215 pub targetCallFrames: Option<String>,
216}
217
218/// Enables debugger for the given page. Clients should not assume that the debugging has been
219/// enabled until the result for this command is received.
220
221#[derive(Debug, Clone, Serialize, Deserialize, Default)]
222#[serde(rename_all = "camelCase")]
223pub struct EnableParams {
224 /// The maximum size in bytes of collected scripts (not referenced by other heap objects)
225 /// the debugger can hold. Puts no limit if parameter is omitted.
226
227 #[serde(skip_serializing_if = "Option::is_none")]
228 pub maxScriptsCacheSize: Option<f64>,
229}
230
231/// Enables debugger for the given page. Clients should not assume that the debugging has been
232/// enabled until the result for this command is received.
233
234#[derive(Debug, Clone, Serialize, Deserialize, Default)]
235#[serde(rename_all = "camelCase")]
236pub struct EnableReturns {
237 /// Unique identifier of the debugger.
238
239 pub debuggerId: crate::runtime::UniqueDebuggerId,
240}
241
242/// Evaluates expression on a given call frame.
243
244#[derive(Debug, Clone, Serialize, Deserialize, Default)]
245#[serde(rename_all = "camelCase")]
246pub struct EvaluateOnCallFrameParams {
247 /// Call frame identifier to evaluate on.
248
249 pub callFrameId: CallFrameId,
250 /// Expression to evaluate.
251
252 pub expression: String,
253 /// String object group name to put result into (allows rapid releasing resulting object handles
254 /// using 'releaseObjectGroup').
255
256 #[serde(skip_serializing_if = "Option::is_none")]
257 pub objectGroup: Option<String>,
258 /// Specifies whether command line API should be available to the evaluated expression, defaults
259 /// to false.
260
261 #[serde(skip_serializing_if = "Option::is_none")]
262 pub includeCommandLineAPI: Option<bool>,
263 /// In silent mode exceptions thrown during evaluation are not reported and do not pause
264 /// execution. Overrides 'setPauseOnException' state.
265
266 #[serde(skip_serializing_if = "Option::is_none")]
267 pub silent: Option<bool>,
268 /// Whether the result is expected to be a JSON object that should be sent by value.
269
270 #[serde(skip_serializing_if = "Option::is_none")]
271 pub returnByValue: Option<bool>,
272 /// Whether preview should be generated for the result.
273
274 #[serde(skip_serializing_if = "Option::is_none")]
275 pub generatePreview: Option<bool>,
276 /// Whether to throw an exception if side effect cannot be ruled out during evaluation.
277
278 #[serde(skip_serializing_if = "Option::is_none")]
279 pub throwOnSideEffect: Option<bool>,
280 /// Terminate execution after timing out (number of milliseconds).
281
282 #[serde(skip_serializing_if = "Option::is_none")]
283 pub timeout: Option<crate::runtime::TimeDelta>,
284}
285
286/// Evaluates expression on a given call frame.
287
288#[derive(Debug, Clone, Serialize, Deserialize, Default)]
289#[serde(rename_all = "camelCase")]
290pub struct EvaluateOnCallFrameReturns {
291 /// Object wrapper for the evaluation result.
292
293 pub result: crate::runtime::RemoteObject,
294 /// Exception details.
295
296 #[serde(skip_serializing_if = "Option::is_none")]
297 pub exceptionDetails: Option<crate::runtime::ExceptionDetails>,
298}
299
300/// Returns possible locations for breakpoint. scriptId in start and end range locations should be
301/// the same.
302
303#[derive(Debug, Clone, Serialize, Deserialize, Default)]
304#[serde(rename_all = "camelCase")]
305pub struct GetPossibleBreakpointsParams {
306 /// Start of range to search possible breakpoint locations in.
307
308 pub start: Location,
309 /// End of range to search possible breakpoint locations in (excluding). When not specified, end
310 /// of scripts is used as end of range.
311
312 #[serde(skip_serializing_if = "Option::is_none")]
313 pub end: Option<Location>,
314 /// Only consider locations which are in the same (non-nested) function as start.
315
316 #[serde(skip_serializing_if = "Option::is_none")]
317 pub restrictToFunction: Option<bool>,
318}
319
320/// Returns possible locations for breakpoint. scriptId in start and end range locations should be
321/// the same.
322
323#[derive(Debug, Clone, Serialize, Deserialize, Default)]
324#[serde(rename_all = "camelCase")]
325pub struct GetPossibleBreakpointsReturns {
326 /// List of the possible breakpoint locations.
327
328 pub locations: Vec<BreakLocation>,
329}
330
331/// Returns source for the script with given id.
332
333#[derive(Debug, Clone, Serialize, Deserialize, Default)]
334#[serde(rename_all = "camelCase")]
335pub struct GetScriptSourceParams {
336 /// Id of the script to get source for.
337
338 pub scriptId: crate::runtime::ScriptId,
339}
340
341/// Returns source for the script with given id.
342
343#[derive(Debug, Clone, Serialize, Deserialize, Default)]
344#[serde(rename_all = "camelCase")]
345pub struct GetScriptSourceReturns {
346 /// Script source (empty in case of Wasm bytecode).
347
348 pub scriptSource: String,
349 /// Wasm bytecode. (Encoded as a base64 string when passed over JSON)
350
351 #[serde(skip_serializing_if = "Option::is_none")]
352 pub bytecode: Option<String>,
353}
354
355
356#[derive(Debug, Clone, Serialize, Deserialize, Default)]
357#[serde(rename_all = "camelCase")]
358pub struct DisassembleWasmModuleParams {
359 /// Id of the script to disassemble
360
361 pub scriptId: crate::runtime::ScriptId,
362}
363
364
365#[derive(Debug, Clone, Serialize, Deserialize, Default)]
366#[serde(rename_all = "camelCase")]
367pub struct DisassembleWasmModuleReturns {
368 /// For large modules, return a stream from which additional chunks of
369 /// disassembly can be read successively.
370
371 #[serde(skip_serializing_if = "Option::is_none")]
372 pub streamId: Option<String>,
373 /// The total number of lines in the disassembly text.
374
375 pub totalNumberOfLines: i64,
376 /// The offsets of all function bodies, in the format \[start1, end1,
377 /// start2, end2, ...\] where all ends are exclusive.
378
379 pub functionBodyOffsets: Vec<i64>,
380 /// The first chunk of disassembly.
381
382 pub chunk: WasmDisassemblyChunk,
383}
384
385/// Disassemble the next chunk of lines for the module corresponding to the
386/// stream. If disassembly is complete, this API will invalidate the streamId
387/// and return an empty chunk. Any subsequent calls for the now invalid stream
388/// will return errors.
389
390#[derive(Debug, Clone, Serialize, Deserialize, Default)]
391#[serde(rename_all = "camelCase")]
392pub struct NextWasmDisassemblyChunkParams {
393
394 pub streamId: String,
395}
396
397/// Disassemble the next chunk of lines for the module corresponding to the
398/// stream. If disassembly is complete, this API will invalidate the streamId
399/// and return an empty chunk. Any subsequent calls for the now invalid stream
400/// will return errors.
401
402#[derive(Debug, Clone, Serialize, Deserialize, Default)]
403#[serde(rename_all = "camelCase")]
404pub struct NextWasmDisassemblyChunkReturns {
405 /// The next chunk of disassembly.
406
407 pub chunk: WasmDisassemblyChunk,
408}
409
410/// This command is deprecated. Use getScriptSource instead.
411
412#[derive(Debug, Clone, Serialize, Deserialize, Default)]
413#[serde(rename_all = "camelCase")]
414pub struct GetWasmBytecodeParams {
415 /// Id of the Wasm script to get source for.
416
417 pub scriptId: crate::runtime::ScriptId,
418}
419
420/// This command is deprecated. Use getScriptSource instead.
421
422#[derive(Debug, Clone, Serialize, Deserialize, Default)]
423#[serde(rename_all = "camelCase")]
424pub struct GetWasmBytecodeReturns {
425 /// Script source. (Encoded as a base64 string when passed over JSON)
426
427 pub bytecode: String,
428}
429
430/// Returns stack trace with given 'stackTraceId'.
431
432#[derive(Debug, Clone, Serialize, Deserialize, Default)]
433#[serde(rename_all = "camelCase")]
434pub struct GetStackTraceParams {
435
436 pub stackTraceId: crate::runtime::StackTraceId,
437}
438
439/// Returns stack trace with given 'stackTraceId'.
440
441#[derive(Debug, Clone, Serialize, Deserialize, Default)]
442#[serde(rename_all = "camelCase")]
443pub struct GetStackTraceReturns {
444
445 pub stackTrace: crate::runtime::StackTrace,
446}
447
448
449#[derive(Debug, Clone, Serialize, Deserialize, Default)]
450#[serde(rename_all = "camelCase")]
451pub struct PauseOnAsyncCallParams {
452 /// Debugger will pause when async call with given stack trace is started.
453
454 pub parentStackTraceId: crate::runtime::StackTraceId,
455}
456
457/// Removes JavaScript breakpoint.
458
459#[derive(Debug, Clone, Serialize, Deserialize, Default)]
460#[serde(rename_all = "camelCase")]
461pub struct RemoveBreakpointParams {
462
463 pub breakpointId: BreakpointId,
464}
465
466/// Restarts particular call frame from the beginning. The old, deprecated
467/// behavior of 'restartFrame' is to stay paused and allow further CDP commands
468/// after a restart was scheduled. This can cause problems with restarting, so
469/// we now continue execution immediatly after it has been scheduled until we
470/// reach the beginning of the restarted frame.
471///
472/// To stay back-wards compatible, 'restartFrame' now expects a 'mode'
473/// parameter to be present. If the 'mode' parameter is missing, 'restartFrame'
474/// errors out.
475///
476/// The various return values are deprecated and 'callFrames' is always empty.
477/// Use the call frames from the 'Debugger#paused' events instead, that fires
478/// once V8 pauses at the beginning of the restarted function.
479
480#[derive(Debug, Clone, Serialize, Deserialize, Default)]
481#[serde(rename_all = "camelCase")]
482pub struct RestartFrameParams {
483 /// Call frame identifier to evaluate on.
484
485 pub callFrameId: CallFrameId,
486 /// The 'mode' parameter must be present and set to 'StepInto', otherwise
487 /// 'restartFrame' will error out.
488
489 #[serde(skip_serializing_if = "Option::is_none")]
490 pub mode: Option<String>,
491}
492
493/// Restarts particular call frame from the beginning. The old, deprecated
494/// behavior of 'restartFrame' is to stay paused and allow further CDP commands
495/// after a restart was scheduled. This can cause problems with restarting, so
496/// we now continue execution immediatly after it has been scheduled until we
497/// reach the beginning of the restarted frame.
498///
499/// To stay back-wards compatible, 'restartFrame' now expects a 'mode'
500/// parameter to be present. If the 'mode' parameter is missing, 'restartFrame'
501/// errors out.
502///
503/// The various return values are deprecated and 'callFrames' is always empty.
504/// Use the call frames from the 'Debugger#paused' events instead, that fires
505/// once V8 pauses at the beginning of the restarted function.
506
507#[derive(Debug, Clone, Serialize, Deserialize, Default)]
508#[serde(rename_all = "camelCase")]
509pub struct RestartFrameReturns {
510 /// New stack trace.
511
512 pub callFrames: Vec<CallFrame>,
513 /// Async stack trace, if any.
514
515 #[serde(skip_serializing_if = "Option::is_none")]
516 pub asyncStackTrace: Option<crate::runtime::StackTrace>,
517 /// Async stack trace, if any.
518
519 #[serde(skip_serializing_if = "Option::is_none")]
520 pub asyncStackTraceId: Option<crate::runtime::StackTraceId>,
521}
522
523/// Resumes JavaScript execution.
524
525#[derive(Debug, Clone, Serialize, Deserialize, Default)]
526#[serde(rename_all = "camelCase")]
527pub struct ResumeParams {
528 /// Set to true to terminate execution upon resuming execution. In contrast
529 /// to Runtime.terminateExecution, this will allows to execute further
530 /// JavaScript (i.e. via evaluation) until execution of the paused code
531 /// is actually resumed, at which point termination is triggered.
532 /// If execution is currently not paused, this parameter has no effect.
533
534 #[serde(skip_serializing_if = "Option::is_none")]
535 pub terminateOnResume: Option<bool>,
536}
537
538/// Searches for given string in script content.
539
540#[derive(Debug, Clone, Serialize, Deserialize, Default)]
541#[serde(rename_all = "camelCase")]
542pub struct SearchInContentParams {
543 /// Id of the script to search in.
544
545 pub scriptId: crate::runtime::ScriptId,
546 /// String to search for.
547
548 pub query: String,
549 /// If true, search is case sensitive.
550
551 #[serde(skip_serializing_if = "Option::is_none")]
552 pub caseSensitive: Option<bool>,
553 /// If true, treats string parameter as regex.
554
555 #[serde(skip_serializing_if = "Option::is_none")]
556 pub isRegex: Option<bool>,
557}
558
559/// Searches for given string in script content.
560
561#[derive(Debug, Clone, Serialize, Deserialize, Default)]
562#[serde(rename_all = "camelCase")]
563pub struct SearchInContentReturns {
564 /// List of search matches.
565
566 pub result: Vec<SearchMatch>,
567}
568
569/// Enables or disables async call stacks tracking.
570
571#[derive(Debug, Clone, Serialize, Deserialize, Default)]
572#[serde(rename_all = "camelCase")]
573pub struct SetAsyncCallStackDepthParams {
574 /// Maximum depth of async call stacks. Setting to '0' will effectively disable collecting async
575 /// call stacks (default).
576
577 pub maxDepth: i64,
578}
579
580/// Replace previous blackbox execution contexts with passed ones. Forces backend to skip
581/// stepping/pausing in scripts in these execution contexts. VM will try to leave blackboxed script by
582/// performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
583
584#[derive(Debug, Clone, Serialize, Deserialize, Default)]
585#[serde(rename_all = "camelCase")]
586pub struct SetBlackboxExecutionContextsParams {
587 /// Array of execution context unique ids for the debugger to ignore.
588
589 pub uniqueIds: Vec<String>,
590}
591
592/// Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in
593/// scripts with url matching one of the patterns. VM will try to leave blackboxed script by
594/// performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
595
596#[derive(Debug, Clone, Serialize, Deserialize, Default)]
597#[serde(rename_all = "camelCase")]
598pub struct SetBlackboxPatternsParams {
599 /// Array of regexps that will be used to check script url for blackbox state.
600
601 pub patterns: Vec<String>,
602 /// If true, also ignore scripts with no source url.
603
604 #[serde(skip_serializing_if = "Option::is_none")]
605 pub skipAnonymous: Option<bool>,
606}
607
608/// Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted
609/// scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
610/// Positions array contains positions where blackbox state is changed. First interval isn't
611/// blackboxed. Array should be sorted.
612
613#[derive(Debug, Clone, Serialize, Deserialize, Default)]
614#[serde(rename_all = "camelCase")]
615pub struct SetBlackboxedRangesParams {
616 /// Id of the script.
617
618 pub scriptId: crate::runtime::ScriptId,
619
620 pub positions: Vec<ScriptPosition>,
621}
622
623/// Sets JavaScript breakpoint at a given location.
624
625#[derive(Debug, Clone, Serialize, Deserialize, Default)]
626#[serde(rename_all = "camelCase")]
627pub struct SetBreakpointParams {
628 /// Location to set breakpoint in.
629
630 pub location: Location,
631 /// Expression to use as a breakpoint condition. When specified, debugger will only stop on the
632 /// breakpoint if this expression evaluates to true.
633
634 #[serde(skip_serializing_if = "Option::is_none")]
635 pub condition: Option<String>,
636}
637
638/// Sets JavaScript breakpoint at a given location.
639
640#[derive(Debug, Clone, Serialize, Deserialize, Default)]
641#[serde(rename_all = "camelCase")]
642pub struct SetBreakpointReturns {
643 /// Id of the created breakpoint for further reference.
644
645 pub breakpointId: BreakpointId,
646 /// Location this breakpoint resolved into.
647
648 pub actualLocation: Location,
649}
650
651/// Sets instrumentation breakpoint.
652
653#[derive(Debug, Clone, Serialize, Deserialize, Default)]
654#[serde(rename_all = "camelCase")]
655pub struct SetInstrumentationBreakpointParams {
656 /// Instrumentation name.
657
658 pub instrumentation: String,
659}
660
661/// Sets instrumentation breakpoint.
662
663#[derive(Debug, Clone, Serialize, Deserialize, Default)]
664#[serde(rename_all = "camelCase")]
665pub struct SetInstrumentationBreakpointReturns {
666 /// Id of the created breakpoint for further reference.
667
668 pub breakpointId: BreakpointId,
669}
670
671/// Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this
672/// command is issued, all existing parsed scripts will have breakpoints resolved and returned in
673/// 'locations' property. Further matching script parsing will result in subsequent
674/// 'breakpointResolved' events issued. This logical breakpoint will survive page reloads.
675
676#[derive(Debug, Clone, Serialize, Deserialize, Default)]
677#[serde(rename_all = "camelCase")]
678pub struct SetBreakpointByUrlParams {
679 /// Line number to set breakpoint at.
680
681 pub lineNumber: i64,
682 /// URL of the resources to set breakpoint on.
683
684 #[serde(skip_serializing_if = "Option::is_none")]
685 pub url: Option<String>,
686 /// Regex pattern for the URLs of the resources to set breakpoints on. Either 'url' or
687 /// 'urlRegex' must be specified.
688
689 #[serde(skip_serializing_if = "Option::is_none")]
690 pub urlRegex: Option<String>,
691 /// Script hash of the resources to set breakpoint on.
692
693 #[serde(skip_serializing_if = "Option::is_none")]
694 pub scriptHash: Option<String>,
695 /// Offset in the line to set breakpoint at.
696
697 #[serde(skip_serializing_if = "Option::is_none")]
698 pub columnNumber: Option<i64>,
699 /// Expression to use as a breakpoint condition. When specified, debugger will only stop on the
700 /// breakpoint if this expression evaluates to true.
701
702 #[serde(skip_serializing_if = "Option::is_none")]
703 pub condition: Option<String>,
704}
705
706/// Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this
707/// command is issued, all existing parsed scripts will have breakpoints resolved and returned in
708/// 'locations' property. Further matching script parsing will result in subsequent
709/// 'breakpointResolved' events issued. This logical breakpoint will survive page reloads.
710
711#[derive(Debug, Clone, Serialize, Deserialize, Default)]
712#[serde(rename_all = "camelCase")]
713pub struct SetBreakpointByUrlReturns {
714 /// Id of the created breakpoint for further reference.
715
716 pub breakpointId: BreakpointId,
717 /// List of the locations this breakpoint resolved into upon addition.
718
719 pub locations: Vec<Location>,
720}
721
722/// Sets JavaScript breakpoint before each call to the given function.
723/// If another function was created from the same source as a given one,
724/// calling it will also trigger the breakpoint.
725
726#[derive(Debug, Clone, Serialize, Deserialize, Default)]
727#[serde(rename_all = "camelCase")]
728pub struct SetBreakpointOnFunctionCallParams {
729 /// Function object id.
730
731 pub objectId: crate::runtime::RemoteObjectId,
732 /// Expression to use as a breakpoint condition. When specified, debugger will
733 /// stop on the breakpoint if this expression evaluates to true.
734
735 #[serde(skip_serializing_if = "Option::is_none")]
736 pub condition: Option<String>,
737}
738
739/// Sets JavaScript breakpoint before each call to the given function.
740/// If another function was created from the same source as a given one,
741/// calling it will also trigger the breakpoint.
742
743#[derive(Debug, Clone, Serialize, Deserialize, Default)]
744#[serde(rename_all = "camelCase")]
745pub struct SetBreakpointOnFunctionCallReturns {
746 /// Id of the created breakpoint for further reference.
747
748 pub breakpointId: BreakpointId,
749}
750
751/// Activates / deactivates all breakpoints on the page.
752
753#[derive(Debug, Clone, Serialize, Deserialize, Default)]
754#[serde(rename_all = "camelCase")]
755pub struct SetBreakpointsActiveParams {
756 /// New value for breakpoints active state.
757
758 pub active: bool,
759}
760
761/// Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions,
762/// or caught exceptions, no exceptions. Initial pause on exceptions state is 'none'.
763
764#[derive(Debug, Clone, Serialize, Deserialize, Default)]
765#[serde(rename_all = "camelCase")]
766pub struct SetPauseOnExceptionsParams {
767 /// Pause on exceptions mode.
768
769 pub state: String,
770}
771
772/// Changes return value in top frame. Available only at return break position.
773
774#[derive(Debug, Clone, Serialize, Deserialize, Default)]
775#[serde(rename_all = "camelCase")]
776pub struct SetReturnValueParams {
777 /// New return value.
778
779 pub newValue: crate::runtime::CallArgument,
780}
781
782/// Edits JavaScript source live.
783///
784/// In general, functions that are currently on the stack can not be edited with
785/// a single exception: If the edited function is the top-most stack frame and
786/// that is the only activation of that function on the stack. In this case
787/// the live edit will be successful and a 'Debugger.restartFrame' for the
788/// top-most function is automatically triggered.
789
790#[derive(Debug, Clone, Serialize, Deserialize, Default)]
791#[serde(rename_all = "camelCase")]
792pub struct SetScriptSourceParams {
793 /// Id of the script to edit.
794
795 pub scriptId: crate::runtime::ScriptId,
796 /// New content of the script.
797
798 pub scriptSource: String,
799 /// If true the change will not actually be applied. Dry run may be used to get result
800 /// description without actually modifying the code.
801
802 #[serde(skip_serializing_if = "Option::is_none")]
803 pub dryRun: Option<bool>,
804 /// If true, then 'scriptSource' is allowed to change the function on top of the stack
805 /// as long as the top-most stack frame is the only activation of that function.
806
807 #[serde(skip_serializing_if = "Option::is_none")]
808 pub allowTopFrameEditing: Option<bool>,
809}
810
811/// Edits JavaScript source live.
812///
813/// In general, functions that are currently on the stack can not be edited with
814/// a single exception: If the edited function is the top-most stack frame and
815/// that is the only activation of that function on the stack. In this case
816/// the live edit will be successful and a 'Debugger.restartFrame' for the
817/// top-most function is automatically triggered.
818
819#[derive(Debug, Clone, Serialize, Deserialize, Default)]
820#[serde(rename_all = "camelCase")]
821pub struct SetScriptSourceReturns {
822 /// New stack trace in case editing has happened while VM was stopped.
823
824 #[serde(skip_serializing_if = "Option::is_none")]
825 pub callFrames: Option<Vec<CallFrame>>,
826 /// Whether current call stack was modified after applying the changes.
827
828 #[serde(skip_serializing_if = "Option::is_none")]
829 pub stackChanged: Option<bool>,
830 /// Async stack trace, if any.
831
832 #[serde(skip_serializing_if = "Option::is_none")]
833 pub asyncStackTrace: Option<crate::runtime::StackTrace>,
834 /// Async stack trace, if any.
835
836 #[serde(skip_serializing_if = "Option::is_none")]
837 pub asyncStackTraceId: Option<crate::runtime::StackTraceId>,
838 /// Whether the operation was successful or not. Only 'Ok' denotes a
839 /// successful live edit while the other enum variants denote why
840 /// the live edit failed.
841
842 pub status: String,
843 /// Exception details if any. Only present when 'status' is 'CompileError'.
844
845 #[serde(skip_serializing_if = "Option::is_none")]
846 pub exceptionDetails: Option<crate::runtime::ExceptionDetails>,
847}
848
849/// Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
850
851#[derive(Debug, Clone, Serialize, Deserialize, Default)]
852#[serde(rename_all = "camelCase")]
853pub struct SetSkipAllPausesParams {
854 /// New value for skip pauses state.
855
856 pub skip: bool,
857}
858
859/// Changes value of variable in a callframe. Object-based scopes are not supported and must be
860/// mutated manually.
861
862#[derive(Debug, Clone, Serialize, Deserialize, Default)]
863#[serde(rename_all = "camelCase")]
864pub struct SetVariableValueParams {
865 /// 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch'
866 /// scope types are allowed. Other scopes could be manipulated manually.
867
868 pub scopeNumber: i64,
869 /// Variable name.
870
871 pub variableName: String,
872 /// New variable value.
873
874 pub newValue: crate::runtime::CallArgument,
875 /// Id of callframe that holds variable.
876
877 pub callFrameId: CallFrameId,
878}
879
880/// Steps into the function call.
881
882#[derive(Debug, Clone, Serialize, Deserialize, Default)]
883#[serde(rename_all = "camelCase")]
884pub struct StepIntoParams {
885 /// Debugger will pause on the execution of the first async task which was scheduled
886 /// before next pause.
887
888 #[serde(skip_serializing_if = "Option::is_none")]
889 pub breakOnAsyncCall: Option<bool>,
890 /// The skipList specifies location ranges that should be skipped on step into.
891
892 #[serde(skip_serializing_if = "Option::is_none")]
893 pub skipList: Option<Vec<LocationRange>>,
894}
895
896/// Steps over the statement.
897
898#[derive(Debug, Clone, Serialize, Deserialize, Default)]
899#[serde(rename_all = "camelCase")]
900pub struct StepOverParams {
901 /// The skipList specifies location ranges that should be skipped on step over.
902
903 #[serde(skip_serializing_if = "Option::is_none")]
904 pub skipList: Option<Vec<LocationRange>>,
905}