clj-chrome-devtools.commands.runtime

Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.

add-binding

(add-binding)(add-binding {:as params, :keys [name execution-context-id execution-context-name]})(add-binding connection {:as params, :keys [name execution-context-id execution-context-name]})

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 map keys:

Key Description
:name null
:execution-context-id If specified, the binding would only be exposed to the specified

execution context. If omitted and executionContextName is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with executionContextName. Deprecated in favor of executionContextName 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 also ExecutionContext.name and worldName parameter to Page.addScriptToEvaluateOnNewDocument. This parameter is mutually exclusive with executionContextId. (optional)

await-promise

(await-promise)(await-promise {:as params, :keys [promise-object-id return-by-value generate-preview]})(await-promise connection {:as params, :keys [promise-object-id return-by-value generate-preview]})

Add handler to promise with given promise object id.

Parameters map keys:

Key Description
:promise-object-id Identifier of the promise.
: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)

Return map keys:

Key Description
:result Promise result. Will contain rejected value if promise was rejected.
:exception-details Exception details if stack strace is available. (optional)

call-function-on

(call-function-on)(call-function-on {:as params, :keys [function-declaration object-id arguments silent return-by-value generate-preview user-gesture await-promise execution-context-id object-group throw-on-side-effect]})(call-function-on connection {:as params, :keys [function-declaration object-id arguments silent return-by-value generate-preview user-gesture await-promise execution-context-id object-group throw-on-side-effect]})

Calls function with given declaration on the given object. Object group of the result is inherited from the target object.

Parameters map keys:

Key Description
:function-declaration Declaration of the function to call.
: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. Overrides setPauseOnException state. (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) :user-gesture | Whether execution should be treated as initiated by user in the UI. (optional) :await-promise | Whether execution should await 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)

Return map keys:

Key Description
:result Call result.
:exception-details Exception details. (optional)

compile-script

(compile-script)(compile-script {:as params, :keys [expression source-url persist-script execution-context-id]})(compile-script connection {:as params, :keys [expression source-url persist-script execution-context-id]})

Compiles expression.

Parameters map keys:

Key Description
:expression Expression to compile.
:source-url Source url to be set for the script.
:persist-script Specifies whether the compiled script should be persisted.
: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)

Return map keys:

Key Description
:script-id Id of the script. (optional)
:exception-details Exception details. (optional)

disable

(disable)(disable {:as params, :keys []})(disable connection {:as params, :keys []})

Disables reporting of execution contexts creation.

discard-console-entries

(discard-console-entries)(discard-console-entries {:as params, :keys []})(discard-console-entries connection {:as params, :keys []})

Discards collected exceptions and console API calls.

enable

(enable)(enable {:as params, :keys []})(enable connection {:as params, :keys []})

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

(evaluate)(evaluate {:as params, :keys [expression object-group include-command-line-api silent context-id return-by-value generate-preview user-gesture await-promise throw-on-side-effect timeout disable-breaks repl-mode allow-unsafe-eval-blocked-by-csp unique-context-id]})(evaluate connection {:as params, :keys [expression object-group include-command-line-api silent context-id return-by-value generate-preview user-gesture await-promise throw-on-side-effect timeout disable-breaks repl-mode allow-unsafe-eval-blocked-by-csp unique-context-id]})

Evaluates expression on global object.

Parameters map keys:

Key Description
:expression Expression to evaluate.
: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. Overrides setPauseOnException 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 with uniqueContextId, 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 should await 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 implies disableBreaks 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 enables let re-declaration and top-level await. Note that let variables can only be re-declared if they originate from replMode 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 with contextId. (optional)

Return map keys:

Key Description
:result Evaluation result.
:exception-details Exception details. (optional)

get-heap-usage

(get-heap-usage)(get-heap-usage {:as params, :keys []})(get-heap-usage connection {:as params, :keys []})

Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.

Return map keys:

Key Description
:used-size Used heap size in bytes.
:total-size Allocated heap size in bytes.

get-isolate-id

(get-isolate-id)(get-isolate-id {:as params, :keys []})(get-isolate-id connection {:as params, :keys []})

