js_protocol/runtime/mod.rs
1//! Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects.
2//! Evaluation results are returned as mirror object that expose object type, string representation
3//! and unique identifier that can be used for further object reference. Original objects are
4//! maintained in memory unless they are either explicitly released or are released along with the
5//! other objects in their object group.
6
7use serde::{Serialize, Deserialize};
8use serde_json::Value as JsonValue;
9
10/// Unique script identifier.
11
12pub type ScriptId = String;
13
14/// Represents options for serialization. Overrides 'generatePreview' and 'returnByValue'.
15
16#[derive(Debug, Clone, Serialize, Deserialize, Default)]
17#[serde(rename_all = "camelCase")]
18pub struct SerializationOptions {
19
20 pub serialization: String,
21 /// Deep serialization depth. Default is full depth. Respected only in 'deep' serialization mode.
22
23 #[serde(skip_serializing_if = "Option::is_none")]
24 pub maxDepth: Option<i64>,
25 /// Embedder-specific parameters. For example if connected to V8 in Chrome these control DOM
26 /// serialization via 'maxNodeDepth: integer' and 'includeShadowTree: "none" | "open" | "all"'.
27 /// Values can be only of type string or integer.
28
29 #[serde(skip_serializing_if = "Option::is_none")]
30 pub additionalParameters: Option<serde_json::Map<String, JsonValue>>,
31}
32
33/// Represents deep serialized value.
34
35#[derive(Debug, Clone, Serialize, Deserialize, Default)]
36#[serde(rename_all = "camelCase")]
37pub struct DeepSerializedValue {
38
39 #[serde(rename = "type")]
40 pub type_: String,
41
42 #[serde(skip_serializing_if = "Option::is_none")]
43 pub value: Option<JsonValue>,
44
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub objectId: Option<String>,
47 /// Set if value reference met more then once during serialization. In such
48 /// case, value is provided only to one of the serialized values. Unique
49 /// per value in the scope of one CDP call.
50
51 #[serde(skip_serializing_if = "Option::is_none")]
52 pub weakLocalObjectReference: Option<i64>,
53}
54
55/// Unique object identifier.
56
57pub type RemoteObjectId = String;
58
59/// Primitive value which cannot be JSON-stringified. Includes values '-0', 'NaN', 'Infinity',
60/// '-Infinity', and bigint literals.
61
62pub type UnserializableValue = String;
63
64/// Mirror object referencing original JavaScript object.
65
66#[derive(Debug, Clone, Serialize, Deserialize, Default)]
67#[serde(rename_all = "camelCase")]
68pub struct RemoteObject {
69 /// Object type.
70
71 #[serde(rename = "type")]
72 pub type_: String,
73 /// Object subtype hint. Specified for 'object' type values only.
74 /// NOTE: If you change anything here, make sure to also update
75 /// 'subtype' in 'ObjectPreview' and 'PropertyPreview' below.
76
77 #[serde(skip_serializing_if = "Option::is_none")]
78 pub subtype: Option<String>,
79 /// Object class (constructor) name. Specified for 'object' type values only.
80
81 #[serde(skip_serializing_if = "Option::is_none")]
82 pub className: Option<String>,
83 /// Remote object value in case of primitive values or JSON values (if it was requested).
84
85 #[serde(skip_serializing_if = "Option::is_none")]
86 pub value: Option<JsonValue>,
87 /// Primitive value which can not be JSON-stringified does not have 'value', but gets this
88 /// property.
89
90 #[serde(skip_serializing_if = "Option::is_none")]
91 pub unserializableValue: Option<UnserializableValue>,
92 /// String representation of the object.
93
94 #[serde(skip_serializing_if = "Option::is_none")]
95 pub description: Option<String>,
96 /// Deep serialized value.
97
98 #[serde(skip_serializing_if = "Option::is_none")]
99 pub deepSerializedValue: Option<DeepSerializedValue>,
100 /// Unique object identifier (for non-primitive values).
101
102 #[serde(skip_serializing_if = "Option::is_none")]
103 pub objectId: Option<RemoteObjectId>,
104 /// Preview containing abbreviated property values. Specified for 'object' type values only.
105
106 #[serde(skip_serializing_if = "Option::is_none")]
107 pub preview: Option<ObjectPreview>,
108
109 #[serde(skip_serializing_if = "Option::is_none")]
110 pub customPreview: Option<CustomPreview>,
111}
112
113
114#[derive(Debug, Clone, Serialize, Deserialize, Default)]
115#[serde(rename_all = "camelCase")]
116pub struct CustomPreview {
117 /// The JSON-stringified result of formatter.header(object, config) call.
118 /// It contains json ML array that represents RemoteObject.
119
120 pub header: String,
121 /// If formatter returns true as a result of formatter.hasBody call then bodyGetterId will
122 /// contain RemoteObjectId for the function that returns result of formatter.body(object, config) call.
123 /// The result value is json ML array.
124
125 #[serde(skip_serializing_if = "Option::is_none")]
126 pub bodyGetterId: Option<RemoteObjectId>,
127}
128
129/// Object containing abbreviated remote object value.
130
131#[derive(Debug, Clone, Serialize, Deserialize, Default)]
132#[serde(rename_all = "camelCase")]
133pub struct ObjectPreview {
134 /// Object type.
135
136 #[serde(rename = "type")]
137 pub type_: String,
138 /// Object subtype hint. Specified for 'object' type values only.
139
140 #[serde(skip_serializing_if = "Option::is_none")]
141 pub subtype: Option<String>,
142 /// String representation of the object.
143
144 #[serde(skip_serializing_if = "Option::is_none")]
145 pub description: Option<String>,
146 /// True iff some of the properties or entries of the original object did not fit.
147
148 pub overflow: bool,
149 /// List of the properties.
150
151 pub properties: Vec<PropertyPreview>,
152 /// List of the entries. Specified for 'map' and 'set' subtype values only.
153
154 #[serde(skip_serializing_if = "Option::is_none")]
155 pub entries: Option<Vec<EntryPreview>>,
156}
157
158
159#[derive(Debug, Clone, Serialize, Deserialize, Default)]
160#[serde(rename_all = "camelCase")]
161pub struct PropertyPreview {
162 /// Property name.
163
164 pub name: String,
165 /// Object type. Accessor means that the property itself is an accessor property.
166
167 #[serde(rename = "type")]
168 pub type_: String,
169 /// User-friendly property value string.
170
171 #[serde(skip_serializing_if = "Option::is_none")]
172 pub value: Option<String>,
173 /// Nested value preview.
174
175 #[serde(skip_serializing_if = "Option::is_none")]
176 pub valuePreview: Option<ObjectPreview>,
177 /// Object subtype hint. Specified for 'object' type values only.
178
179 #[serde(skip_serializing_if = "Option::is_none")]
180 pub subtype: Option<String>,
181}
182
183
184#[derive(Debug, Clone, Serialize, Deserialize, Default)]
185#[serde(rename_all = "camelCase")]
186pub struct EntryPreview {
187 /// Preview of the key. Specified for map-like collection entries.
188
189 #[serde(skip_serializing_if = "Option::is_none")]
190 pub key: Option<ObjectPreview>,
191 /// Preview of the value.
192
193 pub value: ObjectPreview,
194}
195
196/// Object property descriptor.
197
198#[derive(Debug, Clone, Serialize, Deserialize, Default)]
199#[serde(rename_all = "camelCase")]
200pub struct PropertyDescriptor {
201 /// Property name or symbol description.
202
203 pub name: String,
204 /// The value associated with the property.
205
206 #[serde(skip_serializing_if = "Option::is_none")]
207 pub value: Option<RemoteObject>,
208 /// True if the value associated with the property may be changed (data descriptors only).
209
210 #[serde(skip_serializing_if = "Option::is_none")]
211 pub writable: Option<bool>,
212 /// A function which serves as a getter for the property, or 'undefined' if there is no getter
213 /// (accessor descriptors only).
214
215 #[serde(skip_serializing_if = "Option::is_none")]
216 pub get: Option<RemoteObject>,
217 /// A function which serves as a setter for the property, or 'undefined' if there is no setter
218 /// (accessor descriptors only).
219
220 #[serde(skip_serializing_if = "Option::is_none")]
221 pub set: Option<RemoteObject>,
222 /// True if the type of this property descriptor may be changed and if the property may be
223 /// deleted from the corresponding object.
224
225 pub configurable: bool,
226 /// True if this property shows up during enumeration of the properties on the corresponding
227 /// object.
228
229 pub enumerable: bool,
230 /// True if the result was thrown during the evaluation.
231
232 #[serde(skip_serializing_if = "Option::is_none")]
233 pub wasThrown: Option<bool>,
234 /// True if the property is owned for the object.
235
236 #[serde(skip_serializing_if = "Option::is_none")]
237 pub isOwn: Option<bool>,
238 /// Property symbol object, if the property is of the 'symbol' type.
239
240 #[serde(skip_serializing_if = "Option::is_none")]
241 pub symbol: Option<RemoteObject>,
242}
243
244/// Object internal property descriptor. This property isn't normally visible in JavaScript code.
245
246#[derive(Debug, Clone, Serialize, Deserialize, Default)]
247#[serde(rename_all = "camelCase")]
248pub struct InternalPropertyDescriptor {
249 /// Conventional property name.
250
251 pub name: String,
252 /// The value associated with the property.
253
254 #[serde(skip_serializing_if = "Option::is_none")]
255 pub value: Option<RemoteObject>,
256}
257
258/// Object private field descriptor.
259
260#[derive(Debug, Clone, Serialize, Deserialize, Default)]
261#[serde(rename_all = "camelCase")]
262pub struct PrivatePropertyDescriptor {
263 /// Private property name.
264
265 pub name: String,
266 /// The value associated with the private property.
267
268 #[serde(skip_serializing_if = "Option::is_none")]
269 pub value: Option<RemoteObject>,
270 /// A function which serves as a getter for the private property,
271 /// or 'undefined' if there is no getter (accessor descriptors only).
272
273 #[serde(skip_serializing_if = "Option::is_none")]
274 pub get: Option<RemoteObject>,
275 /// A function which serves as a setter for the private property,
276 /// or 'undefined' if there is no setter (accessor descriptors only).
277
278 #[serde(skip_serializing_if = "Option::is_none")]
279 pub set: Option<RemoteObject>,
280}
281
282/// Represents function call argument. Either remote object id 'objectId', primitive 'value',
283/// unserializable primitive value or neither of (for undefined) them should be specified.
284
285#[derive(Debug, Clone, Serialize, Deserialize, Default)]
286#[serde(rename_all = "camelCase")]
287pub struct CallArgument {
288 /// Primitive value or serializable javascript object.
289
290 #[serde(skip_serializing_if = "Option::is_none")]
291 pub value: Option<JsonValue>,
292 /// Primitive value which can not be JSON-stringified.
293
294 #[serde(skip_serializing_if = "Option::is_none")]
295 pub unserializableValue: Option<UnserializableValue>,
296 /// Remote object handle.
297
298 #[serde(skip_serializing_if = "Option::is_none")]
299 pub objectId: Option<RemoteObjectId>,
300}
301
302/// Id of an execution context.
303
304pub type ExecutionContextId = i64;
305
306/// Description of an isolated world.
307
308#[derive(Debug, Clone, Serialize, Deserialize, Default)]
309#[serde(rename_all = "camelCase")]
310pub struct ExecutionContextDescription {
311 /// Unique id of the execution context. It can be used to specify in which execution context
312 /// script evaluation should be performed.
313
314 pub id: ExecutionContextId,
315 /// Execution context origin.
316
317 pub origin: String,
318 /// Human readable name describing given context.
319
320 pub name: String,
321 /// A system-unique execution context identifier. Unlike the id, this is unique across
322 /// multiple processes, so can be reliably used to identify specific context while backend
323 /// performs a cross-process navigation.
324
325 pub uniqueId: String,
326 /// Embedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string}
327
328 #[serde(skip_serializing_if = "Option::is_none")]
329 pub auxData: Option<serde_json::Map<String, JsonValue>>,
330}
331
332/// Detailed information about exception (or error) that was thrown during script compilation or
333/// execution.
334
335#[derive(Debug, Clone, Serialize, Deserialize, Default)]
336#[serde(rename_all = "camelCase")]
337pub struct ExceptionDetails {
338 /// Exception id.
339
340 pub exceptionId: u64,
341 /// Exception text, which should be used together with exception object when available.
342
343 pub text: String,
344 /// Line number of the exception location (0-based).
345
346 pub lineNumber: i64,
347 /// Column number of the exception location (0-based).
348
349 pub columnNumber: i64,
350 /// Script ID of the exception location.
351
352 #[serde(skip_serializing_if = "Option::is_none")]
353 pub scriptId: Option<ScriptId>,
354 /// URL of the exception location, to be used when the script was not reported.
355
356 #[serde(skip_serializing_if = "Option::is_none")]
357 pub url: Option<String>,
358 /// JavaScript stack trace if available.
359
360 #[serde(skip_serializing_if = "Option::is_none")]
361 pub stackTrace: Option<StackTrace>,
362 /// Exception object if available.
363
364 #[serde(skip_serializing_if = "Option::is_none")]
365 pub exception: Option<RemoteObject>,
366 /// Identifier of the context where exception happened.
367
368 #[serde(skip_serializing_if = "Option::is_none")]
369 pub executionContextId: Option<ExecutionContextId>,
370 /// Dictionary with entries of meta data that the client associated
371 /// with this exception, such as information about associated network
372 /// requests, etc.
373
374 #[serde(skip_serializing_if = "Option::is_none")]
375 pub exceptionMetaData: Option<serde_json::Map<String, JsonValue>>,
376}
377
378/// Number of milliseconds since epoch.
379
380pub type Timestamp = f64;
381
382/// Number of milliseconds.
383
384pub type TimeDelta = f64;
385
386/// Stack entry for runtime errors and assertions.
387
388#[derive(Debug, Clone, Serialize, Deserialize, Default)]
389#[serde(rename_all = "camelCase")]
390pub struct CallFrame {
391 /// JavaScript function name.
392
393 pub functionName: String,
394 /// JavaScript script id.
395
396 pub scriptId: ScriptId,
397 /// JavaScript script name or url.
398
399 pub url: String,
400 /// JavaScript script line number (0-based).
401
402 pub lineNumber: i64,
403 /// JavaScript script column number (0-based).
404
405 pub columnNumber: i64,
406}
407
408/// Call frames for assertions or error messages.
409
410#[derive(Debug, Clone, Serialize, Deserialize, Default)]
411#[serde(rename_all = "camelCase")]
412pub struct StackTrace {
413 /// String label of this stack trace. For async traces this may be a name of the function that
414 /// initiated the async call.
415
416 #[serde(skip_serializing_if = "Option::is_none")]
417 pub description: Option<String>,
418 /// JavaScript function name.
419
420 pub callFrames: Vec<CallFrame>,
421 /// Asynchronous JavaScript stack trace that preceded this stack, if available.
422
423 #[serde(skip_serializing_if = "Option::is_none")]
424 pub parent: Option<Box<StackTrace>>,
425 /// Asynchronous JavaScript stack trace that preceded this stack, if available.
426
427 #[serde(skip_serializing_if = "Option::is_none")]
428 pub parentId: Option<StackTraceId>,
429}
430
431/// Unique identifier of current debugger.
432
433pub type UniqueDebuggerId = String;
434
435/// If 'debuggerId' is set stack trace comes from another debugger and can be resolved there. This
436/// allows to track cross-debugger calls. See 'Runtime.StackTrace' and 'Debugger.paused' for usages.
437
438#[derive(Debug, Clone, Serialize, Deserialize, Default)]
439#[serde(rename_all = "camelCase")]
440pub struct StackTraceId {
441
442 pub id: String,
443
444 #[serde(skip_serializing_if = "Option::is_none")]
445 pub debuggerId: Option<UniqueDebuggerId>,
446}
447
448/// Add handler to promise with given promise object id.
449
450#[derive(Debug, Clone, Serialize, Deserialize, Default)]
451#[serde(rename_all = "camelCase")]
452pub struct AwaitPromiseParams {
453 /// Identifier of the promise.
454
455 pub promiseObjectId: RemoteObjectId,
456 /// Whether the result is expected to be a JSON object that should be sent by value.
457
458 #[serde(skip_serializing_if = "Option::is_none")]
459 pub returnByValue: Option<bool>,
460 /// Whether preview should be generated for the result.
461
462 #[serde(skip_serializing_if = "Option::is_none")]
463 pub generatePreview: Option<bool>,
464}
465
466/// Add handler to promise with given promise object id.
467
468#[derive(Debug, Clone, Serialize, Deserialize, Default)]
469#[serde(rename_all = "camelCase")]
470pub struct AwaitPromiseReturns {
471 /// Promise result. Will contain rejected value if promise was rejected.
472
473 pub result: RemoteObject,
474 /// Exception details if stack strace is available.
475
476 #[serde(skip_serializing_if = "Option::is_none")]
477 pub exceptionDetails: Option<ExceptionDetails>,
478}
479
480/// Calls function with given declaration on the given object. Object group of the result is
481/// inherited from the target object.
482
483#[derive(Debug, Clone, Serialize, Deserialize, Default)]
484#[serde(rename_all = "camelCase")]
485pub struct CallFunctionOnParams {
486 /// Declaration of the function to call.
487
488 pub functionDeclaration: String,
489 /// Identifier of the object to call function on. Either objectId or executionContextId should
490 /// be specified.
491
492 #[serde(skip_serializing_if = "Option::is_none")]
493 pub objectId: Option<RemoteObjectId>,
494 /// Call arguments. All call arguments must belong to the same JavaScript world as the target
495 /// object.
496
497 #[serde(skip_serializing_if = "Option::is_none")]
498 pub arguments: Option<Vec<CallArgument>>,
499 /// In silent mode exceptions thrown during evaluation are not reported and do not pause
500 /// execution. Overrides 'setPauseOnException' state.
501
502 #[serde(skip_serializing_if = "Option::is_none")]
503 pub silent: Option<bool>,
504 /// Whether the result is expected to be a JSON object which should be sent by value.
505 /// Can be overriden by 'serializationOptions'.
506
507 #[serde(skip_serializing_if = "Option::is_none")]
508 pub returnByValue: Option<bool>,
509 /// Whether preview should be generated for the result.
510
511 #[serde(skip_serializing_if = "Option::is_none")]
512 pub generatePreview: Option<bool>,
513 /// Whether execution should be treated as initiated by user in the UI.
514
515 #[serde(skip_serializing_if = "Option::is_none")]
516 pub userGesture: Option<bool>,
517 /// Whether execution should 'await' for resulting value and return once awaited promise is
518 /// resolved.
519
520 #[serde(skip_serializing_if = "Option::is_none")]
521 pub awaitPromise: Option<bool>,
522 /// Specifies execution context which global object will be used to call function on. Either
523 /// executionContextId or objectId should be specified.
524
525 #[serde(skip_serializing_if = "Option::is_none")]
526 pub executionContextId: Option<ExecutionContextId>,
527 /// Symbolic group name that can be used to release multiple objects. If objectGroup is not
528 /// specified and objectId is, objectGroup will be inherited from object.
529
530 #[serde(skip_serializing_if = "Option::is_none")]
531 pub objectGroup: Option<String>,
532 /// Whether to throw an exception if side effect cannot be ruled out during evaluation.
533
534 #[serde(skip_serializing_if = "Option::is_none")]
535 pub throwOnSideEffect: Option<bool>,
536 /// An alternative way to specify the execution context to call function on.
537 /// Compared to contextId that may be reused across processes, this is guaranteed to be
538 /// system-unique, so it can be used to prevent accidental function call
539 /// in context different than intended (e.g. as a result of navigation across process
540 /// boundaries).
541 /// This is mutually exclusive with 'executionContextId'.
542
543 #[serde(skip_serializing_if = "Option::is_none")]
544 pub uniqueContextId: Option<String>,
545 /// Specifies the result serialization. If provided, overrides
546 /// 'generatePreview' and 'returnByValue'.
547
548 #[serde(skip_serializing_if = "Option::is_none")]
549 pub serializationOptions: Option<SerializationOptions>,
550}
551
552/// Calls function with given declaration on the given object. Object group of the result is
553/// inherited from the target object.
554
555#[derive(Debug, Clone, Serialize, Deserialize, Default)]
556#[serde(rename_all = "camelCase")]
557pub struct CallFunctionOnReturns {
558 /// Call result.
559
560 pub result: RemoteObject,
561 /// Exception details.
562
563 #[serde(skip_serializing_if = "Option::is_none")]
564 pub exceptionDetails: Option<ExceptionDetails>,
565}
566
567/// Compiles expression.
568
569#[derive(Debug, Clone, Serialize, Deserialize, Default)]
570#[serde(rename_all = "camelCase")]
571pub struct CompileScriptParams {
572 /// Expression to compile.
573
574 pub expression: String,
575 /// Source url to be set for the script.
576
577 pub sourceURL: String,
578 /// Specifies whether the compiled script should be persisted.
579
580 pub persistScript: bool,
581 /// Specifies in which execution context to perform script run. If the parameter is omitted the
582 /// evaluation will be performed in the context of the inspected page.
583
584 #[serde(skip_serializing_if = "Option::is_none")]
585 pub executionContextId: Option<ExecutionContextId>,
586}
587
588/// Compiles expression.
589
590#[derive(Debug, Clone, Serialize, Deserialize, Default)]
591#[serde(rename_all = "camelCase")]
592pub struct CompileScriptReturns {
593 /// Id of the script.
594
595 #[serde(skip_serializing_if = "Option::is_none")]
596 pub scriptId: Option<ScriptId>,
597 /// Exception details.
598
599 #[serde(skip_serializing_if = "Option::is_none")]
600 pub exceptionDetails: Option<ExceptionDetails>,
601}
602
603/// Evaluates expression on global object.
604
605#[derive(Debug, Clone, Serialize, Deserialize, Default)]
606#[serde(rename_all = "camelCase")]
607pub struct EvaluateParams {
608 /// Expression to evaluate.
609
610 pub expression: String,
611 /// Symbolic group name that can be used to release multiple objects.
612
613 #[serde(skip_serializing_if = "Option::is_none")]
614 pub objectGroup: Option<String>,
615 /// Determines whether Command Line API should be available during the evaluation.
616
617 #[serde(skip_serializing_if = "Option::is_none")]
618 pub includeCommandLineAPI: Option<bool>,
619 /// In silent mode exceptions thrown during evaluation are not reported and do not pause
620 /// execution. Overrides 'setPauseOnException' state.
621
622 #[serde(skip_serializing_if = "Option::is_none")]
623 pub silent: Option<bool>,
624 /// Specifies in which execution context to perform evaluation. If the parameter is omitted the
625 /// evaluation will be performed in the context of the inspected page.
626 /// This is mutually exclusive with 'uniqueContextId', which offers an
627 /// alternative way to identify the execution context that is more reliable
628 /// in a multi-process environment.
629
630 #[serde(skip_serializing_if = "Option::is_none")]
631 pub contextId: Option<ExecutionContextId>,
632 /// Whether the result is expected to be a JSON object that should be sent by value.
633
634 #[serde(skip_serializing_if = "Option::is_none")]
635 pub returnByValue: Option<bool>,
636 /// Whether preview should be generated for the result.
637
638 #[serde(skip_serializing_if = "Option::is_none")]
639 pub generatePreview: Option<bool>,
640 /// Whether execution should be treated as initiated by user in the UI.
641
642 #[serde(skip_serializing_if = "Option::is_none")]
643 pub userGesture: Option<bool>,
644 /// Whether execution should 'await' for resulting value and return once awaited promise is
645 /// resolved.
646
647 #[serde(skip_serializing_if = "Option::is_none")]
648 pub awaitPromise: Option<bool>,
649 /// Whether to throw an exception if side effect cannot be ruled out during evaluation.
650 /// This implies 'disableBreaks' below.
651
652 #[serde(skip_serializing_if = "Option::is_none")]
653 pub throwOnSideEffect: Option<bool>,
654 /// Terminate execution after timing out (number of milliseconds).
655
656 #[serde(skip_serializing_if = "Option::is_none")]
657 pub timeout: Option<TimeDelta>,
658 /// Disable breakpoints during execution.
659
660 #[serde(skip_serializing_if = "Option::is_none")]
661 pub disableBreaks: Option<bool>,
662 /// Setting this flag to true enables 'let' re-declaration and top-level 'await'.
663 /// Note that 'let' variables can only be re-declared if they originate from
664 /// 'replMode' themselves.
665
666 #[serde(skip_serializing_if = "Option::is_none")]
667 pub replMode: Option<bool>,
668 /// The Content Security Policy (CSP) for the target might block 'unsafe-eval'
669 /// which includes eval(), Function(), setTimeout() and setInterval()
670 /// when called with non-callable arguments. This flag bypasses CSP for this
671 /// evaluation and allows unsafe-eval. Defaults to true.
672
673 #[serde(skip_serializing_if = "Option::is_none")]
674 pub allowUnsafeEvalBlockedByCSP: Option<bool>,
675 /// An alternative way to specify the execution context to evaluate in.
676 /// Compared to contextId that may be reused across processes, this is guaranteed to be
677 /// system-unique, so it can be used to prevent accidental evaluation of the expression
678 /// in context different than intended (e.g. as a result of navigation across process
679 /// boundaries).
680 /// This is mutually exclusive with 'contextId'.
681
682 #[serde(skip_serializing_if = "Option::is_none")]
683 pub uniqueContextId: Option<String>,
684 /// Specifies the result serialization. If provided, overrides
685 /// 'generatePreview' and 'returnByValue'.
686
687 #[serde(skip_serializing_if = "Option::is_none")]
688 pub serializationOptions: Option<SerializationOptions>,
689}
690
691/// Evaluates expression on global object.
692
693#[derive(Debug, Clone, Serialize, Deserialize, Default)]
694#[serde(rename_all = "camelCase")]
695pub struct EvaluateReturns {
696 /// Evaluation result.
697
698 pub result: RemoteObject,
699 /// Exception details.
700
701 #[serde(skip_serializing_if = "Option::is_none")]
702 pub exceptionDetails: Option<ExceptionDetails>,
703}
704
705/// Returns the isolate id.
706
707#[derive(Debug, Clone, Serialize, Deserialize, Default)]
708#[serde(rename_all = "camelCase")]
709pub struct GetIsolateIdReturns {
710 /// The isolate id.
711
712 pub id: String,
713}
714
715/// Returns the JavaScript heap usage.
716/// It is the total usage of the corresponding isolate not scoped to a particular Runtime.
717
718#[derive(Debug, Clone, Serialize, Deserialize, Default)]
719#[serde(rename_all = "camelCase")]
720pub struct GetHeapUsageReturns {
721 /// Used JavaScript heap size in bytes.
722
723 pub usedSize: f64,
724 /// Allocated JavaScript heap size in bytes.
725
726 pub totalSize: f64,
727 /// Used size in bytes in the embedder's garbage-collected heap.
728
729 pub embedderHeapUsedSize: f64,
730 /// Size in bytes of backing storage for array buffers and external strings.
731
732 pub backingStorageSize: f64,
733}
734
735/// Returns properties of a given object. Object group of the result is inherited from the target
736/// object.
737
738#[derive(Debug, Clone, Serialize, Deserialize, Default)]
739#[serde(rename_all = "camelCase")]
740pub struct GetPropertiesParams {
741 /// Identifier of the object to return properties for.
742
743 pub objectId: RemoteObjectId,
744 /// If true, returns properties belonging only to the element itself, not to its prototype
745 /// chain.
746
747 #[serde(skip_serializing_if = "Option::is_none")]
748 pub ownProperties: Option<bool>,
749 /// If true, returns accessor properties (with getter/setter) only; internal properties are not
750 /// returned either.
751
752 #[serde(skip_serializing_if = "Option::is_none")]
753 pub accessorPropertiesOnly: Option<bool>,
754 /// Whether preview should be generated for the results.
755
756 #[serde(skip_serializing_if = "Option::is_none")]
757 pub generatePreview: Option<bool>,
758 /// If true, returns non-indexed properties only.
759
760 #[serde(skip_serializing_if = "Option::is_none")]
761 pub nonIndexedPropertiesOnly: Option<bool>,
762}
763
764/// Returns properties of a given object. Object group of the result is inherited from the target
765/// object.
766
767#[derive(Debug, Clone, Serialize, Deserialize, Default)]
768#[serde(rename_all = "camelCase")]
769pub struct GetPropertiesReturns {
770 /// Object properties.
771
772 pub result: Vec<PropertyDescriptor>,
773 /// Internal object properties (only of the element itself).
774
775 #[serde(skip_serializing_if = "Option::is_none")]
776 pub internalProperties: Option<Vec<InternalPropertyDescriptor>>,
777 /// Object private properties.
778
779 #[serde(skip_serializing_if = "Option::is_none")]
780 pub privateProperties: Option<Vec<PrivatePropertyDescriptor>>,
781 /// Exception details.
782
783 #[serde(skip_serializing_if = "Option::is_none")]
784 pub exceptionDetails: Option<ExceptionDetails>,
785}
786
787/// Returns all let, const and class variables from global scope.
788
789#[derive(Debug, Clone, Serialize, Deserialize, Default)]
790#[serde(rename_all = "camelCase")]
791pub struct GlobalLexicalScopeNamesParams {
792 /// Specifies in which execution context to lookup global scope variables.
793
794 #[serde(skip_serializing_if = "Option::is_none")]
795 pub executionContextId: Option<ExecutionContextId>,
796}
797
798/// Returns all let, const and class variables from global scope.
799
800#[derive(Debug, Clone, Serialize, Deserialize, Default)]
801#[serde(rename_all = "camelCase")]
802pub struct GlobalLexicalScopeNamesReturns {
803
804 pub names: Vec<String>,
805}
806
807
808#[derive(Debug, Clone, Serialize, Deserialize, Default)]
809#[serde(rename_all = "camelCase")]
810pub struct QueryObjectsParams {
811 /// Identifier of the prototype to return objects for.
812
813 pub prototypeObjectId: RemoteObjectId,
814 /// Symbolic group name that can be used to release the results.
815
816 #[serde(skip_serializing_if = "Option::is_none")]
817 pub objectGroup: Option<String>,
818}
819
820
821#[derive(Debug, Clone, Serialize, Deserialize, Default)]
822#[serde(rename_all = "camelCase")]
823pub struct QueryObjectsReturns {
824 /// Array with objects.
825
826 pub objects: RemoteObject,
827}
828
829/// Releases remote object with given id.
830
831#[derive(Debug, Clone, Serialize, Deserialize, Default)]
832#[serde(rename_all = "camelCase")]
833pub struct ReleaseObjectParams {
834 /// Identifier of the object to release.
835
836 pub objectId: RemoteObjectId,
837}
838
839/// Releases all remote objects that belong to a given group.
840
841#[derive(Debug, Clone, Serialize, Deserialize, Default)]
842#[serde(rename_all = "camelCase")]
843pub struct ReleaseObjectGroupParams {
844 /// Symbolic object group name.
845
846 pub objectGroup: String,
847}
848
849/// Runs script with given id in a given context.
850
851#[derive(Debug, Clone, Serialize, Deserialize, Default)]
852#[serde(rename_all = "camelCase")]
853pub struct RunScriptParams {
854 /// Id of the script to run.
855
856 pub scriptId: ScriptId,
857 /// Specifies in which execution context to perform script run. If the parameter is omitted the
858 /// evaluation will be performed in the context of the inspected page.
859
860 #[serde(skip_serializing_if = "Option::is_none")]
861 pub executionContextId: Option<ExecutionContextId>,
862 /// Symbolic group name that can be used to release multiple objects.
863
864 #[serde(skip_serializing_if = "Option::is_none")]
865 pub objectGroup: Option<String>,
866 /// In silent mode exceptions thrown during evaluation are not reported and do not pause
867 /// execution. Overrides 'setPauseOnException' state.
868
869 #[serde(skip_serializing_if = "Option::is_none")]
870 pub silent: Option<bool>,
871 /// Determines whether Command Line API should be available during the evaluation.
872
873 #[serde(skip_serializing_if = "Option::is_none")]
874 pub includeCommandLineAPI: Option<bool>,
875 /// Whether the result is expected to be a JSON object which should be sent by value.
876
877 #[serde(skip_serializing_if = "Option::is_none")]
878 pub returnByValue: Option<bool>,
879 /// Whether preview should be generated for the result.
880
881 #[serde(skip_serializing_if = "Option::is_none")]
882 pub generatePreview: Option<bool>,
883 /// Whether execution should 'await' for resulting value and return once awaited promise is
884 /// resolved.
885
886 #[serde(skip_serializing_if = "Option::is_none")]
887 pub awaitPromise: Option<bool>,
888}
889
890/// Runs script with given id in a given context.
891
892#[derive(Debug, Clone, Serialize, Deserialize, Default)]
893#[serde(rename_all = "camelCase")]
894pub struct RunScriptReturns {
895 /// Run result.
896
897 pub result: RemoteObject,
898 /// Exception details.
899
900 #[serde(skip_serializing_if = "Option::is_none")]
901 pub exceptionDetails: Option<ExceptionDetails>,
902}
903
904/// Enables or disables async call stacks tracking.
905
906#[derive(Debug, Clone, Serialize, Deserialize, Default)]
907#[serde(rename_all = "camelCase")]
908pub struct SetAsyncCallStackDepthParams {
909 /// Maximum depth of async call stacks. Setting to '0' will effectively disable collecting async
910 /// call stacks (default).
911
912 pub maxDepth: i64,
913}
914
915
916#[derive(Debug, Clone, Serialize, Deserialize, Default)]
917#[serde(rename_all = "camelCase")]
918pub struct SetCustomObjectFormatterEnabledParams {
919
920 pub enabled: bool,
921}
922
923
924#[derive(Debug, Clone, Serialize, Deserialize, Default)]
925#[serde(rename_all = "camelCase")]
926pub struct SetMaxCallStackSizeToCaptureParams {
927
928 pub size: u64,
929}
930
931/// If executionContextId is empty, adds binding with the given name on the
932/// global objects of all inspected contexts, including those created later,
933/// bindings survive reloads.
934/// Binding function takes exactly one argument, this argument should be string,
935/// in case of any other input, function throws an exception.
936/// Each binding function call produces Runtime.bindingCalled notification.
937
938#[derive(Debug, Clone, Serialize, Deserialize, Default)]
939#[serde(rename_all = "camelCase")]
940pub struct AddBindingParams {
941
942 pub name: String,
943 /// If specified, the binding would only be exposed to the specified
944 /// execution context. If omitted and 'executionContextName' is not set,
945 /// the binding is exposed to all execution contexts of the target.
946 /// This parameter is mutually exclusive with 'executionContextName'.
947 /// Deprecated in favor of 'executionContextName' due to an unclear use case
948 /// and bugs in implementation (crbug.com/1169639). 'executionContextId' will be
949 /// removed in the future.
950
951 #[serde(skip_serializing_if = "Option::is_none")]
952 pub executionContextId: Option<ExecutionContextId>,
953 /// If specified, the binding is exposed to the executionContext with
954 /// matching name, even for contexts created after the binding is added.
955 /// See also 'ExecutionContext.name' and 'worldName' parameter to
956 /// 'Page.addScriptToEvaluateOnNewDocument'.
957 /// This parameter is mutually exclusive with 'executionContextId'.
958
959 #[serde(skip_serializing_if = "Option::is_none")]
960 pub executionContextName: Option<String>,
961}
962
963/// This method does not remove binding function from global object but
964/// unsubscribes current runtime agent from Runtime.bindingCalled notifications.
965
966#[derive(Debug, Clone, Serialize, Deserialize, Default)]
967#[serde(rename_all = "camelCase")]
968pub struct RemoveBindingParams {
969
970 pub name: String,
971}
972
973/// This method tries to lookup and populate exception details for a
974/// JavaScript Error object.
975/// Note that the stackTrace portion of the resulting exceptionDetails will
976/// only be populated if the Runtime domain was enabled at the time when the
977/// Error was thrown.
978
979#[derive(Debug, Clone, Serialize, Deserialize, Default)]
980#[serde(rename_all = "camelCase")]
981pub struct GetExceptionDetailsParams {
982 /// The error object for which to resolve the exception details.
983
984 pub errorObjectId: RemoteObjectId,
985}
986
987/// This method tries to lookup and populate exception details for a
988/// JavaScript Error object.
989/// Note that the stackTrace portion of the resulting exceptionDetails will
990/// only be populated if the Runtime domain was enabled at the time when the
991/// Error was thrown.
992
993#[derive(Debug, Clone, Serialize, Deserialize, Default)]
994#[serde(rename_all = "camelCase")]
995pub struct GetExceptionDetailsReturns {
996
997 #[serde(skip_serializing_if = "Option::is_none")]
998 pub exceptionDetails: Option<ExceptionDetails>,
999}