Skip to main content

cdp_driver/protocol/
runtime.rs

1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! Runtime domain exposes JavaScript runtime by means of remote evaluation
5//! and mirror objects. Evaluation results are returned as mirror object that
6//! expose object type, string representation and unique identifier that can
7//! be used for further object reference. Original objects are maintained in
8//! memory unless they are either explicitly released or are released along
9//! with the other objects in their object group.
10//!
11//! Types, command parameters and event payloads for the `Runtime`
12//! domain. The method-name constants for the same domain are in
13//! [`crate::methods`].
14
15use serde::{Deserialize, Serialize};
16
17/// Unique script identifier.
18pub type ScriptId = String;
19
20/// Represents options for serialization. Overrides `generatePreview` and
21/// `returnByValue`.
22#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
23pub struct SerializationOptions {
24    pub serialization: SerializationOptionsSerialization,
25    /// Deep serialization depth. Default is full depth. Respected only in `deep`
26    /// serialization mode.
27    #[serde(rename = "maxDepth", default, skip_serializing_if = "Option::is_none")]
28    pub max_depth: Option<i64>,
29    /// Embedder-specific parameters. For example if connected to V8 in Chrome
30    /// these control DOM serialization via `maxNodeDepth: integer` and
31    /// `includeShadowTree: "none" | "open" | "all"`. Values can be only of type
32    /// string or integer.
33    #[serde(
34        rename = "additionalParameters",
35        default,
36        skip_serializing_if = "Option::is_none"
37    )]
38    pub additional_parameters: Option<serde_json::Value>,
39}
40
41/// The values `serialization` accepts on `SerializationOptions`.
42#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
43pub enum SerializationOptionsSerialization {
44    /// `deep`
45    #[serde(rename = "deep")]
46    Deep,
47    /// `json`
48    #[serde(rename = "json")]
49    Json,
50    /// `idOnly`
51    #[serde(rename = "idOnly")]
52    IdOnly,
53    /// A value this vendored schema does not list. Chrome adds values ahead of
54    /// the published protocol, so an unrecognised one is kept as it arrived
55    /// rather than failing the payload it came in.
56    #[serde(untagged)]
57    Unrecognized(String),
58}
59
60/// Represents deep serialized value.
61#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
62pub struct DeepSerializedValue {
63    pub r#type: DeepSerializedValueType,
64    #[serde(default, skip_serializing_if = "Option::is_none")]
65    pub value: Option<serde_json::Value>,
66    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
67    pub object_id: Option<String>,
68    /// Set if value reference met more then once during serialization. In such
69    /// case, value is provided only to one of the serialized values. Unique per
70    /// value in the scope of one CDP call.
71    #[serde(
72        rename = "weakLocalObjectReference",
73        default,
74        skip_serializing_if = "Option::is_none"
75    )]
76    pub weak_local_object_reference: Option<i64>,
77}
78
79/// The values `type` accepts on `DeepSerializedValue`.
80#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
81pub enum DeepSerializedValueType {
82    /// `undefined`
83    #[serde(rename = "undefined")]
84    Undefined,
85    /// `null`
86    #[serde(rename = "null")]
87    Null,
88    /// `string`
89    #[serde(rename = "string")]
90    String,
91    /// `number`
92    #[serde(rename = "number")]
93    Number,
94    /// `boolean`
95    #[serde(rename = "boolean")]
96    Boolean,
97    /// `bigint`
98    #[serde(rename = "bigint")]
99    Bigint,
100    /// `regexp`
101    #[serde(rename = "regexp")]
102    Regexp,
103    /// `date`
104    #[serde(rename = "date")]
105    Date,
106    /// `symbol`
107    #[serde(rename = "symbol")]
108    Symbol,
109    /// `array`
110    #[serde(rename = "array")]
111    Array,
112    /// `object`
113    #[serde(rename = "object")]
114    Object,
115    /// `function`
116    #[serde(rename = "function")]
117    Function,
118    /// `map`
119    #[serde(rename = "map")]
120    Map,
121    /// `set`
122    #[serde(rename = "set")]
123    Set,
124    /// `weakmap`
125    #[serde(rename = "weakmap")]
126    Weakmap,
127    /// `weakset`
128    #[serde(rename = "weakset")]
129    Weakset,
130    /// `error`
131    #[serde(rename = "error")]
132    Error,
133    /// `proxy`
134    #[serde(rename = "proxy")]
135    Proxy,
136    /// `promise`
137    #[serde(rename = "promise")]
138    Promise,
139    /// `typedarray`
140    #[serde(rename = "typedarray")]
141    Typedarray,
142    /// `arraybuffer`
143    #[serde(rename = "arraybuffer")]
144    Arraybuffer,
145    /// `node`
146    #[serde(rename = "node")]
147    Node,
148    /// `window`
149    #[serde(rename = "window")]
150    Window,
151    /// `generator`
152    #[serde(rename = "generator")]
153    Generator,
154    /// A value this vendored schema does not list. Chrome adds values ahead of
155    /// the published protocol, so an unrecognised one is kept as it arrived
156    /// rather than failing the payload it came in.
157    #[serde(untagged)]
158    Unrecognized(String),
159}
160
161/// Unique object identifier.
162pub type RemoteObjectId = String;
163
164/// Primitive value which cannot be JSON-stringified. Includes values `-0`,
165/// `NaN`, `Infinity`, `-Infinity`, and bigint literals.
166pub type UnserializableValue = String;
167
168/// Mirror object referencing original JavaScript object.
169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
170pub struct RemoteObject {
171    /// Object type.
172    pub r#type: RemoteObjectType,
173    /// Object subtype hint. Specified for `object` type values only. NOTE: If you
174    /// change anything here, make sure to also update `subtype` in
175    /// `ObjectPreview` and `PropertyPreview` below.
176    #[serde(default, skip_serializing_if = "Option::is_none")]
177    pub subtype: Option<RemoteObjectSubtype>,
178    /// Object class (constructor) name. Specified for `object` type values only.
179    #[serde(rename = "className", default, skip_serializing_if = "Option::is_none")]
180    pub class_name: Option<String>,
181    /// Remote object value in case of primitive values or JSON values (if it was
182    /// requested).
183    #[serde(default, skip_serializing_if = "Option::is_none")]
184    pub value: Option<serde_json::Value>,
185    /// Primitive value which can not be JSON-stringified does not have `value`,
186    /// but gets this property.
187    #[serde(
188        rename = "unserializableValue",
189        default,
190        skip_serializing_if = "Option::is_none"
191    )]
192    pub unserializable_value: Option<UnserializableValue>,
193    /// String representation of the object.
194    #[serde(default, skip_serializing_if = "Option::is_none")]
195    pub description: Option<String>,
196    /// Deep serialized value.
197    ///
198    /// Experimental: may change without notice.
199    #[serde(
200        rename = "deepSerializedValue",
201        default,
202        skip_serializing_if = "Option::is_none"
203    )]
204    pub deep_serialized_value: Option<DeepSerializedValue>,
205    /// Unique object identifier (for non-primitive values).
206    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
207    pub object_id: Option<RemoteObjectId>,
208    /// Preview containing abbreviated property values. Specified for `object`
209    /// type values only.
210    ///
211    /// Experimental: may change without notice.
212    #[serde(default, skip_serializing_if = "Option::is_none")]
213    pub preview: Option<ObjectPreview>,
214    /// Experimental: may change without notice.
215    #[serde(
216        rename = "customPreview",
217        default,
218        skip_serializing_if = "Option::is_none"
219    )]
220    pub custom_preview: Option<CustomPreview>,
221}
222
223/// The values `type` accepts on `RemoteObject`.
224#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
225pub enum RemoteObjectType {
226    /// `object`
227    #[serde(rename = "object")]
228    Object,
229    /// `function`
230    #[serde(rename = "function")]
231    Function,
232    /// `undefined`
233    #[serde(rename = "undefined")]
234    Undefined,
235    /// `string`
236    #[serde(rename = "string")]
237    String,
238    /// `number`
239    #[serde(rename = "number")]
240    Number,
241    /// `boolean`
242    #[serde(rename = "boolean")]
243    Boolean,
244    /// `symbol`
245    #[serde(rename = "symbol")]
246    Symbol,
247    /// `bigint`
248    #[serde(rename = "bigint")]
249    Bigint,
250    /// A value this vendored schema does not list. Chrome adds values ahead of
251    /// the published protocol, so an unrecognised one is kept as it arrived
252    /// rather than failing the payload it came in.
253    #[serde(untagged)]
254    Unrecognized(String),
255}
256
257/// The values `subtype` accepts on `RemoteObject`.
258#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
259pub enum RemoteObjectSubtype {
260    /// `array`
261    #[serde(rename = "array")]
262    Array,
263    /// `null`
264    #[serde(rename = "null")]
265    Null,
266    /// `node`
267    #[serde(rename = "node")]
268    Node,
269    /// `regexp`
270    #[serde(rename = "regexp")]
271    Regexp,
272    /// `date`
273    #[serde(rename = "date")]
274    Date,
275    /// `map`
276    #[serde(rename = "map")]
277    Map,
278    /// `set`
279    #[serde(rename = "set")]
280    Set,
281    /// `weakmap`
282    #[serde(rename = "weakmap")]
283    Weakmap,
284    /// `weakset`
285    #[serde(rename = "weakset")]
286    Weakset,
287    /// `iterator`
288    #[serde(rename = "iterator")]
289    Iterator,
290    /// `generator`
291    #[serde(rename = "generator")]
292    Generator,
293    /// `error`
294    #[serde(rename = "error")]
295    Error,
296    /// `proxy`
297    #[serde(rename = "proxy")]
298    Proxy,
299    /// `promise`
300    #[serde(rename = "promise")]
301    Promise,
302    /// `typedarray`
303    #[serde(rename = "typedarray")]
304    Typedarray,
305    /// `arraybuffer`
306    #[serde(rename = "arraybuffer")]
307    Arraybuffer,
308    /// `dataview`
309    #[serde(rename = "dataview")]
310    Dataview,
311    /// `webassemblymemory`
312    #[serde(rename = "webassemblymemory")]
313    Webassemblymemory,
314    /// `wasmvalue`
315    #[serde(rename = "wasmvalue")]
316    Wasmvalue,
317    /// `deferredmodule`
318    #[serde(rename = "deferredmodule")]
319    Deferredmodule,
320    /// `trustedtype`
321    #[serde(rename = "trustedtype")]
322    Trustedtype,
323    /// A value this vendored schema does not list. Chrome adds values ahead of
324    /// the published protocol, so an unrecognised one is kept as it arrived
325    /// rather than failing the payload it came in.
326    #[serde(untagged)]
327    Unrecognized(String),
328}
329
330/// Experimental: may change without notice.
331#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
332pub struct CustomPreview {
333    /// The JSON-stringified result of formatter.header(object, config) call. It
334    /// contains json ML array that represents RemoteObject.
335    pub header: String,
336    /// If formatter returns true as a result of formatter.hasBody call then
337    /// bodyGetterId will contain RemoteObjectId for the function that returns
338    /// result of formatter.body(object, config) call. The result value is json ML
339    /// array.
340    #[serde(
341        rename = "bodyGetterId",
342        default,
343        skip_serializing_if = "Option::is_none"
344    )]
345    pub body_getter_id: Option<RemoteObjectId>,
346}
347
348/// Object containing abbreviated remote object value.
349///
350/// Experimental: may change without notice.
351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
352pub struct ObjectPreview {
353    /// Object type.
354    pub r#type: ObjectPreviewType,
355    /// Object subtype hint. Specified for `object` type values only.
356    #[serde(default, skip_serializing_if = "Option::is_none")]
357    pub subtype: Option<ObjectPreviewSubtype>,
358    /// String representation of the object.
359    #[serde(default, skip_serializing_if = "Option::is_none")]
360    pub description: Option<String>,
361    /// True iff some of the properties or entries of the original object did not
362    /// fit.
363    pub overflow: bool,
364    /// List of the properties.
365    pub properties: Vec<PropertyPreview>,
366    /// List of the entries. Specified for `map` and `set` subtype values only.
367    #[serde(default, skip_serializing_if = "Option::is_none")]
368    pub entries: Option<Vec<EntryPreview>>,
369}
370
371/// The values `type` accepts on `ObjectPreview`.
372#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
373pub enum ObjectPreviewType {
374    /// `object`
375    #[serde(rename = "object")]
376    Object,
377    /// `function`
378    #[serde(rename = "function")]
379    Function,
380    /// `undefined`
381    #[serde(rename = "undefined")]
382    Undefined,
383    /// `string`
384    #[serde(rename = "string")]
385    String,
386    /// `number`
387    #[serde(rename = "number")]
388    Number,
389    /// `boolean`
390    #[serde(rename = "boolean")]
391    Boolean,
392    /// `symbol`
393    #[serde(rename = "symbol")]
394    Symbol,
395    /// `bigint`
396    #[serde(rename = "bigint")]
397    Bigint,
398    /// A value this vendored schema does not list. Chrome adds values ahead of
399    /// the published protocol, so an unrecognised one is kept as it arrived
400    /// rather than failing the payload it came in.
401    #[serde(untagged)]
402    Unrecognized(String),
403}
404
405/// The values `subtype` accepts on `ObjectPreview`.
406#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
407pub enum ObjectPreviewSubtype {
408    /// `array`
409    #[serde(rename = "array")]
410    Array,
411    /// `null`
412    #[serde(rename = "null")]
413    Null,
414    /// `node`
415    #[serde(rename = "node")]
416    Node,
417    /// `regexp`
418    #[serde(rename = "regexp")]
419    Regexp,
420    /// `date`
421    #[serde(rename = "date")]
422    Date,
423    /// `map`
424    #[serde(rename = "map")]
425    Map,
426    /// `set`
427    #[serde(rename = "set")]
428    Set,
429    /// `weakmap`
430    #[serde(rename = "weakmap")]
431    Weakmap,
432    /// `weakset`
433    #[serde(rename = "weakset")]
434    Weakset,
435    /// `iterator`
436    #[serde(rename = "iterator")]
437    Iterator,
438    /// `generator`
439    #[serde(rename = "generator")]
440    Generator,
441    /// `error`
442    #[serde(rename = "error")]
443    Error,
444    /// `proxy`
445    #[serde(rename = "proxy")]
446    Proxy,
447    /// `promise`
448    #[serde(rename = "promise")]
449    Promise,
450    /// `typedarray`
451    #[serde(rename = "typedarray")]
452    Typedarray,
453    /// `arraybuffer`
454    #[serde(rename = "arraybuffer")]
455    Arraybuffer,
456    /// `dataview`
457    #[serde(rename = "dataview")]
458    Dataview,
459    /// `webassemblymemory`
460    #[serde(rename = "webassemblymemory")]
461    Webassemblymemory,
462    /// `wasmvalue`
463    #[serde(rename = "wasmvalue")]
464    Wasmvalue,
465    /// `deferredmodule`
466    #[serde(rename = "deferredmodule")]
467    Deferredmodule,
468    /// `trustedtype`
469    #[serde(rename = "trustedtype")]
470    Trustedtype,
471    /// A value this vendored schema does not list. Chrome adds values ahead of
472    /// the published protocol, so an unrecognised one is kept as it arrived
473    /// rather than failing the payload it came in.
474    #[serde(untagged)]
475    Unrecognized(String),
476}
477
478/// Experimental: may change without notice.
479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
480pub struct PropertyPreview {
481    /// Property name.
482    pub name: String,
483    /// Object type. Accessor means that the property itself is an accessor
484    /// property.
485    pub r#type: PropertyPreviewType,
486    /// User-friendly property value string.
487    #[serde(default, skip_serializing_if = "Option::is_none")]
488    pub value: Option<String>,
489    /// Nested value preview.
490    #[serde(
491        rename = "valuePreview",
492        default,
493        skip_serializing_if = "Option::is_none"
494    )]
495    pub value_preview: Option<ObjectPreview>,
496    /// Object subtype hint. Specified for `object` type values only.
497    #[serde(default, skip_serializing_if = "Option::is_none")]
498    pub subtype: Option<PropertyPreviewSubtype>,
499}
500
501/// The values `type` accepts on `PropertyPreview`.
502#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
503pub enum PropertyPreviewType {
504    /// `object`
505    #[serde(rename = "object")]
506    Object,
507    /// `function`
508    #[serde(rename = "function")]
509    Function,
510    /// `undefined`
511    #[serde(rename = "undefined")]
512    Undefined,
513    /// `string`
514    #[serde(rename = "string")]
515    String,
516    /// `number`
517    #[serde(rename = "number")]
518    Number,
519    /// `boolean`
520    #[serde(rename = "boolean")]
521    Boolean,
522    /// `symbol`
523    #[serde(rename = "symbol")]
524    Symbol,
525    /// `accessor`
526    #[serde(rename = "accessor")]
527    Accessor,
528    /// `bigint`
529    #[serde(rename = "bigint")]
530    Bigint,
531    /// A value this vendored schema does not list. Chrome adds values ahead of
532    /// the published protocol, so an unrecognised one is kept as it arrived
533    /// rather than failing the payload it came in.
534    #[serde(untagged)]
535    Unrecognized(String),
536}
537
538/// The values `subtype` accepts on `PropertyPreview`.
539#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
540pub enum PropertyPreviewSubtype {
541    /// `array`
542    #[serde(rename = "array")]
543    Array,
544    /// `null`
545    #[serde(rename = "null")]
546    Null,
547    /// `node`
548    #[serde(rename = "node")]
549    Node,
550    /// `regexp`
551    #[serde(rename = "regexp")]
552    Regexp,
553    /// `date`
554    #[serde(rename = "date")]
555    Date,
556    /// `map`
557    #[serde(rename = "map")]
558    Map,
559    /// `set`
560    #[serde(rename = "set")]
561    Set,
562    /// `weakmap`
563    #[serde(rename = "weakmap")]
564    Weakmap,
565    /// `weakset`
566    #[serde(rename = "weakset")]
567    Weakset,
568    /// `iterator`
569    #[serde(rename = "iterator")]
570    Iterator,
571    /// `generator`
572    #[serde(rename = "generator")]
573    Generator,
574    /// `error`
575    #[serde(rename = "error")]
576    Error,
577    /// `proxy`
578    #[serde(rename = "proxy")]
579    Proxy,
580    /// `promise`
581    #[serde(rename = "promise")]
582    Promise,
583    /// `typedarray`
584    #[serde(rename = "typedarray")]
585    Typedarray,
586    /// `arraybuffer`
587    #[serde(rename = "arraybuffer")]
588    Arraybuffer,
589    /// `dataview`
590    #[serde(rename = "dataview")]
591    Dataview,
592    /// `webassemblymemory`
593    #[serde(rename = "webassemblymemory")]
594    Webassemblymemory,
595    /// `wasmvalue`
596    #[serde(rename = "wasmvalue")]
597    Wasmvalue,
598    /// `deferredmodule`
599    #[serde(rename = "deferredmodule")]
600    Deferredmodule,
601    /// `trustedtype`
602    #[serde(rename = "trustedtype")]
603    Trustedtype,
604    /// A value this vendored schema does not list. Chrome adds values ahead of
605    /// the published protocol, so an unrecognised one is kept as it arrived
606    /// rather than failing the payload it came in.
607    #[serde(untagged)]
608    Unrecognized(String),
609}
610
611/// Experimental: may change without notice.
612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
613pub struct EntryPreview {
614    /// Preview of the key. Specified for map-like collection entries.
615    #[serde(default, skip_serializing_if = "Option::is_none")]
616    pub key: Option<ObjectPreview>,
617    /// Preview of the value.
618    pub value: ObjectPreview,
619}
620
621/// Object property descriptor.
622#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
623pub struct PropertyDescriptor {
624    /// Property name or symbol description.
625    pub name: String,
626    /// The value associated with the property.
627    #[serde(default, skip_serializing_if = "Option::is_none")]
628    pub value: Option<RemoteObject>,
629    /// True if the value associated with the property may be changed (data
630    /// descriptors only).
631    #[serde(default, skip_serializing_if = "Option::is_none")]
632    pub writable: Option<bool>,
633    /// A function which serves as a getter for the property, or `undefined` if
634    /// there is no getter (accessor descriptors only).
635    #[serde(default, skip_serializing_if = "Option::is_none")]
636    pub get: Option<RemoteObject>,
637    /// A function which serves as a setter for the property, or `undefined` if
638    /// there is no setter (accessor descriptors only).
639    #[serde(default, skip_serializing_if = "Option::is_none")]
640    pub set: Option<RemoteObject>,
641    /// True if the type of this property descriptor may be changed and if the
642    /// property may be deleted from the corresponding object.
643    pub configurable: bool,
644    /// True if this property shows up during enumeration of the properties on the
645    /// corresponding object.
646    pub enumerable: bool,
647    /// True if the result was thrown during the evaluation.
648    #[serde(rename = "wasThrown", default, skip_serializing_if = "Option::is_none")]
649    pub was_thrown: Option<bool>,
650    /// True if the property is owned for the object.
651    #[serde(rename = "isOwn", default, skip_serializing_if = "Option::is_none")]
652    pub is_own: Option<bool>,
653    /// Property symbol object, if the property is of the `symbol` type.
654    #[serde(default, skip_serializing_if = "Option::is_none")]
655    pub symbol: Option<RemoteObject>,
656}
657
658/// Object internal property descriptor. This property isn't normally visible
659/// in JavaScript code.
660#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
661pub struct InternalPropertyDescriptor {
662    /// Conventional property name.
663    pub name: String,
664    /// The value associated with the property.
665    #[serde(default, skip_serializing_if = "Option::is_none")]
666    pub value: Option<RemoteObject>,
667}
668
669/// Object private field descriptor.
670///
671/// Experimental: may change without notice.
672#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
673pub struct PrivatePropertyDescriptor {
674    /// Private property name.
675    pub name: String,
676    /// The value associated with the private property.
677    #[serde(default, skip_serializing_if = "Option::is_none")]
678    pub value: Option<RemoteObject>,
679    /// A function which serves as a getter for the private property, or
680    /// `undefined` if there is no getter (accessor descriptors only).
681    #[serde(default, skip_serializing_if = "Option::is_none")]
682    pub get: Option<RemoteObject>,
683    /// A function which serves as a setter for the private property, or
684    /// `undefined` if there is no setter (accessor descriptors only).
685    #[serde(default, skip_serializing_if = "Option::is_none")]
686    pub set: Option<RemoteObject>,
687}
688
689/// Represents function call argument. Either remote object id `objectId`,
690/// primitive `value`, unserializable primitive value or neither of (for
691/// undefined) them should be specified.
692#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
693pub struct CallArgument {
694    /// Primitive value or serializable javascript object.
695    #[serde(default, skip_serializing_if = "Option::is_none")]
696    pub value: Option<serde_json::Value>,
697    /// Primitive value which can not be JSON-stringified.
698    #[serde(
699        rename = "unserializableValue",
700        default,
701        skip_serializing_if = "Option::is_none"
702    )]
703    pub unserializable_value: Option<UnserializableValue>,
704    /// Remote object handle.
705    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
706    pub object_id: Option<RemoteObjectId>,
707}
708
709/// Id of an execution context.
710pub type ExecutionContextId = i64;
711
712/// Description of an isolated world.
713#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
714pub struct ExecutionContextDescription {
715    /// Unique id of the execution context. It can be used to specify in which
716    /// execution context script evaluation should be performed.
717    pub id: ExecutionContextId,
718    /// Execution context origin.
719    pub origin: String,
720    /// Human readable name describing given context.
721    pub name: String,
722    /// A system-unique execution context identifier. Unlike the id, this is
723    /// unique across multiple processes, so can be reliably used to identify
724    /// specific context while backend performs a cross-process navigation.
725    ///
726    /// Experimental: may change without notice.
727    #[serde(rename = "uniqueId")]
728    pub unique_id: String,
729    /// Embedder-specific auxiliary data likely matching {isDefault: boolean,
730    /// type: 'default'|'isolated'|'worker', frameId: string}
731    #[serde(rename = "auxData", default, skip_serializing_if = "Option::is_none")]
732    pub aux_data: Option<serde_json::Value>,
733}
734
735/// Detailed information about exception (or error) that was thrown during
736/// script compilation or execution.
737#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
738pub struct ExceptionDetails {
739    /// Exception id.
740    #[serde(rename = "exceptionId")]
741    pub exception_id: i64,
742    /// Exception text, which should be used together with exception object when
743    /// available.
744    pub text: String,
745    /// Line number of the exception location (0-based).
746    #[serde(rename = "lineNumber")]
747    pub line_number: i64,
748    /// Column number of the exception location (0-based).
749    #[serde(rename = "columnNumber")]
750    pub column_number: i64,
751    /// Script ID of the exception location.
752    #[serde(rename = "scriptId", default, skip_serializing_if = "Option::is_none")]
753    pub script_id: Option<ScriptId>,
754    /// URL of the exception location, to be used when the script was not
755    /// reported.
756    #[serde(default, skip_serializing_if = "Option::is_none")]
757    pub url: Option<String>,
758    /// JavaScript stack trace if available.
759    #[serde(
760        rename = "stackTrace",
761        default,
762        skip_serializing_if = "Option::is_none"
763    )]
764    pub stack_trace: Option<StackTrace>,
765    /// Exception object if available.
766    #[serde(default, skip_serializing_if = "Option::is_none")]
767    pub exception: Option<RemoteObject>,
768    /// Identifier of the context where exception happened.
769    #[serde(
770        rename = "executionContextId",
771        default,
772        skip_serializing_if = "Option::is_none"
773    )]
774    pub execution_context_id: Option<ExecutionContextId>,
775    /// Dictionary with entries of meta data that the client associated with this
776    /// exception, such as information about associated network requests, etc.
777    ///
778    /// Experimental: may change without notice.
779    #[serde(
780        rename = "exceptionMetaData",
781        default,
782        skip_serializing_if = "Option::is_none"
783    )]
784    pub exception_meta_data: Option<serde_json::Value>,
785}
786
787/// Number of milliseconds since epoch.
788pub type Timestamp = f64;
789
790/// Number of milliseconds.
791pub type TimeDelta = f64;
792
793/// Stack entry for runtime errors and assertions.
794#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
795pub struct CallFrame {
796    /// JavaScript function name.
797    #[serde(rename = "functionName")]
798    pub function_name: String,
799    /// JavaScript script id.
800    #[serde(rename = "scriptId")]
801    pub script_id: ScriptId,
802    /// JavaScript script name or url.
803    pub url: String,
804    /// JavaScript script line number (0-based).
805    #[serde(rename = "lineNumber")]
806    pub line_number: i64,
807    /// JavaScript script column number (0-based).
808    #[serde(rename = "columnNumber")]
809    pub column_number: i64,
810}
811
812/// Call frames for assertions or error messages.
813#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
814pub struct StackTrace {
815    /// String label of this stack trace. For async traces this may be a name of
816    /// the function that initiated the async call.
817    #[serde(default, skip_serializing_if = "Option::is_none")]
818    pub description: Option<String>,
819    /// JavaScript function name.
820    #[serde(rename = "callFrames")]
821    pub call_frames: Vec<CallFrame>,
822    /// Asynchronous JavaScript stack trace that preceded this stack, if
823    /// available.
824    #[serde(default, skip_serializing_if = "Option::is_none")]
825    pub parent: Option<Box<StackTrace>>,
826    /// Asynchronous JavaScript stack trace that preceded this stack, if
827    /// available.
828    ///
829    /// Experimental: may change without notice.
830    #[serde(rename = "parentId", default, skip_serializing_if = "Option::is_none")]
831    pub parent_id: Option<StackTraceId>,
832}
833
834/// Unique identifier of current debugger.
835///
836/// Experimental: may change without notice.
837pub type UniqueDebuggerId = String;
838
839/// If `debuggerId` is set stack trace comes from another debugger and can be
840/// resolved there. This allows to track cross-debugger calls. See
841/// `Runtime.StackTrace` and `Debugger.paused` for usages.
842///
843/// Experimental: may change without notice.
844#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
845pub struct StackTraceId {
846    pub id: String,
847    #[serde(
848        rename = "debuggerId",
849        default,
850        skip_serializing_if = "Option::is_none"
851    )]
852    pub debugger_id: Option<UniqueDebuggerId>,
853}
854
855/// Add handler to promise with given promise object id.
856///
857/// Parameters of `Runtime.awaitPromise`.
858#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
859pub struct AwaitPromiseParams {
860    /// Identifier of the promise.
861    #[serde(rename = "promiseObjectId")]
862    pub promise_object_id: RemoteObjectId,
863    /// Whether the result is expected to be a JSON object that should be sent by
864    /// value.
865    #[serde(
866        rename = "returnByValue",
867        default,
868        skip_serializing_if = "Option::is_none"
869    )]
870    pub return_by_value: Option<bool>,
871    /// Whether preview should be generated for the result.
872    #[serde(
873        rename = "generatePreview",
874        default,
875        skip_serializing_if = "Option::is_none"
876    )]
877    pub generate_preview: Option<bool>,
878}
879
880/// What `Runtime.awaitPromise` answers with.
881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
882pub struct AwaitPromiseReturns {
883    /// Promise result. Will contain rejected value if promise was rejected.
884    pub result: RemoteObject,
885    /// Exception details if stack strace is available.
886    #[serde(
887        rename = "exceptionDetails",
888        default,
889        skip_serializing_if = "Option::is_none"
890    )]
891    pub exception_details: Option<ExceptionDetails>,
892}
893
894impl crate::typed::Command for AwaitPromiseParams {
895    const METHOD: &'static str = "Runtime.awaitPromise";
896    type Returns = AwaitPromiseReturns;
897}
898
899/// Calls function with given declaration on the given object. Object group of
900/// the result is inherited from the target object.
901///
902/// Parameters of `Runtime.callFunctionOn`.
903#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
904pub struct CallFunctionOnParams {
905    /// Declaration of the function to call.
906    #[serde(rename = "functionDeclaration")]
907    pub function_declaration: String,
908    /// Identifier of the object to call function on. Either objectId or
909    /// executionContextId should be specified.
910    #[serde(rename = "objectId", default, skip_serializing_if = "Option::is_none")]
911    pub object_id: Option<RemoteObjectId>,
912    /// Call arguments. All call arguments must belong to the same JavaScript
913    /// world as the target object.
914    #[serde(default, skip_serializing_if = "Option::is_none")]
915    pub arguments: Option<Vec<CallArgument>>,
916    /// In silent mode exceptions thrown during evaluation are not reported and do
917    /// not pause execution. Overrides `setPauseOnException` state.
918    #[serde(default, skip_serializing_if = "Option::is_none")]
919    pub silent: Option<bool>,
920    /// Whether the result is expected to be a JSON object which should be sent by
921    /// value. Can be overriden by `serializationOptions`.
922    #[serde(
923        rename = "returnByValue",
924        default,
925        skip_serializing_if = "Option::is_none"
926    )]
927    pub return_by_value: Option<bool>,
928    /// Whether preview should be generated for the result.
929    ///
930    /// Experimental: may change without notice.
931    #[serde(
932        rename = "generatePreview",
933        default,
934        skip_serializing_if = "Option::is_none"
935    )]
936    pub generate_preview: Option<bool>,
937    /// Whether execution should be treated as initiated by user in the UI.
938    #[serde(
939        rename = "userGesture",
940        default,
941        skip_serializing_if = "Option::is_none"
942    )]
943    pub user_gesture: Option<bool>,
944    /// Whether execution should `await` for resulting value and return once
945    /// awaited promise is resolved.
946    #[serde(
947        rename = "awaitPromise",
948        default,
949        skip_serializing_if = "Option::is_none"
950    )]
951    pub await_promise: Option<bool>,
952    /// Specifies execution context which global object will be used to call
953    /// function on. Either executionContextId or objectId should be specified.
954    #[serde(
955        rename = "executionContextId",
956        default,
957        skip_serializing_if = "Option::is_none"
958    )]
959    pub execution_context_id: Option<ExecutionContextId>,
960    /// Symbolic group name that can be used to release multiple objects. If
961    /// objectGroup is not specified and objectId is, objectGroup will be
962    /// inherited from object.
963    #[serde(
964        rename = "objectGroup",
965        default,
966        skip_serializing_if = "Option::is_none"
967    )]
968    pub object_group: Option<String>,
969    /// Whether to throw an exception if side effect cannot be ruled out during
970    /// evaluation.
971    ///
972    /// Experimental: may change without notice.
973    #[serde(
974        rename = "throwOnSideEffect",
975        default,
976        skip_serializing_if = "Option::is_none"
977    )]
978    pub throw_on_side_effect: Option<bool>,
979    /// An alternative way to specify the execution context to call function on.
980    /// Compared to contextId that may be reused across processes, this is
981    /// guaranteed to be system-unique, so it can be used to prevent accidental
982    /// function call in context different than intended (e.g. as a result of
983    /// navigation across process boundaries). This is mutually exclusive with
984    /// `executionContextId`.
985    ///
986    /// Experimental: may change without notice.
987    #[serde(
988        rename = "uniqueContextId",
989        default,
990        skip_serializing_if = "Option::is_none"
991    )]
992    pub unique_context_id: Option<String>,
993    /// Specifies the result serialization. If provided, overrides
994    /// `generatePreview` and `returnByValue`.
995    ///
996    /// Experimental: may change without notice.
997    #[serde(
998        rename = "serializationOptions",
999        default,
1000        skip_serializing_if = "Option::is_none"
1001    )]
1002    pub serialization_options: Option<SerializationOptions>,
1003}
1004
1005/// What `Runtime.callFunctionOn` answers with.
1006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1007pub struct CallFunctionOnReturns {
1008    /// Call result.
1009    pub result: RemoteObject,
1010    /// Exception details.
1011    #[serde(
1012        rename = "exceptionDetails",
1013        default,
1014        skip_serializing_if = "Option::is_none"
1015    )]
1016    pub exception_details: Option<ExceptionDetails>,
1017}
1018
1019impl crate::typed::Command for CallFunctionOnParams {
1020    const METHOD: &'static str = "Runtime.callFunctionOn";
1021    type Returns = CallFunctionOnReturns;
1022}
1023
1024/// Compiles expression.
1025///
1026/// Parameters of `Runtime.compileScript`.
1027#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1028pub struct CompileScriptParams {
1029    /// Expression to compile.
1030    pub expression: String,
1031    /// Source url to be set for the script.
1032    #[serde(rename = "sourceURL")]
1033    pub source_url: String,
1034    /// Specifies whether the compiled script should be persisted.
1035    #[serde(rename = "persistScript")]
1036    pub persist_script: bool,
1037    /// Specifies in which execution context to perform script run. If the
1038    /// parameter is omitted the evaluation will be performed in the context of
1039    /// the inspected page.
1040    #[serde(
1041        rename = "executionContextId",
1042        default,
1043        skip_serializing_if = "Option::is_none"
1044    )]
1045    pub execution_context_id: Option<ExecutionContextId>,
1046}
1047
1048/// What `Runtime.compileScript` answers with.
1049#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1050pub struct CompileScriptReturns {
1051    /// Id of the script.
1052    #[serde(rename = "scriptId", default, skip_serializing_if = "Option::is_none")]
1053    pub script_id: Option<ScriptId>,
1054    /// Exception details.
1055    #[serde(
1056        rename = "exceptionDetails",
1057        default,
1058        skip_serializing_if = "Option::is_none"
1059    )]
1060    pub exception_details: Option<ExceptionDetails>,
1061}
1062
1063impl crate::typed::Command for CompileScriptParams {
1064    const METHOD: &'static str = "Runtime.compileScript";
1065    type Returns = CompileScriptReturns;
1066}
1067
1068/// Disables reporting of execution contexts creation.
1069///
1070/// Parameters of `Runtime.disable`.
1071#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1072pub struct DisableParams {}
1073
1074impl crate::typed::Command for DisableParams {
1075    const METHOD: &'static str = "Runtime.disable";
1076    type Returns = crate::typed::NoReturns;
1077}
1078
1079/// Discards collected exceptions and console API calls.
1080///
1081/// Parameters of `Runtime.discardConsoleEntries`.
1082#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1083pub struct DiscardConsoleEntriesParams {}
1084
1085impl crate::typed::Command for DiscardConsoleEntriesParams {
1086    const METHOD: &'static str = "Runtime.discardConsoleEntries";
1087    type Returns = crate::typed::NoReturns;
1088}
1089
1090/// Enables reporting of execution contexts creation by means of
1091/// `executionContextCreated` event. When the reporting gets enabled the event
1092/// will be sent immediately for each existing execution context.
1093///
1094/// Parameters of `Runtime.enable`.
1095#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1096pub struct EnableParams {}
1097
1098impl crate::typed::Command for EnableParams {
1099    const METHOD: &'static str = "Runtime.enable";
1100    type Returns = crate::typed::NoReturns;
1101}
1102
1103/// Evaluates expression on global object.
1104///
1105/// Parameters of `Runtime.evaluate`.
1106#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1107pub struct EvaluateParams {
1108    /// Expression to evaluate.
1109    pub expression: String,
1110    /// Symbolic group name that can be used to release multiple objects.
1111    #[serde(
1112        rename = "objectGroup",
1113        default,
1114        skip_serializing_if = "Option::is_none"
1115    )]
1116    pub object_group: Option<String>,
1117    /// Determines whether Command Line API should be available during the
1118    /// evaluation.
1119    #[serde(
1120        rename = "includeCommandLineAPI",
1121        default,
1122        skip_serializing_if = "Option::is_none"
1123    )]
1124    pub include_command_line_api: Option<bool>,
1125    /// In silent mode exceptions thrown during evaluation are not reported and do
1126    /// not pause execution. Overrides `setPauseOnException` state.
1127    #[serde(default, skip_serializing_if = "Option::is_none")]
1128    pub silent: Option<bool>,
1129    /// Specifies in which execution context to perform evaluation. If the
1130    /// parameter is omitted the evaluation will be performed in the context of
1131    /// the inspected page. This is mutually exclusive with `uniqueContextId`,
1132    /// which offers an alternative way to identify the execution context that is
1133    /// more reliable in a multi-process environment.
1134    #[serde(rename = "contextId", default, skip_serializing_if = "Option::is_none")]
1135    pub context_id: Option<ExecutionContextId>,
1136    /// Whether the result is expected to be a JSON object that should be sent by
1137    /// value.
1138    #[serde(
1139        rename = "returnByValue",
1140        default,
1141        skip_serializing_if = "Option::is_none"
1142    )]
1143    pub return_by_value: Option<bool>,
1144    /// Whether preview should be generated for the result.
1145    ///
1146    /// Experimental: may change without notice.
1147    #[serde(
1148        rename = "generatePreview",
1149        default,
1150        skip_serializing_if = "Option::is_none"
1151    )]
1152    pub generate_preview: Option<bool>,
1153    /// Whether execution should be treated as initiated by user in the UI.
1154    #[serde(
1155        rename = "userGesture",
1156        default,
1157        skip_serializing_if = "Option::is_none"
1158    )]
1159    pub user_gesture: Option<bool>,
1160    /// Whether execution should `await` for resulting value and return once
1161    /// awaited promise is resolved.
1162    #[serde(
1163        rename = "awaitPromise",
1164        default,
1165        skip_serializing_if = "Option::is_none"
1166    )]
1167    pub await_promise: Option<bool>,
1168    /// Whether to throw an exception if side effect cannot be ruled out during
1169    /// evaluation. This implies `disableBreaks` below.
1170    ///
1171    /// Experimental: may change without notice.
1172    #[serde(
1173        rename = "throwOnSideEffect",
1174        default,
1175        skip_serializing_if = "Option::is_none"
1176    )]
1177    pub throw_on_side_effect: Option<bool>,
1178    /// Terminate execution after timing out (number of milliseconds).
1179    ///
1180    /// Experimental: may change without notice.
1181    #[serde(default, skip_serializing_if = "Option::is_none")]
1182    pub timeout: Option<TimeDelta>,
1183    /// Disable breakpoints during execution.
1184    ///
1185    /// Experimental: may change without notice.
1186    #[serde(
1187        rename = "disableBreaks",
1188        default,
1189        skip_serializing_if = "Option::is_none"
1190    )]
1191    pub disable_breaks: Option<bool>,
1192    /// Setting this flag to true enables `let` re-declaration and top-level
1193    /// `await`. Note that `let` variables can only be re-declared if they
1194    /// originate from `replMode` themselves.
1195    ///
1196    /// Experimental: may change without notice.
1197    #[serde(rename = "replMode", default, skip_serializing_if = "Option::is_none")]
1198    pub repl_mode: Option<bool>,
1199    /// The Content Security Policy (CSP) for the target might block 'unsafe-eval'
1200    /// which includes eval(), Function(), setTimeout() and setInterval() when
1201    /// called with non-callable arguments. This flag bypasses CSP for this
1202    /// evaluation and allows unsafe-eval. Defaults to true.
1203    ///
1204    /// Experimental: may change without notice.
1205    #[serde(
1206        rename = "allowUnsafeEvalBlockedByCSP",
1207        default,
1208        skip_serializing_if = "Option::is_none"
1209    )]
1210    pub allow_unsafe_eval_blocked_by_csp: Option<bool>,
1211    /// An alternative way to specify the execution context to evaluate in.
1212    /// Compared to contextId that may be reused across processes, this is
1213    /// guaranteed to be system-unique, so it can be used to prevent accidental
1214    /// evaluation of the expression in context different than intended (e.g. as a
1215    /// result of navigation across process boundaries). This is mutually
1216    /// exclusive with `contextId`.
1217    ///
1218    /// Experimental: may change without notice.
1219    #[serde(
1220        rename = "uniqueContextId",
1221        default,
1222        skip_serializing_if = "Option::is_none"
1223    )]
1224    pub unique_context_id: Option<String>,
1225    /// Specifies the result serialization. If provided, overrides
1226    /// `generatePreview` and `returnByValue`.
1227    ///
1228    /// Experimental: may change without notice.
1229    #[serde(
1230        rename = "serializationOptions",
1231        default,
1232        skip_serializing_if = "Option::is_none"
1233    )]
1234    pub serialization_options: Option<SerializationOptions>,
1235}
1236
1237/// What `Runtime.evaluate` answers with.
1238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1239pub struct EvaluateReturns {
1240    /// Evaluation result.
1241    pub result: RemoteObject,
1242    /// Exception details.
1243    #[serde(
1244        rename = "exceptionDetails",
1245        default,
1246        skip_serializing_if = "Option::is_none"
1247    )]
1248    pub exception_details: Option<ExceptionDetails>,
1249}
1250
1251impl crate::typed::Command for EvaluateParams {
1252    const METHOD: &'static str = "Runtime.evaluate";
1253    type Returns = EvaluateReturns;
1254}
1255
1256/// Returns the isolate id.
1257///
1258/// Experimental: may change without notice.
1259///
1260/// Parameters of `Runtime.getIsolateId`.
1261#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1262pub struct GetIsolateIdParams {}
1263
1264/// What `Runtime.getIsolateId` answers with.
1265#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1266pub struct GetIsolateIdReturns {
1267    /// The isolate id.
1268    pub id: String,
1269}
1270
1271impl crate::typed::Command for GetIsolateIdParams {
1272    const METHOD: &'static str = "Runtime.getIsolateId";
1273    type Returns = GetIsolateIdReturns;
1274}
1275
1276/// Returns the JavaScript heap usage. It is the total usage of the
1277/// corresponding isolate not scoped to a particular Runtime.
1278///
1279/// Experimental: may change without notice.
1280///
1281/// Parameters of `Runtime.getHeapUsage`.
1282#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1283pub struct GetHeapUsageParams {}
1284
1285/// What `Runtime.getHeapUsage` answers with.
1286#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1287pub struct GetHeapUsageReturns {
1288    /// Used JavaScript heap size in bytes.
1289    #[serde(rename = "usedSize")]
1290    pub used_size: f64,
1291    /// Allocated JavaScript heap size in bytes.
1292    #[serde(rename = "totalSize")]
1293    pub total_size: f64,
1294    /// Used size in bytes in the embedder's garbage-collected heap.
1295    #[serde(rename = "embedderHeapUsedSize")]
1296    pub embedder_heap_used_size: f64,
1297    /// Size in bytes of backing storage for array buffers and external strings.
1298    #[serde(rename = "backingStorageSize")]
1299    pub backing_storage_size: f64,
1300}
1301
1302impl crate::typed::Command for GetHeapUsageParams {
1303    const METHOD: &'static str = "Runtime.getHeapUsage";
1304    type Returns = GetHeapUsageReturns;
1305}
1306
1307/// Returns properties of a given object. Object group of the result is
1308/// inherited from the target object.
1309///
1310/// Parameters of `Runtime.getProperties`.
1311#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1312pub struct GetPropertiesParams {
1313    /// Identifier of the object to return properties for.
1314    #[serde(rename = "objectId")]
1315    pub object_id: RemoteObjectId,
1316    /// If true, returns properties belonging only to the element itself, not to
1317    /// its prototype chain.
1318    #[serde(
1319        rename = "ownProperties",
1320        default,
1321        skip_serializing_if = "Option::is_none"
1322    )]
1323    pub own_properties: Option<bool>,
1324    /// If true, returns accessor properties (with getter/setter) only; internal
1325    /// properties are not returned either.
1326    ///
1327    /// Experimental: may change without notice.
1328    #[serde(
1329        rename = "accessorPropertiesOnly",
1330        default,
1331        skip_serializing_if = "Option::is_none"
1332    )]
1333    pub accessor_properties_only: Option<bool>,
1334    /// Whether preview should be generated for the results.
1335    ///
1336    /// Experimental: may change without notice.
1337    #[serde(
1338        rename = "generatePreview",
1339        default,
1340        skip_serializing_if = "Option::is_none"
1341    )]
1342    pub generate_preview: Option<bool>,
1343    /// If true, returns non-indexed properties only.
1344    ///
1345    /// Experimental: may change without notice.
1346    #[serde(
1347        rename = "nonIndexedPropertiesOnly",
1348        default,
1349        skip_serializing_if = "Option::is_none"
1350    )]
1351    pub non_indexed_properties_only: Option<bool>,
1352}
1353
1354/// What `Runtime.getProperties` answers with.
1355#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1356pub struct GetPropertiesReturns {
1357    /// Object properties.
1358    pub result: Vec<PropertyDescriptor>,
1359    /// Internal object properties (only of the element itself).
1360    #[serde(
1361        rename = "internalProperties",
1362        default,
1363        skip_serializing_if = "Option::is_none"
1364    )]
1365    pub internal_properties: Option<Vec<InternalPropertyDescriptor>>,
1366    /// Object private properties.
1367    ///
1368    /// Experimental: may change without notice.
1369    #[serde(
1370        rename = "privateProperties",
1371        default,
1372        skip_serializing_if = "Option::is_none"
1373    )]
1374    pub private_properties: Option<Vec<PrivatePropertyDescriptor>>,
1375    /// Exception details.
1376    #[serde(
1377        rename = "exceptionDetails",
1378        default,
1379        skip_serializing_if = "Option::is_none"
1380    )]
1381    pub exception_details: Option<ExceptionDetails>,
1382}
1383
1384impl crate::typed::Command for GetPropertiesParams {
1385    const METHOD: &'static str = "Runtime.getProperties";
1386    type Returns = GetPropertiesReturns;
1387}
1388
1389/// Returns all let, const and class variables from global scope.
1390///
1391/// Parameters of `Runtime.globalLexicalScopeNames`.
1392#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1393pub struct GlobalLexicalScopeNamesParams {
1394    /// Specifies in which execution context to lookup global scope variables.
1395    #[serde(
1396        rename = "executionContextId",
1397        default,
1398        skip_serializing_if = "Option::is_none"
1399    )]
1400    pub execution_context_id: Option<ExecutionContextId>,
1401}
1402
1403/// What `Runtime.globalLexicalScopeNames` answers with.
1404#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1405pub struct GlobalLexicalScopeNamesReturns {
1406    pub names: Vec<String>,
1407}
1408
1409impl crate::typed::Command for GlobalLexicalScopeNamesParams {
1410    const METHOD: &'static str = "Runtime.globalLexicalScopeNames";
1411    type Returns = GlobalLexicalScopeNamesReturns;
1412}
1413
1414/// Parameters of `Runtime.queryObjects`.
1415#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1416pub struct QueryObjectsParams {
1417    /// Identifier of the prototype to return objects for.
1418    #[serde(rename = "prototypeObjectId")]
1419    pub prototype_object_id: RemoteObjectId,
1420    /// Symbolic group name that can be used to release the results.
1421    #[serde(
1422        rename = "objectGroup",
1423        default,
1424        skip_serializing_if = "Option::is_none"
1425    )]
1426    pub object_group: Option<String>,
1427}
1428
1429/// What `Runtime.queryObjects` answers with.
1430#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1431pub struct QueryObjectsReturns {
1432    /// Array with objects.
1433    pub objects: RemoteObject,
1434}
1435
1436impl crate::typed::Command for QueryObjectsParams {
1437    const METHOD: &'static str = "Runtime.queryObjects";
1438    type Returns = QueryObjectsReturns;
1439}
1440
1441/// Releases remote object with given id.
1442///
1443/// Parameters of `Runtime.releaseObject`.
1444#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1445pub struct ReleaseObjectParams {
1446    /// Identifier of the object to release.
1447    #[serde(rename = "objectId")]
1448    pub object_id: RemoteObjectId,
1449}
1450
1451impl crate::typed::Command for ReleaseObjectParams {
1452    const METHOD: &'static str = "Runtime.releaseObject";
1453    type Returns = crate::typed::NoReturns;
1454}
1455
1456/// Releases all remote objects that belong to a given group.
1457///
1458/// Parameters of `Runtime.releaseObjectGroup`.
1459#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1460pub struct ReleaseObjectGroupParams {
1461    /// Symbolic object group name.
1462    #[serde(rename = "objectGroup")]
1463    pub object_group: String,
1464}
1465
1466impl crate::typed::Command for ReleaseObjectGroupParams {
1467    const METHOD: &'static str = "Runtime.releaseObjectGroup";
1468    type Returns = crate::typed::NoReturns;
1469}
1470
1471/// Tells inspected instance to run if it was waiting for debugger to attach.
1472///
1473/// Parameters of `Runtime.runIfWaitingForDebugger`.
1474#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1475pub struct RunIfWaitingForDebuggerParams {}
1476
1477impl crate::typed::Command for RunIfWaitingForDebuggerParams {
1478    const METHOD: &'static str = "Runtime.runIfWaitingForDebugger";
1479    type Returns = crate::typed::NoReturns;
1480}
1481
1482/// Runs script with given id in a given context.
1483///
1484/// Parameters of `Runtime.runScript`.
1485#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1486pub struct RunScriptParams {
1487    /// Id of the script to run.
1488    #[serde(rename = "scriptId")]
1489    pub script_id: ScriptId,
1490    /// Specifies in which execution context to perform script run. If the
1491    /// parameter is omitted the evaluation will be performed in the context of
1492    /// the inspected page.
1493    #[serde(
1494        rename = "executionContextId",
1495        default,
1496        skip_serializing_if = "Option::is_none"
1497    )]
1498    pub execution_context_id: Option<ExecutionContextId>,
1499    /// Symbolic group name that can be used to release multiple objects.
1500    #[serde(
1501        rename = "objectGroup",
1502        default,
1503        skip_serializing_if = "Option::is_none"
1504    )]
1505    pub object_group: Option<String>,
1506    /// In silent mode exceptions thrown during evaluation are not reported and do
1507    /// not pause execution. Overrides `setPauseOnException` state.
1508    #[serde(default, skip_serializing_if = "Option::is_none")]
1509    pub silent: Option<bool>,
1510    /// Determines whether Command Line API should be available during the
1511    /// evaluation.
1512    #[serde(
1513        rename = "includeCommandLineAPI",
1514        default,
1515        skip_serializing_if = "Option::is_none"
1516    )]
1517    pub include_command_line_api: Option<bool>,
1518    /// Whether the result is expected to be a JSON object which should be sent by
1519    /// value.
1520    #[serde(
1521        rename = "returnByValue",
1522        default,
1523        skip_serializing_if = "Option::is_none"
1524    )]
1525    pub return_by_value: Option<bool>,
1526    /// Whether preview should be generated for the result.
1527    #[serde(
1528        rename = "generatePreview",
1529        default,
1530        skip_serializing_if = "Option::is_none"
1531    )]
1532    pub generate_preview: Option<bool>,
1533    /// Whether execution should `await` for resulting value and return once
1534    /// awaited promise is resolved.
1535    #[serde(
1536        rename = "awaitPromise",
1537        default,
1538        skip_serializing_if = "Option::is_none"
1539    )]
1540    pub await_promise: Option<bool>,
1541}
1542
1543/// What `Runtime.runScript` answers with.
1544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1545pub struct RunScriptReturns {
1546    /// Run result.
1547    pub result: RemoteObject,
1548    /// Exception details.
1549    #[serde(
1550        rename = "exceptionDetails",
1551        default,
1552        skip_serializing_if = "Option::is_none"
1553    )]
1554    pub exception_details: Option<ExceptionDetails>,
1555}
1556
1557impl crate::typed::Command for RunScriptParams {
1558    const METHOD: &'static str = "Runtime.runScript";
1559    type Returns = RunScriptReturns;
1560}
1561
1562/// Enables or disables async call stacks tracking.
1563///
1564/// Parameters of `Runtime.setAsyncCallStackDepth`.
1565#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1566pub struct SetAsyncCallStackDepthParams {
1567    /// Maximum depth of async call stacks. Setting to `0` will effectively
1568    /// disable collecting async call stacks (default).
1569    #[serde(rename = "maxDepth")]
1570    pub max_depth: i64,
1571}
1572
1573impl crate::typed::Command for SetAsyncCallStackDepthParams {
1574    const METHOD: &'static str = "Runtime.setAsyncCallStackDepth";
1575    type Returns = crate::typed::NoReturns;
1576}
1577
1578/// Experimental: may change without notice.
1579///
1580/// Parameters of `Runtime.setCustomObjectFormatterEnabled`.
1581#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1582pub struct SetCustomObjectFormatterEnabledParams {
1583    pub enabled: bool,
1584}
1585
1586impl crate::typed::Command for SetCustomObjectFormatterEnabledParams {
1587    const METHOD: &'static str = "Runtime.setCustomObjectFormatterEnabled";
1588    type Returns = crate::typed::NoReturns;
1589}
1590
1591/// Experimental: may change without notice.
1592///
1593/// Parameters of `Runtime.setMaxCallStackSizeToCapture`.
1594#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1595pub struct SetMaxCallStackSizeToCaptureParams {
1596    pub size: i64,
1597}
1598
1599impl crate::typed::Command for SetMaxCallStackSizeToCaptureParams {
1600    const METHOD: &'static str = "Runtime.setMaxCallStackSizeToCapture";
1601    type Returns = crate::typed::NoReturns;
1602}
1603
1604/// Terminate current or next JavaScript execution. Will cancel the
1605/// termination when the outer-most script execution ends.
1606///
1607/// Experimental: may change without notice.
1608///
1609/// Parameters of `Runtime.terminateExecution`.
1610#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1611pub struct TerminateExecutionParams {}
1612
1613impl crate::typed::Command for TerminateExecutionParams {
1614    const METHOD: &'static str = "Runtime.terminateExecution";
1615    type Returns = crate::typed::NoReturns;
1616}
1617
1618/// If executionContextId is empty, adds binding with the given name on the
1619/// global objects of all inspected contexts, including those created later,
1620/// bindings survive reloads. Binding function takes exactly one argument,
1621/// this argument should be string, in case of any other input, function
1622/// throws an exception. Each binding function call produces
1623/// Runtime.bindingCalled notification.
1624///
1625/// Parameters of `Runtime.addBinding`.
1626#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1627pub struct AddBindingParams {
1628    pub name: String,
1629    /// If specified, the binding would only be exposed to the specified execution
1630    /// context. If omitted and `executionContextName` is not set, the binding is
1631    /// exposed to all execution contexts of the target. This parameter is
1632    /// mutually exclusive with `executionContextName`. Deprecated in favor of
1633    /// `executionContextName` due to an unclear use case and bugs in
1634    /// implementation (crbug.com/1169639). `executionContextId` will be removed
1635    /// in the future.
1636    ///
1637    /// Deprecated in the protocol.
1638    ///
1639    /// Experimental: may change without notice.
1640    #[serde(
1641        rename = "executionContextId",
1642        default,
1643        skip_serializing_if = "Option::is_none"
1644    )]
1645    pub execution_context_id: Option<ExecutionContextId>,
1646    /// If specified, the binding is exposed to the executionContext with matching
1647    /// name, even for contexts created after the binding is added. See also
1648    /// `ExecutionContext.name` and `worldName` parameter to
1649    /// `Page.addScriptToEvaluateOnNewDocument`. This parameter is mutually
1650    /// exclusive with `executionContextId`.
1651    #[serde(
1652        rename = "executionContextName",
1653        default,
1654        skip_serializing_if = "Option::is_none"
1655    )]
1656    pub execution_context_name: Option<String>,
1657}
1658
1659impl crate::typed::Command for AddBindingParams {
1660    const METHOD: &'static str = "Runtime.addBinding";
1661    type Returns = crate::typed::NoReturns;
1662}
1663
1664/// This method does not remove binding function from global object but
1665/// unsubscribes current runtime agent from Runtime.bindingCalled
1666/// notifications.
1667///
1668/// Parameters of `Runtime.removeBinding`.
1669#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1670pub struct RemoveBindingParams {
1671    pub name: String,
1672}
1673
1674impl crate::typed::Command for RemoveBindingParams {
1675    const METHOD: &'static str = "Runtime.removeBinding";
1676    type Returns = crate::typed::NoReturns;
1677}
1678
1679/// This method tries to lookup and populate exception details for a
1680/// JavaScript Error object. Note that the stackTrace portion of the resulting
1681/// exceptionDetails will only be populated if the Runtime domain was enabled
1682/// at the time when the Error was thrown.
1683///
1684/// Experimental: may change without notice.
1685///
1686/// Parameters of `Runtime.getExceptionDetails`.
1687#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1688pub struct GetExceptionDetailsParams {
1689    /// The error object for which to resolve the exception details.
1690    #[serde(rename = "errorObjectId")]
1691    pub error_object_id: RemoteObjectId,
1692}
1693
1694/// What `Runtime.getExceptionDetails` answers with.
1695#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1696pub struct GetExceptionDetailsReturns {
1697    #[serde(
1698        rename = "exceptionDetails",
1699        default,
1700        skip_serializing_if = "Option::is_none"
1701    )]
1702    pub exception_details: Option<ExceptionDetails>,
1703}
1704
1705impl crate::typed::Command for GetExceptionDetailsParams {
1706    const METHOD: &'static str = "Runtime.getExceptionDetails";
1707    type Returns = GetExceptionDetailsReturns;
1708}
1709
1710/// Notification is issued every time when binding is called.
1711///
1712/// Experimental: may change without notice.
1713///
1714/// Payload of the `Runtime.bindingCalled` event.
1715#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1716pub struct BindingCalledEvent {
1717    pub name: String,
1718    pub payload: String,
1719    /// Identifier of the context where the call was made.
1720    #[serde(rename = "executionContextId")]
1721    pub execution_context_id: ExecutionContextId,
1722}
1723
1724impl crate::typed::Event for BindingCalledEvent {
1725    const METHOD: &'static str = "Runtime.bindingCalled";
1726}
1727
1728/// Issued when console API was called.
1729///
1730/// Payload of the `Runtime.consoleAPICalled` event.
1731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1732pub struct ConsoleApiCalledEvent {
1733    /// Type of the call.
1734    pub r#type: ConsoleApiCalledType,
1735    /// Call arguments.
1736    pub args: Vec<RemoteObject>,
1737    /// Identifier of the context where the call was made.
1738    #[serde(rename = "executionContextId")]
1739    pub execution_context_id: ExecutionContextId,
1740    /// Call timestamp.
1741    pub timestamp: Timestamp,
1742    /// Stack trace captured when the call was made. The async stack chain is
1743    /// automatically reported for the following call types: `assert`, `error`,
1744    /// `trace`, `warning`. For other types the async call chain can be retrieved
1745    /// using `Debugger.getStackTrace` and `stackTrace.parentId` field.
1746    #[serde(
1747        rename = "stackTrace",
1748        default,
1749        skip_serializing_if = "Option::is_none"
1750    )]
1751    pub stack_trace: Option<StackTrace>,
1752    /// Console context descriptor for calls on non-default console context (not
1753    /// console.*): 'anonymous#unique-logger-id' for call on unnamed context,
1754    /// 'name#unique-logger-id' for call on named context.
1755    ///
1756    /// Experimental: may change without notice.
1757    #[serde(default, skip_serializing_if = "Option::is_none")]
1758    pub context: Option<String>,
1759}
1760
1761/// The values `type` accepts on `consoleAPICalled`.
1762#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
1763pub enum ConsoleApiCalledType {
1764    /// `log`
1765    #[serde(rename = "log")]
1766    Log,
1767    /// `debug`
1768    #[serde(rename = "debug")]
1769    Debug,
1770    /// `info`
1771    #[serde(rename = "info")]
1772    Info,
1773    /// `error`
1774    #[serde(rename = "error")]
1775    Error,
1776    /// `warning`
1777    #[serde(rename = "warning")]
1778    Warning,
1779    /// `dir`
1780    #[serde(rename = "dir")]
1781    Dir,
1782    /// `dirxml`
1783    #[serde(rename = "dirxml")]
1784    Dirxml,
1785    /// `table`
1786    #[serde(rename = "table")]
1787    Table,
1788    /// `trace`
1789    #[serde(rename = "trace")]
1790    Trace,
1791    /// `clear`
1792    #[serde(rename = "clear")]
1793    Clear,
1794    /// `startGroup`
1795    #[serde(rename = "startGroup")]
1796    StartGroup,
1797    /// `startGroupCollapsed`
1798    #[serde(rename = "startGroupCollapsed")]
1799    StartGroupCollapsed,
1800    /// `endGroup`
1801    #[serde(rename = "endGroup")]
1802    EndGroup,
1803    /// `assert`
1804    #[serde(rename = "assert")]
1805    Assert,
1806    /// `profile`
1807    #[serde(rename = "profile")]
1808    Profile,
1809    /// `profileEnd`
1810    #[serde(rename = "profileEnd")]
1811    ProfileEnd,
1812    /// `count`
1813    #[serde(rename = "count")]
1814    Count,
1815    /// `timeEnd`
1816    #[serde(rename = "timeEnd")]
1817    TimeEnd,
1818    /// A value this vendored schema does not list. Chrome adds values ahead of
1819    /// the published protocol, so an unrecognised one is kept as it arrived
1820    /// rather than failing the payload it came in.
1821    #[serde(untagged)]
1822    Unrecognized(String),
1823}
1824
1825impl crate::typed::Event for ConsoleApiCalledEvent {
1826    const METHOD: &'static str = "Runtime.consoleAPICalled";
1827}
1828
1829/// Issued when unhandled exception was revoked.
1830///
1831/// Payload of the `Runtime.exceptionRevoked` event.
1832#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1833pub struct ExceptionRevokedEvent {
1834    /// Reason describing why exception was revoked.
1835    pub reason: String,
1836    /// The id of revoked exception, as reported in `exceptionThrown`.
1837    #[serde(rename = "exceptionId")]
1838    pub exception_id: i64,
1839}
1840
1841impl crate::typed::Event for ExceptionRevokedEvent {
1842    const METHOD: &'static str = "Runtime.exceptionRevoked";
1843}
1844
1845/// Issued when exception was thrown and unhandled.
1846///
1847/// Payload of the `Runtime.exceptionThrown` event.
1848#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1849pub struct ExceptionThrownEvent {
1850    /// Timestamp of the exception.
1851    pub timestamp: Timestamp,
1852    #[serde(rename = "exceptionDetails")]
1853    pub exception_details: ExceptionDetails,
1854}
1855
1856impl crate::typed::Event for ExceptionThrownEvent {
1857    const METHOD: &'static str = "Runtime.exceptionThrown";
1858}
1859
1860/// Issued when new execution context is created.
1861///
1862/// Payload of the `Runtime.executionContextCreated` event.
1863#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1864pub struct ExecutionContextCreatedEvent {
1865    /// A newly created execution context.
1866    pub context: ExecutionContextDescription,
1867}
1868
1869impl crate::typed::Event for ExecutionContextCreatedEvent {
1870    const METHOD: &'static str = "Runtime.executionContextCreated";
1871}
1872
1873/// Issued when execution context is destroyed.
1874///
1875/// Payload of the `Runtime.executionContextDestroyed` event.
1876#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1877pub struct ExecutionContextDestroyedEvent {
1878    /// Id of the destroyed context
1879    ///
1880    /// Deprecated in the protocol.
1881    #[serde(rename = "executionContextId")]
1882    pub execution_context_id: ExecutionContextId,
1883    /// Unique Id of the destroyed context
1884    ///
1885    /// Experimental: may change without notice.
1886    #[serde(rename = "executionContextUniqueId")]
1887    pub execution_context_unique_id: String,
1888}
1889
1890impl crate::typed::Event for ExecutionContextDestroyedEvent {
1891    const METHOD: &'static str = "Runtime.executionContextDestroyed";
1892}
1893
1894/// Issued when all executionContexts were cleared in browser
1895///
1896/// Payload of the `Runtime.executionContextsCleared` event.
1897#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
1898pub struct ExecutionContextsClearedEvent {}
1899
1900impl crate::typed::Event for ExecutionContextsClearedEvent {
1901    const METHOD: &'static str = "Runtime.executionContextsCleared";
1902}
1903
1904/// Issued when object should be inspected (for example, as a result of
1905/// inspect() command line API call).
1906///
1907/// Payload of the `Runtime.inspectRequested` event.
1908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1909pub struct InspectRequestedEvent {
1910    pub object: RemoteObject,
1911    pub hints: serde_json::Value,
1912    /// Identifier of the context where the call was made.
1913    ///
1914    /// Experimental: may change without notice.
1915    #[serde(
1916        rename = "executionContextId",
1917        default,
1918        skip_serializing_if = "Option::is_none"
1919    )]
1920    pub execution_context_id: Option<ExecutionContextId>,
1921}
1922
1923impl crate::typed::Event for InspectRequestedEvent {
1924    const METHOD: &'static str = "Runtime.inspectRequested";
1925}