Returns the isolate id.

Return map keys:

Key Description
:id The isolate id.

get-properties

(get-properties)(get-properties {:as params, :keys [object-id own-properties accessor-properties-only generate-preview non-indexed-properties-only]})(get-properties connection {:as params, :keys [object-id own-properties accessor-properties-only generate-preview non-indexed-properties-only]})

Returns properties of a given object. Object group of the result is inherited from the target object.

Parameters map keys:

Key Description
:object-id Identifier of the object to return properties for.
: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. (optional)

Return map keys:

Key Description
:result Object properties.
:internal-properties Internal object properties (only of the element itself). (optional)
:private-properties Object private properties. (optional)
:exception-details Exception details. (optional)

global-lexical-scope-names

(global-lexical-scope-names)(global-lexical-scope-names {:as params, :keys [execution-context-id]})(global-lexical-scope-names connection {:as params, :keys [execution-context-id]})

Returns all let, const and class variables from global scope.

Parameters map keys:

Key Description
:execution-context-id Specifies in which execution context to lookup global scope variables. (optional)

Return map keys:

Key Description
:names null

query-objects

(query-objects)(query-objects {:as params, :keys [prototype-object-id object-group]})(query-objects connection {:as params, :keys [prototype-object-id object-group]})

Parameters map keys:

Key Description
:prototype-object-id Identifier of the prototype to return objects for.
:object-group Symbolic group name that can be used to release the results. (optional)

Return map keys:

Key Description
:objects Array with objects.

release-object

(release-object)(release-object {:as params, :keys [object-id]})(release-object connection {:as params, :keys [object-id]})

Releases remote object with given id.

Parameters map keys:

Key Description
:object-id Identifier of the object to release.

release-object-group

(release-object-group)(release-object-group {:as params, :keys [object-group]})(release-object-group connection {:as params, :keys [object-group]})

Releases all remote objects that belong to a given group.

Parameters map keys:

Key Description
:object-group Symbolic object group name.

remove-binding

(remove-binding)(remove-binding {:as params, :keys [name]})(remove-binding connection {:as params, :keys [name]})

This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.

Parameters map keys:

Key Description
:name null

run-if-waiting-for-debugger

(run-if-waiting-for-debugger)(run-if-waiting-for-debugger {:as params, :keys []})(run-if-waiting-for-debugger connection {:as params, :keys []})

Tells inspected instance to run if it was waiting for debugger to attach.

run-script

(run-script)(run-script {:as params, :keys [script-id execution-context-id object-group silent include-command-line-api return-by-value generate-preview await-promise]})(run-script connection {:as params, :keys [script-id execution-context-id object-group silent include-command-line-api return-by-value generate-preview await-promise]})

Runs script with given id in a given context.

Parameters map keys:

Key Description
:script-id Id of the script to run.
: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. Overrides setPauseOnException 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 should await for resulting value and return once awaited promise is resolved. (optional)

Return map keys:

Key Description
:result Run result.
:exception-details Exception details. (optional)

set-async-call-stack-depth

(set-async-call-stack-depth)(set-async-call-stack-depth {:as params, :keys [max-depth]})(set-async-call-stack-depth connection {:as params, :keys [max-depth]})

Enables or disables async call stacks tracking.

Parameters map keys:

Key Description
:max-depth Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async

call stacks (default).

set-custom-object-formatter-enabled

(set-custom-object-formatter-enabled)(set-custom-object-formatter-enabled {:as params, :keys [enabled]})(set-custom-object-formatter-enabled connection {:as params, :keys [enabled]})

Parameters map keys:

Key Description
:enabled null

set-max-call-stack-size-to-capture

(set-max-call-stack-size-to-capture)(set-max-call-stack-size-to-capture {:as params, :keys [size]})(set-max-call-stack-size-to-capture connection {:as params, :keys [size]})

Parameters map keys:

Key Description
:size null

terminate-execution

(terminate-execution)(terminate-execution {:as params, :keys []})(terminate-execution connection {:as params, :keys []})

Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.