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.
Commands
Runtime.callFunctionOn
request: {
"id": <number>,
"method": "Runtime.callFunctionOn",
"params": {
"
objectId": <
RemoteObjectId>,
"
functionDeclaration": <string>,
"
arguments": <array of
CallArgument>,
"
returnByValue": <boolean>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
"
result": <
RemoteObject>,
"
wasThrown": <boolean>
}
}
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
Parameters
objectId
Identifier of the object to call function on.
functionDeclaration
(
string
)
Declaration of the function to call.
arguments
Call arguments. All call arguments must belong to the same JavaScript world as the target object.
returnByValue
(
optional
boolean
)
Whether the result is expected to be a JSON object which should be sent by value.
Returns
wasThrown
(
optional
boolean
)
True if the result was thrown during the evaluation.
Runtime.enable
request: {
"id": <number>,
"method": "Runtime.enable"
}
response: {
"id": <number>,
"error": <object>
}
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.
Runtime.evaluate
request: {
"id": <number>,
"method": "Runtime.evaluate",
"params": {
"
expression": <string>,
"
objectGroup": <string>,
"
contextId": <
Runtime.ExecutionContextId>,
"
returnByValue": <boolean>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
"
result": <
RemoteObject>,
"
wasThrown": <boolean>
}
}
Evaluates expression on global object.
Parameters
expression
(
string
)
Expression to evaluate.
objectGroup
(
optional
string
)
Symbolic group name that can be used to release multiple objects.
contextId
Specifies in which isolated context to perform evaluation. Each content script lives in an isolated context and this parameter may be used to specify one of those contexts. If the parameter is omitted or 0 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.
Returns
result
Evaluation result.
wasThrown
(
optional
boolean
)
True if the result was thrown during the evaluation.
Runtime.getProperties
request: {
"id": <number>,
"method": "Runtime.getProperties",
"params": {
"
objectId": <
RemoteObjectId>,
"
ownProperties": <boolean>
}
}
response: {
"id": <number>,
"error": <object>,
"result": {
"
result": <array of
PropertyDescriptor>
}
}
Returns properties of a given object. Object group of the result is inherited from the target object.
Parameters
objectId
Identifier of the object to return properties for.
ownProperties
(
optional
boolean
)
If true, returns properties belonging only to the element itself, not to its prototype chain.
Returns
result
Object properties.
Runtime.releaseObject
request: {
"id": <number>,
"method": "Runtime.releaseObject",
"params": {
"
objectId": <
RemoteObjectId>
}
}
response: {
"id": <number>,
"error": <object>
}
Releases remote object with given id.
Parameters
objectId
Identifier of the object to release.
Runtime.releaseObjectGroup
request: {
"id": <number>,
"method": "Runtime.releaseObjectGroup",
"params": {
"
objectGroup": <string>
}
}
response: {
"id": <number>,
"error": <object>
}
Releases all remote objects that belong to a given group.
Parameters
objectGroup
(
string
)
Symbolic object group name.
Notifications
Runtime.executionContextCreated
Issued when new execution context is created.
Parameters
context
A newly created execution contex.
Types
CallArgument: object
objectId
Remote object handle.
value
(
optional
any
)
Primitive value.
ExecutionContextDescription: object
frameId
Id of the owning frame.
id
Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed.
ExecutionContextId: integer
PropertyDescriptor: object
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.
get
A function which serves as a getter for the property, or undefined
if there is no getter (accessor descriptors only).
name
(
string
)
Property name.
set
A function which serves as a setter for the property, or undefined
if there is no setter (accessor descriptors only).
value
The value associated with the property.
wasThrown
(
optional
boolean
)
True if the result was thrown during the evaluation.
writable
(
optional
boolean
)
True if the value associated with the property may be changed (data descriptors only).
RemoteObject: object
className
(
optional
string
)
Object class (constructor) name. Specified for object
type values only.
description
(
optional
string
)
String representation of the object.
objectId
Unique object identifier (for non-primitive values).
subtype
(
optional
enumerated
string
[
"array"
,
"date"
,
"node"
,
"null"
,
"regexp"
]
)
Object subtype hint. Specified for object
type values only.
type
(
enumerated
string
[
"boolean"
,
"function"
,
"number"
,
"object"
,
"string"
,
"undefined"
]
)
Object type.
value
(
optional
any
)
Remote object value (in case of primitive values or JSON values if it was requested).