CDPotion.Domain.Runtime (cdpotion v0.1.4)
Summary
Types
Represents function call argument. Either remote object id objectId
, primitive value
,
unserializable primitive value or neither of (for undefined) them should be specified.
Stack entry for runtime errors and assertions.
description not provided :(
Represents deep serialized value.
description not provided :(
Detailed information about exception (or error) that was thrown during script compilation or execution.
Description of an isolated world.
Id of an execution context.
Object internal property descriptor. This property isn't normally visible in JavaScript code.
Object containing abbreviated remote object value.
Object private field descriptor.
Object property descriptor.
description not provided :(
Mirror object referencing original JavaScript object.
Unique object identifier.
Unique script identifier.
Represents options for serialization. Overrides generatePreview
, returnByValue
and
generateWebDriverValue
.
Call frames for assertions or error messages.
If debuggerId
is set stack trace comes from another debugger and can be resolved there. This
allows to track cross-debugger calls. See Runtime.StackTrace
and Debugger.paused
for usages.
Number of milliseconds.
Number of milliseconds since epoch.
Unique identifier of current debugger.
Primitive value which cannot be JSON-stringified. Includes values -0
, NaN
, Infinity
,
-Infinity
, and bigint literals.
Functions
If executionContextId is empty, adds binding with the given name on the global objects of all inspected contexts, including those created later, bindings survive reloads. Binding function takes exactly one argument, this argument should be string, in case of any other input, function throws an exception. Each binding function call produces Runtime.bindingCalled notification.
Add handler to promise with given promise object id.
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
Compiles expression.
Disables reporting of execution contexts creation.
Discards collected exceptions and console API calls.
Enables reporting of execution contexts creation by means of executionContextCreated
event.
When the reporting gets enabled the event will be sent immediately for each existing execution
context.
This method tries to lookup and populate exception details for a JavaScript Error object. Note that the stackTrace portion of the resulting exceptionDetails will only be populated if the Runtime domain was enabled at the time when the Error was thrown.
Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.
Returns the isolate id.
Returns properties of a given object. Object group of the result is inherited from the target object.
Returns all let, const and class variables from global scope.
Parameters:
- (Required)
prototype_object_id
: Identifier of the prototype to return objects for. - (Optional)
object_group
: Symbolic group name that can be used to release the results.
Releases remote object with given id.
Releases all remote objects that belong to a given group.
This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.
Tells inspected instance to run if it was waiting for debugger to attach.
Runs script with given id in a given context.
Enables or disables async call stacks tracking.
Parameters:
- (Required)
enabled
: description not provided :(
Parameters:
- (Required)
size
: description not provided :(
Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.
Types
call_argument()
@type call_argument() :: %{ objectId: remote_object_id() | nil, unserializableValue: unserializable_value() | nil, value: any() | nil }
Represents function call argument. Either remote object id objectId
, primitive value
,
unserializable primitive value or neither of (for undefined) them should be specified.
call_frame()
@type call_frame() :: %{ columnNumber: integer(), functionName: String.t(), lineNumber: integer(), scriptId: script_id(), url: String.t() }
Stack entry for runtime errors and assertions.
custom_preview()
@type custom_preview() :: %{ bodyGetterId: remote_object_id() | nil, header: String.t() }
description not provided :(
deep_serialized_value()
@type deep_serialized_value() :: %{ objectId: String.t() | nil, type: :undefined | :null | :string | :number | :boolean | :bigint | :regexp | :date | :symbol | :array | :object | :function | :map | :set | :weakmap | :weakset | :error | :proxy | :promise | :typedarray | :arraybuffer | :node | :window, value: any() | nil, weakLocalObjectReference: integer() | nil }
Represents deep serialized value.
entry_preview()
@type entry_preview() :: %{key: object_preview() | nil, value: object_preview()}
description not provided :(
exception_details()
@type exception_details() :: %{ columnNumber: integer(), exception: remote_object() | nil, exceptionId: integer(), exceptionMetaData: map() | nil, executionContextId: execution_context_id() | nil, lineNumber: integer(), scriptId: script_id() | nil, stackTrace: stack_trace() | nil, text: String.t(), url: String.t() | nil }
Detailed information about exception (or error) that was thrown during script compilation or execution.
execution_context_description()
@type execution_context_description() :: %{ auxData: map() | nil, id: execution_context_id(), name: String.t(), origin: String.t(), uniqueId: String.t() }
Description of an isolated world.
execution_context_id()
@type execution_context_id() :: integer()
Id of an execution context.
internal_property_descriptor()
@type internal_property_descriptor() :: %{ name: String.t(), value: remote_object() | nil }
Object internal property descriptor. This property isn't normally visible in JavaScript code.
object_preview()
@type object_preview() :: %{ description: String.t() | nil, entries: [entry_preview()] | nil, overflow: boolean(), properties: [property_preview()], subtype: :array | :null | :node | :regexp | :date | :map | :set | :weakmap | :weakset | :iterator | :generator | :error | :proxy | :promise | :typedarray | :arraybuffer | :dataview | :webassemblymemory | :wasmvalue | nil, type: :object | :function | :undefined | :string | :number | :boolean | :symbol | :bigint }
Object containing abbreviated remote object value.
private_property_descriptor()
@type private_property_descriptor() :: %{ get: remote_object() | nil, name: String.t(), set: remote_object() | nil, value: remote_object() | nil }
Object private field descriptor.
property_descriptor()
@type property_descriptor() :: %{ configurable: boolean(), enumerable: boolean(), get: remote_object() | nil, isOwn: boolean() | nil, name: String.t(), set: remote_object() | nil, symbol: remote_object() | nil, value: remote_object() | nil, wasThrown: boolean() | nil, writable: boolean() | nil }
Object property descriptor.
property_preview()
@type property_preview() :: %{ name: String.t(), subtype: :array | :null | :node | :regexp | :date | :map | :set | :weakmap | :weakset | :iterator | :generator | :error | :proxy | :promise | :typedarray | :arraybuffer | :dataview | :webassemblymemory | :wasmvalue | nil, type: :object | :function | :undefined | :string | :number | :boolean | :symbol | :accessor | :bigint, value: String.t() | nil, valuePreview: object_preview() | nil }
description not provided :(
remote_object()
@type remote_object() :: %{ className: String.t() | nil, customPreview: custom_preview() | nil, deepSerializedValue: deep_serialized_value() | nil, description: String.t() | nil, objectId: remote_object_id() | nil, preview: object_preview() | nil, subtype: :array | :null | :node | :regexp | :date | :map | :set | :weakmap | :weakset | :iterator | :generator | :error | :proxy | :promise | :typedarray | :arraybuffer | :dataview | :webassemblymemory | :wasmvalue | nil, type: :object | :function | :undefined | :string | :number | :boolean | :symbol | :bigint, unserializableValue: unserializable_value() | nil, value: any() | nil, webDriverValue: deep_serialized_value() | nil }
Mirror object referencing original JavaScript object.
remote_object_id()
@type remote_object_id() :: String.t()
Unique object identifier.
script_id()
@type script_id() :: String.t()
Unique script identifier.
serialization_options()
@type serialization_options() :: %{ additionalParameters: map() | nil, maxDepth: integer() | nil, serialization: :deep | :json | :idOnly }
Represents options for serialization. Overrides generatePreview
, returnByValue
and
generateWebDriverValue
.
stack_trace()
@type stack_trace() :: %{ callFrames: [call_frame()], description: String.t() | nil, parent: stack_trace() | nil, parentId: stack_trace_id() | nil }
Call frames for assertions or error messages.
stack_trace_id()
@type stack_trace_id() :: %{debuggerId: unique_debugger_id() | nil, id: String.t()}
If debuggerId
is set stack trace comes from another debugger and can be resolved there. This
allows to track cross-debugger calls. See Runtime.StackTrace
and Debugger.paused
for usages.
time_delta()
@type time_delta() :: number()
Number of milliseconds.
timestamp()
@type timestamp() :: number()
Number of milliseconds since epoch.
unique_debugger_id()
@type unique_debugger_id() :: String.t()
Unique identifier of current debugger.
unserializable_value()
@type unserializable_value() :: String.t()
Primitive value which cannot be JSON-stringified. Includes values -0
, NaN
, Infinity
,
-Infinity
, and bigint literals.
Functions
add_binding(name, execution_context_id \\ nil, execution_context_name \\ nil)
@spec add_binding(String.t(), execution_context_id(), String.t()) :: {String.t(), map()}
If executionContextId is empty, adds binding with the given name on the global objects of all inspected contexts, including those created later, bindings survive reloads. Binding function takes exactly one argument, this argument should be string, in case of any other input, function throws an exception. Each binding function call produces Runtime.bindingCalled notification.
Parameters:
- (Required)
name
: description not provided :( - (Optional)
execution_context_id
: If specified, the binding would only be exposed to the specified execution context. If omitted andexecutionContextName
is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive withexecutionContextName
. Deprecated in favor ofexecutionContextName
due to an unclear use case and bugs in implementation (crbug.com/1169639).executionContextId
will be removed in the future. - (Optional)
execution_context_name
: If specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See alsoExecutionContext.name
andworldName
parameter toPage.addScriptToEvaluateOnNewDocument
. This parameter is mutually exclusive withexecutionContextId
.
await_promise(promise_object_id, return_by_value \\ nil, generate_preview \\ nil)
@spec await_promise(remote_object_id(), boolean(), boolean()) :: {String.t(), map()}
Add handler to promise with given promise object id.
Parameters:
- (Required)
promise_object_id
: Identifier of the promise. - (Optional)
return_by_value
: Whether the result is expected to be a JSON object that should be sent by value. - (Optional)
generate_preview
: Whether preview should be generated for the result.
call_function_on(function_declaration, object_id \\ nil, arguments \\ nil, silent \\ nil, return_by_value \\ nil, generate_preview \\ nil, user_gesture \\ nil, await_promise \\ nil, execution_context_id \\ nil, object_group \\ nil, throw_on_side_effect \\ nil, unique_context_id \\ nil, generate_web_driver_value \\ nil, serialization_options \\ nil)
@spec call_function_on( String.t(), remote_object_id(), [call_argument()], boolean(), boolean(), boolean(), boolean(), boolean(), execution_context_id(), String.t(), boolean(), String.t(), boolean(), serialization_options() ) :: {String.t(), map()}
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
Parameters:
- (Required)
function_declaration
: Declaration of the function to call. - (Optional)
object_id
: Identifier of the object to call function on. Either objectId or executionContextId should be specified. - (Optional)
arguments
: Call arguments. All call arguments must belong to the same JavaScript world as the target object. - (Optional)
silent
: In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnException
state. - (Optional)
return_by_value
: Whether the result is expected to be a JSON object which should be sent by value. Can be overriden byserializationOptions
. - (Optional)
generate_preview
: Whether preview should be generated for the result. - (Optional)
user_gesture
: Whether execution should be treated as initiated by user in the UI. - (Optional)
await_promise
: Whether execution shouldawait
for resulting value and return once awaited promise is resolved. - (Optional)
execution_context_id
: Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. - (Optional)
object_group
: Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. - (Optional)
throw_on_side_effect
: Whether to throw an exception if side effect cannot be ruled out during evaluation. - (Optional)
unique_context_id
: An alternative way to specify the execution context to call function on. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental function call in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive withexecutionContextId
. - (Optional)
generate_web_driver_value
: Deprecated. UseserializationOptions: {serialization:"deep"}
instead. Whether the result should containwebDriverValue
, serialized according to https://w3c.github.io/webdriver-bidi. This is mutually exclusive withreturnByValue
, but resultingobjectId
is still provided. - (Optional)
serialization_options
: Specifies the result serialization. If provided, overridesgeneratePreview
,returnByValue
andgenerateWebDriverValue
.
compile_script(expression, source_url, persist_script, execution_context_id \\ nil)
@spec compile_script( String.t(), String.t(), boolean(), execution_context_id() ) :: {String.t(), map()}
Compiles expression.
Parameters:
- (Required)
expression
: Expression to compile. - (Required)
source_url
: Source url to be set for the script. - (Required)
persist_script
: Specifies whether the compiled script should be persisted. - (Optional)
execution_context_id
: Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
disable()
Disables reporting of execution contexts creation.
discard_console_entries()
Discards collected exceptions and console API calls.
enable()
Enables reporting of execution contexts creation by means of executionContextCreated
event.
When the reporting gets enabled the event will be sent immediately for each existing execution
context.
evaluate(expression, object_group \\ nil, include_command_line_api \\ nil, silent \\ nil, context_id \\ nil, return_by_value \\ nil, generate_preview \\ nil, user_gesture \\ nil, await_promise \\ nil, throw_on_side_effect \\ nil, timeout \\ nil, disable_breaks \\ nil, repl_mode \\ nil, allow_unsafe_eval_blocked_by_csp \\ nil, unique_context_id \\ nil, generate_web_driver_value \\ nil, serialization_options \\ nil)
@spec evaluate( String.t(), String.t(), boolean(), boolean(), execution_context_id(), boolean(), boolean(), boolean(), boolean(), boolean(), time_delta(), boolean(), boolean(), boolean(), String.t(), boolean(), serialization_options() ) :: {String.t(), map()}
Evaluates expression on global object.
Parameters:
- (Required)
expression
: Expression to evaluate. - (Optional)
object_group
: Symbolic group name that can be used to release multiple objects. - (Optional)
include_command_line_api
: Determines whether Command Line API should be available during the evaluation. - (Optional)
silent
: In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnException
state. - (Optional)
context_id
: Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. This is mutually exclusive withuniqueContextId
, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment. - (Optional)
return_by_value
: Whether the result is expected to be a JSON object that should be sent by value. - (Optional)
generate_preview
: Whether preview should be generated for the result. - (Optional)
user_gesture
: Whether execution should be treated as initiated by user in the UI. - (Optional)
await_promise
: Whether execution shouldawait
for resulting value and return once awaited promise is resolved. - (Optional)
throw_on_side_effect
: Whether to throw an exception if side effect cannot be ruled out during evaluation. This impliesdisableBreaks
below. - (Optional)
timeout
: Terminate execution after timing out (number of milliseconds). - (Optional)
disable_breaks
: Disable breakpoints during execution. - (Optional)
repl_mode
: Setting this flag to true enableslet
re-declaration and top-levelawait
. Note thatlet
variables can only be re-declared if they originate fromreplMode
themselves. - (Optional)
allow_unsafe_eval_blocked_by_csp
: The Content Security Policy (CSP) for the target might block 'unsafe-eval' which includes eval(), Function(), setTimeout() and setInterval() when called with non-callable arguments. This flag bypasses CSP for this evaluation and allows unsafe-eval. Defaults to true. - (Optional)
unique_context_id
: An alternative way to specify the execution context to evaluate in. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental evaluation of the expression in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive withcontextId
. - (Optional)
generate_web_driver_value
: Deprecated. UseserializationOptions: {serialization:"deep"}
instead. Whether the result should containwebDriverValue
, serialized according to https://w3c.github.io/webdriver-bidi. This is mutually exclusive withreturnByValue
, but resultingobjectId
is still provided. - (Optional)
serialization_options
: Specifies the result serialization. If provided, overridesgeneratePreview
,returnByValue
andgenerateWebDriverValue
.
get_exception_details(error_object_id)
@spec get_exception_details(remote_object_id()) :: {String.t(), map()}
This method tries to lookup and populate exception details for a JavaScript Error object. Note that the stackTrace portion of the resulting exceptionDetails will only be populated if the Runtime domain was enabled at the time when the Error was thrown.
Parameters:
- (Required)
error_object_id
: The error object for which to resolve the exception details.
get_heap_usage()
Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.
get_isolate_id()
Returns the isolate id.
get_properties(object_id, own_properties \\ nil, accessor_properties_only \\ nil, generate_preview \\ nil, non_indexed_properties_only \\ nil)
@spec get_properties( remote_object_id(), boolean(), boolean(), boolean(), boolean() ) :: {String.t(), map()}
Returns properties of a given object. Object group of the result is inherited from the target object.
Parameters:
- (Required)
object_id
: Identifier of the object to return properties for. - (Optional)
own_properties
: If true, returns properties belonging only to the element itself, not to its prototype chain. - (Optional)
accessor_properties_only
: If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - (Optional)
generate_preview
: Whether preview should be generated for the results. - (Optional)
non_indexed_properties_only
: If true, returns non-indexed properties only.
global_lexical_scope_names(execution_context_id \\ nil)
@spec global_lexical_scope_names(execution_context_id()) :: {String.t(), map()}
Returns all let, const and class variables from global scope.
Parameters:
- (Optional)
execution_context_id
: Specifies in which execution context to lookup global scope variables.
query_objects(prototype_object_id, object_group \\ nil)
@spec query_objects(remote_object_id(), String.t()) :: {String.t(), map()}
Parameters:
- (Required)
prototype_object_id
: Identifier of the prototype to return objects for. - (Optional)
object_group
: Symbolic group name that can be used to release the results.
release_object(object_id)
@spec release_object(remote_object_id()) :: {String.t(), map()}
Releases remote object with given id.
Parameters:
- (Required)
object_id
: Identifier of the object to release.
release_object_group(object_group)
Releases all remote objects that belong to a given group.
Parameters:
- (Required)
object_group
: Symbolic object group name.
remove_binding(name)
This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.
Parameters:
- (Required)
name
: description not provided :(
run_if_waiting_for_debugger()
Tells inspected instance to run if it was waiting for debugger to attach.
run_script(script_id, execution_context_id \\ nil, object_group \\ nil, silent \\ nil, include_command_line_api \\ nil, return_by_value \\ nil, generate_preview \\ nil, await_promise \\ nil)
@spec run_script( script_id(), execution_context_id(), String.t(), boolean(), boolean(), boolean(), boolean(), boolean() ) :: {String.t(), map()}
Runs script with given id in a given context.
Parameters:
- (Required)
script_id
: Id of the script to run. - (Optional)
execution_context_id
: Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - (Optional)
object_group
: Symbolic group name that can be used to release multiple objects. - (Optional)
silent
: In silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnException
state. - (Optional)
include_command_line_api
: Determines whether Command Line API should be available during the evaluation. - (Optional)
return_by_value
: Whether the result is expected to be a JSON object which should be sent by value. - (Optional)
generate_preview
: Whether preview should be generated for the result. - (Optional)
await_promise
: Whether execution shouldawait
for resulting value and return once awaited promise is resolved.
set_async_call_stack_depth(max_depth)
Enables or disables async call stacks tracking.
Parameters:
- (Required)
max_depth
: Maximum depth of async call stacks. Setting to0
will effectively disable collecting async call stacks (default).
set_custom_object_formatter_enabled(enabled)
Parameters:
- (Required)
enabled
: description not provided :(
set_max_call_stack_size_to_capture(size)
Parameters:
- (Required)
size
: description not provided :(
terminate_execution()
Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.