Skip to main content

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.
3use serde::{Serialize, Deserialize};
4use serde_json::Value as JsonValue;
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
218impl ContinueToLocationParams { pub const METHOD: &'static str = "Debugger.continueToLocation"; }
219
220impl crate::CdpCommand for ContinueToLocationParams {
221    const METHOD: &'static str = "Debugger.continueToLocation";
222    type Response = crate::EmptyReturns;
223}
224
225#[derive(Debug, Clone, Serialize, Deserialize, Default)]
226pub struct DisableParams {}
227
228impl DisableParams { pub const METHOD: &'static str = "Debugger.disable"; }
229
230impl crate::CdpCommand for DisableParams {
231    const METHOD: &'static str = "Debugger.disable";
232    type Response = crate::EmptyReturns;
233}
234
235/// Enables debugger for the given page. Clients should not assume that the debugging has been
236/// enabled until the result for this command is received.
237
238#[derive(Debug, Clone, Serialize, Deserialize, Default)]
239#[serde(rename_all = "camelCase")]
240pub struct EnableParams {
241    /// The maximum size in bytes of collected scripts (not referenced by other heap objects)
242    /// the debugger can hold. Puts no limit if parameter is omitted.
243
244    #[serde(skip_serializing_if = "Option::is_none")]
245    pub maxScriptsCacheSize: Option<f64>,
246}
247
248/// Enables debugger for the given page. Clients should not assume that the debugging has been
249/// enabled until the result for this command is received.
250
251#[derive(Debug, Clone, Serialize, Deserialize, Default)]
252#[serde(rename_all = "camelCase")]
253pub struct EnableReturns {
254    /// Unique identifier of the debugger.
255
256    pub debuggerId: crate::runtime::UniqueDebuggerId,
257}
258
259impl EnableParams { pub const METHOD: &'static str = "Debugger.enable"; }
260
261impl crate::CdpCommand for EnableParams {
262    const METHOD: &'static str = "Debugger.enable";
263    type Response = EnableReturns;
264}
265
266/// Evaluates expression on a given call frame.
267
268#[derive(Debug, Clone, Serialize, Deserialize, Default)]
269#[serde(rename_all = "camelCase")]
270pub struct EvaluateOnCallFrameParams {
271    /// Call frame identifier to evaluate on.
272
273    pub callFrameId: CallFrameId,
274    /// Expression to evaluate.
275
276    pub expression: String,
277    /// String object group name to put result into (allows rapid releasing resulting object handles
278    /// using 'releaseObjectGroup').
279
280    #[serde(skip_serializing_if = "Option::is_none")]
281    pub objectGroup: Option<String>,
282    /// Specifies whether command line API should be available to the evaluated expression, defaults
283    /// to false.
284
285    #[serde(skip_serializing_if = "Option::is_none")]
286    pub includeCommandLineAPI: Option<bool>,
287    /// In silent mode exceptions thrown during evaluation are not reported and do not pause
288    /// execution. Overrides 'setPauseOnException' state.
289
290    #[serde(skip_serializing_if = "Option::is_none")]
291    pub silent: Option<bool>,
292    /// Whether the result is expected to be a JSON object that should be sent by value.
293
294    #[serde(skip_serializing_if = "Option::is_none")]
295    pub returnByValue: Option<bool>,
296    /// Whether preview should be generated for the result.
297
298    #[serde(skip_serializing_if = "Option::is_none")]
299    pub generatePreview: Option<bool>,
300    /// Whether to throw an exception if side effect cannot be ruled out during evaluation.
301
302    #[serde(skip_serializing_if = "Option::is_none")]
303    pub throwOnSideEffect: Option<bool>,
304    /// Terminate execution after timing out (number of milliseconds).
305
306    #[serde(skip_serializing_if = "Option::is_none")]
307    pub timeout: Option<crate::runtime::TimeDelta>,
308}
309
310/// Evaluates expression on a given call frame.
311
312#[derive(Debug, Clone, Serialize, Deserialize, Default)]
313#[serde(rename_all = "camelCase")]
314pub struct EvaluateOnCallFrameReturns {
315    /// Object wrapper for the evaluation result.
316
317    pub result: crate::runtime::RemoteObject,
318    /// Exception details.
319
320    #[serde(skip_serializing_if = "Option::is_none")]
321    pub exceptionDetails: Option<crate::runtime::ExceptionDetails>,
322}
323
324impl EvaluateOnCallFrameParams { pub const METHOD: &'static str = "Debugger.evaluateOnCallFrame"; }
325
326impl crate::CdpCommand for EvaluateOnCallFrameParams {
327    const METHOD: &'static str = "Debugger.evaluateOnCallFrame";
328    type Response = EvaluateOnCallFrameReturns;
329}
330
331/// Returns possible locations for breakpoint. scriptId in start and end range locations should be
332/// the same.
333
334#[derive(Debug, Clone, Serialize, Deserialize, Default)]
335#[serde(rename_all = "camelCase")]
336pub struct GetPossibleBreakpointsParams {
337    /// Start of range to search possible breakpoint locations in.
338
339    pub start: Location,
340    /// End of range to search possible breakpoint locations in (excluding). When not specified, end
341    /// of scripts is used as end of range.
342
343    #[serde(skip_serializing_if = "Option::is_none")]
344    pub end: Option<Location>,
345    /// Only consider locations which are in the same (non-nested) function as start.
346
347    #[serde(skip_serializing_if = "Option::is_none")]
348    pub restrictToFunction: Option<bool>,
349}
350
351/// Returns possible locations for breakpoint. scriptId in start and end range locations should be
352/// the same.
353
354#[derive(Debug, Clone, Serialize, Deserialize, Default)]
355#[serde(rename_all = "camelCase")]
356pub struct GetPossibleBreakpointsReturns {
357    /// List of the possible breakpoint locations.
358
359    pub locations: Vec<BreakLocation>,
360}
361
362impl GetPossibleBreakpointsParams { pub const METHOD: &'static str = "Debugger.getPossibleBreakpoints"; }
363
364impl crate::CdpCommand for GetPossibleBreakpointsParams {
365    const METHOD: &'static str = "Debugger.getPossibleBreakpoints";
366    type Response = GetPossibleBreakpointsReturns;
367}
368
369/// Returns source for the script with given id.
370
371#[derive(Debug, Clone, Serialize, Deserialize, Default)]
372#[serde(rename_all = "camelCase")]
373pub struct GetScriptSourceParams {
374    /// Id of the script to get source for.
375
376    pub scriptId: crate::runtime::ScriptId,
377}
378
379/// Returns source for the script with given id.
380
381#[derive(Debug, Clone, Serialize, Deserialize, Default)]
382#[serde(rename_all = "camelCase")]
383pub struct GetScriptSourceReturns {
384    /// Script source (empty in case of Wasm bytecode).
385
386    pub scriptSource: String,
387    /// Wasm bytecode. (Encoded as a base64 string when passed over JSON)
388
389    #[serde(skip_serializing_if = "Option::is_none")]
390    pub bytecode: Option<String>,
391}
392
393impl GetScriptSourceParams { pub const METHOD: &'static str = "Debugger.getScriptSource"; }
394
395impl crate::CdpCommand for GetScriptSourceParams {
396    const METHOD: &'static str = "Debugger.getScriptSource";
397    type Response = GetScriptSourceReturns;
398}
399
400
401#[derive(Debug, Clone, Serialize, Deserialize, Default)]
402#[serde(rename_all = "camelCase")]
403pub struct DisassembleWasmModuleParams {
404    /// Id of the script to disassemble
405
406    pub scriptId: crate::runtime::ScriptId,
407}
408
409
410#[derive(Debug, Clone, Serialize, Deserialize, Default)]
411#[serde(rename_all = "camelCase")]
412pub struct DisassembleWasmModuleReturns {
413    /// For large modules, return a stream from which additional chunks of
414    /// disassembly can be read successively.
415
416    #[serde(skip_serializing_if = "Option::is_none")]
417    pub streamId: Option<String>,
418    /// The total number of lines in the disassembly text.
419
420    pub totalNumberOfLines: i64,
421    /// The offsets of all function bodies, in the format [start1, end1,
422    /// start2, end2, ...] where all ends are exclusive.
423
424    pub functionBodyOffsets: Vec<i64>,
425    /// The first chunk of disassembly.
426
427    pub chunk: WasmDisassemblyChunk,
428}
429
430impl DisassembleWasmModuleParams { pub const METHOD: &'static str = "Debugger.disassembleWasmModule"; }
431
432impl crate::CdpCommand for DisassembleWasmModuleParams {
433    const METHOD: &'static str = "Debugger.disassembleWasmModule";
434    type Response = DisassembleWasmModuleReturns;
435}
436
437/// Disassemble the next chunk of lines for the module corresponding to the
438/// stream. If disassembly is complete, this API will invalidate the streamId
439/// and return an empty chunk. Any subsequent calls for the now invalid stream
440/// will return errors.
441
442#[derive(Debug, Clone, Serialize, Deserialize, Default)]
443#[serde(rename_all = "camelCase")]
444pub struct NextWasmDisassemblyChunkParams {
445
446    pub streamId: String,
447}
448
449/// Disassemble the next chunk of lines for the module corresponding to the
450/// stream. If disassembly is complete, this API will invalidate the streamId
451/// and return an empty chunk. Any subsequent calls for the now invalid stream
452/// will return errors.
453
454#[derive(Debug, Clone, Serialize, Deserialize, Default)]
455#[serde(rename_all = "camelCase")]
456pub struct NextWasmDisassemblyChunkReturns {
457    /// The next chunk of disassembly.
458
459    pub chunk: WasmDisassemblyChunk,
460}
461
462impl NextWasmDisassemblyChunkParams { pub const METHOD: &'static str = "Debugger.nextWasmDisassemblyChunk"; }
463
464impl crate::CdpCommand for NextWasmDisassemblyChunkParams {
465    const METHOD: &'static str = "Debugger.nextWasmDisassemblyChunk";
466    type Response = NextWasmDisassemblyChunkReturns;
467}
468
469/// This command is deprecated. Use getScriptSource instead.
470
471#[derive(Debug, Clone, Serialize, Deserialize, Default)]
472#[serde(rename_all = "camelCase")]
473pub struct GetWasmBytecodeParams {
474    /// Id of the Wasm script to get source for.
475
476    pub scriptId: crate::runtime::ScriptId,
477}
478
479/// This command is deprecated. Use getScriptSource instead.
480
481#[derive(Debug, Clone, Serialize, Deserialize, Default)]
482#[serde(rename_all = "camelCase")]
483pub struct GetWasmBytecodeReturns {
484    /// Script source. (Encoded as a base64 string when passed over JSON)
485
486    pub bytecode: String,
487}
488
489impl GetWasmBytecodeParams { pub const METHOD: &'static str = "Debugger.getWasmBytecode"; }
490
491impl crate::CdpCommand for GetWasmBytecodeParams {
492    const METHOD: &'static str = "Debugger.getWasmBytecode";
493    type Response = GetWasmBytecodeReturns;
494}
495
496/// Returns stack trace with given 'stackTraceId'.
497
498#[derive(Debug, Clone, Serialize, Deserialize, Default)]
499#[serde(rename_all = "camelCase")]
500pub struct GetStackTraceParams {
501
502    pub stackTraceId: crate::runtime::StackTraceId,
503}
504
505/// Returns stack trace with given 'stackTraceId'.
506
507#[derive(Debug, Clone, Serialize, Deserialize, Default)]
508#[serde(rename_all = "camelCase")]
509pub struct GetStackTraceReturns {
510
511    pub stackTrace: crate::runtime::StackTrace,
512}
513
514impl GetStackTraceParams { pub const METHOD: &'static str = "Debugger.getStackTrace"; }
515
516impl crate::CdpCommand for GetStackTraceParams {
517    const METHOD: &'static str = "Debugger.getStackTrace";
518    type Response = GetStackTraceReturns;
519}
520
521#[derive(Debug, Clone, Serialize, Deserialize, Default)]
522pub struct PauseParams {}
523
524impl PauseParams { pub const METHOD: &'static str = "Debugger.pause"; }
525
526impl crate::CdpCommand for PauseParams {
527    const METHOD: &'static str = "Debugger.pause";
528    type Response = crate::EmptyReturns;
529}
530
531
532#[derive(Debug, Clone, Serialize, Deserialize, Default)]
533#[serde(rename_all = "camelCase")]
534pub struct PauseOnAsyncCallParams {
535    /// Debugger will pause when async call with given stack trace is started.
536
537    pub parentStackTraceId: crate::runtime::StackTraceId,
538}
539
540impl PauseOnAsyncCallParams { pub const METHOD: &'static str = "Debugger.pauseOnAsyncCall"; }
541
542impl crate::CdpCommand for PauseOnAsyncCallParams {
543    const METHOD: &'static str = "Debugger.pauseOnAsyncCall";
544    type Response = crate::EmptyReturns;
545}
546
547/// Removes JavaScript breakpoint.
548
549#[derive(Debug, Clone, Serialize, Deserialize, Default)]
550#[serde(rename_all = "camelCase")]
551pub struct RemoveBreakpointParams {
552
553    pub breakpointId: BreakpointId,
554}
555
556impl RemoveBreakpointParams { pub const METHOD: &'static str = "Debugger.removeBreakpoint"; }
557
558impl crate::CdpCommand for RemoveBreakpointParams {
559    const METHOD: &'static str = "Debugger.removeBreakpoint";
560    type Response = crate::EmptyReturns;
561}
562
563/// Restarts particular call frame from the beginning. The old, deprecated
564/// behavior of 'restartFrame' is to stay paused and allow further CDP commands
565/// after a restart was scheduled. This can cause problems with restarting, so
566/// we now continue execution immediatly after it has been scheduled until we
567/// reach the beginning of the restarted frame.
568/// 
569/// To stay back-wards compatible, 'restartFrame' now expects a 'mode'
570/// parameter to be present. If the 'mode' parameter is missing, 'restartFrame'
571/// errors out.
572/// 
573/// The various return values are deprecated and 'callFrames' is always empty.
574/// Use the call frames from the 'Debugger#paused' events instead, that fires
575/// once V8 pauses at the beginning of the restarted function.
576
577#[derive(Debug, Clone, Serialize, Deserialize, Default)]
578#[serde(rename_all = "camelCase")]
579pub struct RestartFrameParams {
580    /// Call frame identifier to evaluate on.
581
582    pub callFrameId: CallFrameId,
583    /// The 'mode' parameter must be present and set to 'StepInto', otherwise
584    /// 'restartFrame' will error out.
585
586    #[serde(skip_serializing_if = "Option::is_none")]
587    pub mode: Option<String>,
588}
589
590/// Restarts particular call frame from the beginning. The old, deprecated
591/// behavior of 'restartFrame' is to stay paused and allow further CDP commands
592/// after a restart was scheduled. This can cause problems with restarting, so
593/// we now continue execution immediatly after it has been scheduled until we
594/// reach the beginning of the restarted frame.
595/// 
596/// To stay back-wards compatible, 'restartFrame' now expects a 'mode'
597/// parameter to be present. If the 'mode' parameter is missing, 'restartFrame'
598/// errors out.
599/// 
600/// The various return values are deprecated and 'callFrames' is always empty.
601/// Use the call frames from the 'Debugger#paused' events instead, that fires
602/// once V8 pauses at the beginning of the restarted function.
603
604#[derive(Debug, Clone, Serialize, Deserialize, Default)]
605#[serde(rename_all = "camelCase")]
606pub struct RestartFrameReturns {
607    /// New stack trace.
608
609    pub callFrames: Vec<CallFrame>,
610    /// Async stack trace, if any.
611
612    #[serde(skip_serializing_if = "Option::is_none")]
613    pub asyncStackTrace: Option<crate::runtime::StackTrace>,
614    /// Async stack trace, if any.
615
616    #[serde(skip_serializing_if = "Option::is_none")]
617    pub asyncStackTraceId: Option<crate::runtime::StackTraceId>,
618}
619
620impl RestartFrameParams { pub const METHOD: &'static str = "Debugger.restartFrame"; }
621
622impl crate::CdpCommand for RestartFrameParams {
623    const METHOD: &'static str = "Debugger.restartFrame";
624    type Response = RestartFrameReturns;
625}
626
627/// Resumes JavaScript execution.
628
629#[derive(Debug, Clone, Serialize, Deserialize, Default)]
630#[serde(rename_all = "camelCase")]
631pub struct ResumeParams {
632    /// Set to true to terminate execution upon resuming execution. In contrast
633    /// to Runtime.terminateExecution, this will allows to execute further
634    /// JavaScript (i.e. via evaluation) until execution of the paused code
635    /// is actually resumed, at which point termination is triggered.
636    /// If execution is currently not paused, this parameter has no effect.
637
638    #[serde(skip_serializing_if = "Option::is_none")]
639    pub terminateOnResume: Option<bool>,
640}
641
642impl ResumeParams { pub const METHOD: &'static str = "Debugger.resume"; }
643
644impl crate::CdpCommand for ResumeParams {
645    const METHOD: &'static str = "Debugger.resume";
646    type Response = crate::EmptyReturns;
647}
648
649/// Searches for given string in script content.
650
651#[derive(Debug, Clone, Serialize, Deserialize, Default)]
652#[serde(rename_all = "camelCase")]
653pub struct SearchInContentParams {
654    /// Id of the script to search in.
655
656    pub scriptId: crate::runtime::ScriptId,
657    /// String to search for.
658
659    pub query: String,
660    /// If true, search is case sensitive.
661
662    #[serde(skip_serializing_if = "Option::is_none")]
663    pub caseSensitive: Option<bool>,
664    /// If true, treats string parameter as regex.
665
666    #[serde(skip_serializing_if = "Option::is_none")]
667    pub isRegex: Option<bool>,
668}
669
670/// Searches for given string in script content.
671
672#[derive(Debug, Clone, Serialize, Deserialize, Default)]
673#[serde(rename_all = "camelCase")]
674pub struct SearchInContentReturns {
675    /// List of search matches.
676
677    pub result: Vec<SearchMatch>,
678}
679
680impl SearchInContentParams { pub const METHOD: &'static str = "Debugger.searchInContent"; }
681
682impl crate::CdpCommand for SearchInContentParams {
683    const METHOD: &'static str = "Debugger.searchInContent";
684    type Response = SearchInContentReturns;
685}
686
687/// Enables or disables async call stacks tracking.
688
689#[derive(Debug, Clone, Serialize, Deserialize, Default)]
690#[serde(rename_all = "camelCase")]
691pub struct SetAsyncCallStackDepthParams {
692    /// Maximum depth of async call stacks. Setting to '0' will effectively disable collecting async
693    /// call stacks (default).
694
695    pub maxDepth: i64,
696}
697
698impl SetAsyncCallStackDepthParams { pub const METHOD: &'static str = "Debugger.setAsyncCallStackDepth"; }
699
700impl crate::CdpCommand for SetAsyncCallStackDepthParams {
701    const METHOD: &'static str = "Debugger.setAsyncCallStackDepth";
702    type Response = crate::EmptyReturns;
703}
704
705/// Replace previous blackbox execution contexts with passed ones. Forces backend to skip
706/// stepping/pausing in scripts in these execution contexts. VM will try to leave blackboxed script by
707/// performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
708
709#[derive(Debug, Clone, Serialize, Deserialize, Default)]
710#[serde(rename_all = "camelCase")]
711pub struct SetBlackboxExecutionContextsParams {
712    /// Array of execution context unique ids for the debugger to ignore.
713
714    pub uniqueIds: Vec<String>,
715}
716
717impl SetBlackboxExecutionContextsParams { pub const METHOD: &'static str = "Debugger.setBlackboxExecutionContexts"; }
718
719impl crate::CdpCommand for SetBlackboxExecutionContextsParams {
720    const METHOD: &'static str = "Debugger.setBlackboxExecutionContexts";
721    type Response = crate::EmptyReturns;
722}
723
724/// Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in
725/// scripts with url matching one of the patterns. VM will try to leave blackboxed script by
726/// performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
727
728#[derive(Debug, Clone, Serialize, Deserialize, Default)]
729#[serde(rename_all = "camelCase")]
730pub struct SetBlackboxPatternsParams {
731    /// Array of regexps that will be used to check script url for blackbox state.
732
733    pub patterns: Vec<String>,
734    /// If true, also ignore scripts with no source url.
735
736    #[serde(skip_serializing_if = "Option::is_none")]
737    pub skipAnonymous: Option<bool>,
738}
739
740impl SetBlackboxPatternsParams { pub const METHOD: &'static str = "Debugger.setBlackboxPatterns"; }
741
742impl crate::CdpCommand for SetBlackboxPatternsParams {
743    const METHOD: &'static str = "Debugger.setBlackboxPatterns";
744    type Response = crate::EmptyReturns;
745}
746
747/// Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted
748/// scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
749/// Positions array contains positions where blackbox state is changed. First interval isn't
750/// blackboxed. Array should be sorted.
751
752#[derive(Debug, Clone, Serialize, Deserialize, Default)]
753#[serde(rename_all = "camelCase")]
754pub struct SetBlackboxedRangesParams {
755    /// Id of the script.
756
757    pub scriptId: crate::runtime::ScriptId,
758
759    pub positions: Vec<ScriptPosition>,
760}
761
762impl SetBlackboxedRangesParams { pub const METHOD: &'static str = "Debugger.setBlackboxedRanges"; }
763
764impl crate::CdpCommand for SetBlackboxedRangesParams {
765    const METHOD: &'static str = "Debugger.setBlackboxedRanges";
766    type Response = crate::EmptyReturns;
767}
768
769/// Sets JavaScript breakpoint at a given location.
770
771#[derive(Debug, Clone, Serialize, Deserialize, Default)]
772#[serde(rename_all = "camelCase")]
773pub struct SetBreakpointParams {
774    /// Location to set breakpoint in.
775
776    pub location: Location,
777    /// Expression to use as a breakpoint condition. When specified, debugger will only stop on the
778    /// breakpoint if this expression evaluates to true.
779
780    #[serde(skip_serializing_if = "Option::is_none")]
781    pub condition: Option<String>,
782}
783
784/// Sets JavaScript breakpoint at a given location.
785
786#[derive(Debug, Clone, Serialize, Deserialize, Default)]
787#[serde(rename_all = "camelCase")]
788pub struct SetBreakpointReturns {
789    /// Id of the created breakpoint for further reference.
790
791    pub breakpointId: BreakpointId,
792    /// Location this breakpoint resolved into.
793
794    pub actualLocation: Location,
795}
796
797impl SetBreakpointParams { pub const METHOD: &'static str = "Debugger.setBreakpoint"; }
798
799impl crate::CdpCommand for SetBreakpointParams {
800    const METHOD: &'static str = "Debugger.setBreakpoint";
801    type Response = SetBreakpointReturns;
802}
803
804/// Sets instrumentation breakpoint.
805
806#[derive(Debug, Clone, Serialize, Deserialize, Default)]
807#[serde(rename_all = "camelCase")]
808pub struct SetInstrumentationBreakpointParams {
809    /// Instrumentation name.
810
811    pub instrumentation: String,
812}
813
814/// Sets instrumentation breakpoint.
815
816#[derive(Debug, Clone, Serialize, Deserialize, Default)]
817#[serde(rename_all = "camelCase")]
818pub struct SetInstrumentationBreakpointReturns {
819    /// Id of the created breakpoint for further reference.
820
821    pub breakpointId: BreakpointId,
822}
823
824impl SetInstrumentationBreakpointParams { pub const METHOD: &'static str = "Debugger.setInstrumentationBreakpoint"; }
825
826impl crate::CdpCommand for SetInstrumentationBreakpointParams {
827    const METHOD: &'static str = "Debugger.setInstrumentationBreakpoint";
828    type Response = SetInstrumentationBreakpointReturns;
829}
830
831/// Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this
832/// command is issued, all existing parsed scripts will have breakpoints resolved and returned in
833/// 'locations' property. Further matching script parsing will result in subsequent
834/// 'breakpointResolved' events issued. This logical breakpoint will survive page reloads.
835
836#[derive(Debug, Clone, Serialize, Deserialize, Default)]
837#[serde(rename_all = "camelCase")]
838pub struct SetBreakpointByUrlParams {
839    /// Line number to set breakpoint at.
840
841    pub lineNumber: i64,
842    /// URL of the resources to set breakpoint on.
843
844    #[serde(skip_serializing_if = "Option::is_none")]
845    pub url: Option<String>,
846    /// Regex pattern for the URLs of the resources to set breakpoints on. Either 'url' or
847    /// 'urlRegex' must be specified.
848
849    #[serde(skip_serializing_if = "Option::is_none")]
850    pub urlRegex: Option<String>,
851    /// Script hash of the resources to set breakpoint on.
852
853    #[serde(skip_serializing_if = "Option::is_none")]
854    pub scriptHash: Option<String>,
855    /// Offset in the line to set breakpoint at.
856
857    #[serde(skip_serializing_if = "Option::is_none")]
858    pub columnNumber: Option<i64>,
859    /// Expression to use as a breakpoint condition. When specified, debugger will only stop on the
860    /// breakpoint if this expression evaluates to true.
861
862    #[serde(skip_serializing_if = "Option::is_none")]
863    pub condition: Option<String>,
864}
865
866/// Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this
867/// command is issued, all existing parsed scripts will have breakpoints resolved and returned in
868/// 'locations' property. Further matching script parsing will result in subsequent
869/// 'breakpointResolved' events issued. This logical breakpoint will survive page reloads.
870
871#[derive(Debug, Clone, Serialize, Deserialize, Default)]
872#[serde(rename_all = "camelCase")]
873pub struct SetBreakpointByUrlReturns {
874    /// Id of the created breakpoint for further reference.
875
876    pub breakpointId: BreakpointId,
877    /// List of the locations this breakpoint resolved into upon addition.
878
879    pub locations: Vec<Location>,
880}
881
882impl SetBreakpointByUrlParams { pub const METHOD: &'static str = "Debugger.setBreakpointByUrl"; }
883
884impl crate::CdpCommand for SetBreakpointByUrlParams {
885    const METHOD: &'static str = "Debugger.setBreakpointByUrl";
886    type Response = SetBreakpointByUrlReturns;
887}
888
889/// Sets JavaScript breakpoint before each call to the given function.
890/// If another function was created from the same source as a given one,
891/// calling it will also trigger the breakpoint.
892
893#[derive(Debug, Clone, Serialize, Deserialize, Default)]
894#[serde(rename_all = "camelCase")]
895pub struct SetBreakpointOnFunctionCallParams {
896    /// Function object id.
897
898    pub objectId: crate::runtime::RemoteObjectId,
899    /// Expression to use as a breakpoint condition. When specified, debugger will
900    /// stop on the breakpoint if this expression evaluates to true.
901
902    #[serde(skip_serializing_if = "Option::is_none")]
903    pub condition: Option<String>,
904}
905
906/// Sets JavaScript breakpoint before each call to the given function.
907/// If another function was created from the same source as a given one,
908/// calling it will also trigger the breakpoint.
909
910#[derive(Debug, Clone, Serialize, Deserialize, Default)]
911#[serde(rename_all = "camelCase")]
912pub struct SetBreakpointOnFunctionCallReturns {
913    /// Id of the created breakpoint for further reference.
914
915    pub breakpointId: BreakpointId,
916}
917
918impl SetBreakpointOnFunctionCallParams { pub const METHOD: &'static str = "Debugger.setBreakpointOnFunctionCall"; }
919
920impl crate::CdpCommand for SetBreakpointOnFunctionCallParams {
921    const METHOD: &'static str = "Debugger.setBreakpointOnFunctionCall";
922    type Response = SetBreakpointOnFunctionCallReturns;
923}
924
925/// Activates / deactivates all breakpoints on the page.
926
927#[derive(Debug, Clone, Serialize, Deserialize, Default)]
928#[serde(rename_all = "camelCase")]
929pub struct SetBreakpointsActiveParams {
930    /// New value for breakpoints active state.
931
932    pub active: bool,
933}
934
935impl SetBreakpointsActiveParams { pub const METHOD: &'static str = "Debugger.setBreakpointsActive"; }
936
937impl crate::CdpCommand for SetBreakpointsActiveParams {
938    const METHOD: &'static str = "Debugger.setBreakpointsActive";
939    type Response = crate::EmptyReturns;
940}
941
942/// Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions,
943/// or caught exceptions, no exceptions. Initial pause on exceptions state is 'none'.
944
945#[derive(Debug, Clone, Serialize, Deserialize, Default)]
946#[serde(rename_all = "camelCase")]
947pub struct SetPauseOnExceptionsParams {
948    /// Pause on exceptions mode.
949
950    pub state: String,
951}
952
953impl SetPauseOnExceptionsParams { pub const METHOD: &'static str = "Debugger.setPauseOnExceptions"; }
954
955impl crate::CdpCommand for SetPauseOnExceptionsParams {
956    const METHOD: &'static str = "Debugger.setPauseOnExceptions";
957    type Response = crate::EmptyReturns;
958}
959
960/// Changes return value in top frame. Available only at return break position.
961
962#[derive(Debug, Clone, Serialize, Deserialize, Default)]
963#[serde(rename_all = "camelCase")]
964pub struct SetReturnValueParams {
965    /// New return value.
966
967    pub newValue: crate::runtime::CallArgument,
968}
969
970impl SetReturnValueParams { pub const METHOD: &'static str = "Debugger.setReturnValue"; }
971
972impl crate::CdpCommand for SetReturnValueParams {
973    const METHOD: &'static str = "Debugger.setReturnValue";
974    type Response = crate::EmptyReturns;
975}
976
977/// Edits JavaScript source live.
978/// 
979/// In general, functions that are currently on the stack can not be edited with
980/// a single exception: If the edited function is the top-most stack frame and
981/// that is the only activation of that function on the stack. In this case
982/// the live edit will be successful and a 'Debugger.restartFrame' for the
983/// top-most function is automatically triggered.
984
985#[derive(Debug, Clone, Serialize, Deserialize, Default)]
986#[serde(rename_all = "camelCase")]
987pub struct SetScriptSourceParams {
988    /// Id of the script to edit.
989
990    pub scriptId: crate::runtime::ScriptId,
991    /// New content of the script.
992
993    pub scriptSource: String,
994    /// If true the change will not actually be applied. Dry run may be used to get result
995    /// description without actually modifying the code.
996
997    #[serde(skip_serializing_if = "Option::is_none")]
998    pub dryRun: Option<bool>,
999    /// If true, then 'scriptSource' is allowed to change the function on top of the stack
1000    /// as long as the top-most stack frame is the only activation of that function.
1001
1002    #[serde(skip_serializing_if = "Option::is_none")]
1003    pub allowTopFrameEditing: Option<bool>,
1004}
1005
1006/// Edits JavaScript source live.
1007/// 
1008/// In general, functions that are currently on the stack can not be edited with
1009/// a single exception: If the edited function is the top-most stack frame and
1010/// that is the only activation of that function on the stack. In this case
1011/// the live edit will be successful and a 'Debugger.restartFrame' for the
1012/// top-most function is automatically triggered.
1013
1014#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1015#[serde(rename_all = "camelCase")]
1016pub struct SetScriptSourceReturns {
1017    /// New stack trace in case editing has happened while VM was stopped.
1018
1019    #[serde(skip_serializing_if = "Option::is_none")]
1020    pub callFrames: Option<Vec<CallFrame>>,
1021    /// Whether current call stack  was modified after applying the changes.
1022
1023    #[serde(skip_serializing_if = "Option::is_none")]
1024    pub stackChanged: Option<bool>,
1025    /// Async stack trace, if any.
1026
1027    #[serde(skip_serializing_if = "Option::is_none")]
1028    pub asyncStackTrace: Option<crate::runtime::StackTrace>,
1029    /// Async stack trace, if any.
1030
1031    #[serde(skip_serializing_if = "Option::is_none")]
1032    pub asyncStackTraceId: Option<crate::runtime::StackTraceId>,
1033    /// Whether the operation was successful or not. Only 'Ok' denotes a
1034    /// successful live edit while the other enum variants denote why
1035    /// the live edit failed.
1036
1037    pub status: String,
1038    /// Exception details if any. Only present when 'status' is 'CompileError'.
1039
1040    #[serde(skip_serializing_if = "Option::is_none")]
1041    pub exceptionDetails: Option<crate::runtime::ExceptionDetails>,
1042}
1043
1044impl SetScriptSourceParams { pub const METHOD: &'static str = "Debugger.setScriptSource"; }
1045
1046impl crate::CdpCommand for SetScriptSourceParams {
1047    const METHOD: &'static str = "Debugger.setScriptSource";
1048    type Response = SetScriptSourceReturns;
1049}
1050
1051/// Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
1052
1053#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1054#[serde(rename_all = "camelCase")]
1055pub struct SetSkipAllPausesParams {
1056    /// New value for skip pauses state.
1057
1058    pub skip: bool,
1059}
1060
1061impl SetSkipAllPausesParams { pub const METHOD: &'static str = "Debugger.setSkipAllPauses"; }
1062
1063impl crate::CdpCommand for SetSkipAllPausesParams {
1064    const METHOD: &'static str = "Debugger.setSkipAllPauses";
1065    type Response = crate::EmptyReturns;
1066}
1067
1068/// Changes value of variable in a callframe. Object-based scopes are not supported and must be
1069/// mutated manually.
1070
1071#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1072#[serde(rename_all = "camelCase")]
1073pub struct SetVariableValueParams {
1074    /// 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch'
1075    /// scope types are allowed. Other scopes could be manipulated manually.
1076
1077    pub scopeNumber: i64,
1078    /// Variable name.
1079
1080    pub variableName: String,
1081    /// New variable value.
1082
1083    pub newValue: crate::runtime::CallArgument,
1084    /// Id of callframe that holds variable.
1085
1086    pub callFrameId: CallFrameId,
1087}
1088
1089impl SetVariableValueParams { pub const METHOD: &'static str = "Debugger.setVariableValue"; }
1090
1091impl crate::CdpCommand for SetVariableValueParams {
1092    const METHOD: &'static str = "Debugger.setVariableValue";
1093    type Response = crate::EmptyReturns;
1094}
1095
1096/// Steps into the function call.
1097
1098#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1099#[serde(rename_all = "camelCase")]
1100pub struct StepIntoParams {
1101    /// Debugger will pause on the execution of the first async task which was scheduled
1102    /// before next pause.
1103
1104    #[serde(skip_serializing_if = "Option::is_none")]
1105    pub breakOnAsyncCall: Option<bool>,
1106    /// The skipList specifies location ranges that should be skipped on step into.
1107
1108    #[serde(skip_serializing_if = "Option::is_none")]
1109    pub skipList: Option<Vec<LocationRange>>,
1110}
1111
1112impl StepIntoParams { pub const METHOD: &'static str = "Debugger.stepInto"; }
1113
1114impl crate::CdpCommand for StepIntoParams {
1115    const METHOD: &'static str = "Debugger.stepInto";
1116    type Response = crate::EmptyReturns;
1117}
1118
1119#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1120pub struct StepOutParams {}
1121
1122impl StepOutParams { pub const METHOD: &'static str = "Debugger.stepOut"; }
1123
1124impl crate::CdpCommand for StepOutParams {
1125    const METHOD: &'static str = "Debugger.stepOut";
1126    type Response = crate::EmptyReturns;
1127}
1128
1129/// Steps over the statement.
1130
1131#[derive(Debug, Clone, Serialize, Deserialize, Default)]
1132#[serde(rename_all = "camelCase")]
1133pub struct StepOverParams {
1134    /// The skipList specifies location ranges that should be skipped on step over.
1135
1136    #[serde(skip_serializing_if = "Option::is_none")]
1137    pub skipList: Option<Vec<LocationRange>>,
1138}
1139
1140impl StepOverParams { pub const METHOD: &'static str = "Debugger.stepOver"; }
1141
1142impl crate::CdpCommand for StepOverParams {
1143    const METHOD: &'static str = "Debugger.stepOver";
1144    type Response = crate::EmptyReturns;
1145}