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.

Methods enable, disable, evaluate, callFunctionOn, getProperties
Events executionContextsCleared, exceptionThrown
Types ScriptId, RemoteObjectId, UnserializableValue, RemoteObject, PropertyDescriptor, CallArgument, ExecutionContextId, ExceptionDetails, Timestamp, CallFrame, StackTrace

Methods

enable

Enables reporting of the executionContextsCleared event.


disable

Disables reporting of the executionContextsCleared event.


evaluate

Evaluates expression on global object.

Parameters
expression string Expression to evaluate.
silent
optional
boolean In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
contextId
optional
ExecutionContextId 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.
returnByValue
optional
boolean Whether the result is expected to be a JSON object that should be sent by value.
awaitPromise
optional
boolean Whether execution should await for resulting value and return once awaited promise is resolved.
Returns
result RemoteObject Evaluation result.

callFunctionOn

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

Parameters
functionDeclaration string Declaration of the function to call.
objectId
optional
RemoteObjectId Identifier of the object to call function on. Either objectId or executionContextId should be specified. objectId must be from the Runtime.evaluate() function.
arguments
optional
CallArgument[] Call arguments. All call arguments must belong to the same JavaScript world as the target object.
silent
optional
boolean In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
returnByValue
optional
boolean Whether the result is expected to be a JSON object which should be sent by value.
awaitPromise
optional
boolean Whether execution should await for resulting value and return once awaited promise is resolved.
Returns
result RemoteObject Call result.

getProperties

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

Parameters
objectId RemoteObjectId Identifier of the object to return properties for. objectId must be from the Debugger.evaluateOnCallFrame() function.
ownProperties
optional
boolean If true, returns properties belonging only to the element itself, not to its prototype chain.
accessorPropertiesOnly
optional
boolean Experimental. If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
Returns
result PropertyDescriptor[] Object properties.

Events

executionContextsCleared

Issued when all executionContexts were cleared in browser


exceptionThrown

Issued when exception was thrown and unhandled.

Parameters
timestamp Timestamp Timestamp of the exception.
exceptionDetails ExceptionDetails

Types

ScriptId string

Unique script identifier.


RemoteObjectId string

Unique object identifier.


UnserializableValue string

Primitive value which cannot be JSON-stringified.

Allowed Values

Infinity, NaN, -Infinity, -0


RemoteObject object

Mirror object referencing original JavaScript object.

Properties
type string
Allowed values: object, function, undefined, string, number, boolean, symbol
Object type.
subtype
optional
string
Allowed values: null, error, promise
Object subtype hint. Specified for object type values only.
className
optional
string Object class (constructor) name. Specified for object type values only.
value
optional
any Remote object value in case of primitive values or JSON values (if it was requested).
unserializableValue
optional
UnserializableValue Primitive value which can not be JSON-stringified does not have value, but gets this property.
description
optional
string String representation of the object.
objectId
optional
RemoteObjectId Unique object identifier (for non-primitive values).
msDebuggerPropertyId
optional
string Experimental. Microsoft: The associated debugger property id for this object.

PropertyDescriptor object

Object property descriptor.

Properties
name string Property name or symbol description.
value
optional
RemoteObject The value associated with the property.
writable
optional
boolean True if the value associated with the property may be changed (data descriptors only).
get
optional
RemoteObject A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only).
set
optional
RemoteObject A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only).
configurable boolean True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
enumerable boolean True if this property shows up during enumeration of the properties on the corresponding object.
wasThrown
optional
boolean True if the result was thrown during the evaluation.
isOwn
optional
boolean True if the property is owned for the object.
msReturnValue
optional
boolean Experimental. Microsoft: True if the property is a return value.
symbol
optional
RemoteObject Property symbol object, if the property is of the `symbol` type.

CallArgument object

Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified.

Properties
value
optional
any Primitive value or serializable javascript object.
unserializableValue
optional
UnserializableValue Primitive value which can not be JSON-stringified.
objectId
optional
RemoteObjectId Remote object handle.

ExecutionContextId integer

Id of an execution context.


ExceptionDetails object

Detailed information about exception (or error) that was thrown during script compilation or execution.

Properties
exceptionId integer Exception id.
text string Exception text, which should be used together with exception object when available.
lineNumber integer Line number of the exception location (0-based).
columnNumber integer Column number of the exception location (0-based).
scriptId
optional
ScriptId Script ID of the exception location.
url
optional
string URL of the exception location, to be used when the script was not reported.
stackTrace
optional
StackTrace JavaScript stack trace if available.
exception
optional
RemoteObject Exception object if available.
executionContextId
optional
ExecutionContextId Identifier of the context where exception happened.

Timestamp integer

Number of milliseconds since epoch.


CallFrame object

Stack entry for runtime errors and assertions.

Properties
functionName string JavaScript function name.
scriptId ScriptId JavaScript script id.
url string JavaScript script name or url.
lineNumber integer JavaScript script line number (0-based).
columnNumber integer JavaScript script column number (0-based).

StackTrace object

Call frames for assertions or error messages.

Properties
description
optional
string String label of this stack trace. For async traces this may be a name of the function that initiated the async call.
callFrames CallFrame[] JavaScript function name.
parent
optional
StackTrace Asynchronous JavaScript stack trace that preceded this stack, if available.