23 KiB
Runtime
_Auto generated documentation for WebKit inspector
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
- parse
- evaluate
- callFunctionOn
- getProperties
- getDisplayableProperties
- getCollectionEntries
- saveResult
- releaseObject
- releaseObjectGroup
- run
- enable
- disable
- getRuntimeTypesForVariablesAtOffsets
- enableTypeProfiler
- disableTypeProfiler
- getBasicBlocks
- Events
- executionContextCreated
- Types
- RemoteObjectId
- RemoteObject
- ObjectPreview
- PropertyPreview
- EntryPreview
- CollectionEntry
- PropertyDescriptor
- InternalPropertyDescriptor
- CallArgument
- ExecutionContextId
- ExecutionContextDescription
- SyntaxErrorType
- ErrorRange
- StructureDescription
- TypeSet
- TypeDescription
- TypeLocation
- BasicBlock
Commands
Runtime.parse(source, callback)
Parses JavaScript source code for errors.
Parameters
source ( string )
Source code to parse.
callback ( function )
Results
error ( error )
result ( SyntaxErrorType )
Parse result.
message ( optional string )
Parse error message.
range ( optional ErrorRange )
Range in the source where the error occurred.
Runtime.evaluate(expression, [objectGroup], [includeCommandLineAPI], [doNotPauseOnExceptionsAndMuteConsole], [Runtime.ExecutionContextId], [returnByValue], [generatePreview], [saveResult], callback)
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.
includeCommandLineAPI ( optional boolean )
Determines whether Command Line API should be available during the evaluation.
doNotPauseOnExceptionsAndMuteConsole ( optional boolean )
Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.
contextId ( optional Runtime.ExecutionContextId )
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.
generatePreview ( optional boolean )
Whether preview should be generated for the result.
saveResult ( optional boolean )
Whether the resulting value should be considered for saving in the $n history.
callback ( function )
Results
error ( error )
result ( RemoteObject )
Evaluation result.
wasThrown ( optional boolean )
True if the result was thrown during the evaluation.
savedResultIndex ( optional integer )
If the result was saved, this is the $n index that can be used to access the value.
Runtime.callFunctionOn(RemoteObjectId, functionDeclaration, [CallArgument], [doNotPauseOnExceptionsAndMuteConsole], [returnByValue], [generatePreview], callback)
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
Parameters
objectId ( RemoteObjectId )
Identifier of the object to call function on.
functionDeclaration ( string )
Declaration of the function to call.
arguments ( optional array of CallArgument )
Call arguments. All call arguments must belong to the same JavaScript world as the target object.
doNotPauseOnExceptionsAndMuteConsole ( optional boolean )
Specifies whether function call should stop on exceptions and mute console. Overrides setPauseOnException state.
returnByValue ( optional boolean )
Whether the result is expected to be a JSON object which should be sent by value.
generatePreview ( optional boolean )
Whether preview should be generated for the result.
callback ( function )
Results
error ( error )
result ( RemoteObject )
Call result.
wasThrown ( optional boolean )
True if the result was thrown during the evaluation.
Runtime.getProperties(RemoteObjectId, [ownProperties], [generatePreview], callback)
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.
ownProperties ( optional boolean )
If true, returns properties belonging only to the object itself, not to its prototype chain.
generatePreview ( optional boolean )
Whether preview should be generated for property values.
callback ( function )
Results
error ( error )
result ( array of PropertyDescriptor )
Object properties.
internalProperties ( optional array of InternalPropertyDescriptor )
Internal object properties.
Runtime.getDisplayableProperties(RemoteObjectId, [generatePreview], callback)
Returns displayable properties of a given object. Object group of the result is inherited from the target object. Displayable properties are own properties, internal properties, and native getters in the prototype chain (assumed to be bindings and treated like own properties for the frontend).
Parameters
objectId ( RemoteObjectId )
Identifier of the object to return properties for.
generatePreview ( optional boolean )
Whether preview should be generated for property values.
callback ( function )
Results
error ( error )
properties ( array of PropertyDescriptor )
Object properties.
internalProperties ( optional array of InternalPropertyDescriptor )
Internal object properties.
Runtime.getCollectionEntries(Runtime.RemoteObjectId, [objectGroup], [startIndex], [numberToFetch], callback)
Returns entries of given Map / Set collection.
Parameters
objectId ( Runtime.RemoteObjectId )
Id of the collection to get entries for.
objectGroup ( optional string )
Symbolic group name that can be used to release multiple. If not provided, it will be the same objectGroup as the RemoteObject determined from
objectId. This is useful for WeakMap to release the collection entries.
startIndex ( optional integer )
If provided skip to this index before collecting values. Otherwise, 0.
numberToFetch ( optional integer )
If provided only return
numberToFetchvalues. Otherwise, return values all the way to the end.
callback ( function )
Results
error ( error )
entries ( array of CollectionEntry )
Array of collection entries.
Runtime.saveResult(CallArgument, [ExecutionContextId], callback)
Assign a saved result index to this value.
Parameters
value ( CallArgument )
Id or value of the object to save.
contextId ( optional ExecutionContextId )
Unique id of the execution context. To specify in which execution context script evaluation should be performed. If not provided, determine from the CallArgument's objectId.
callback ( function )
Results
error ( error )
savedResultIndex ( optional integer )
If the value was saved, this is the $n index that can be used to access the value.
Runtime.releaseObject(RemoteObjectId, callback)
Releases remote object with given id.
Parameters
objectId ( RemoteObjectId )
Identifier of the object to release.
callback ( function )
Results
error ( error )
Runtime.releaseObjectGroup(objectGroup, callback)
Releases all remote objects that belong to a given group.
Parameters
objectGroup ( string )
Symbolic object group name.
callback ( function )
Results
error ( error )
Runtime.run(callback)
Tells inspected instance(worker or page) that it can run in case it was started paused.
Parameters
callback ( function )
Results
error ( error )
Runtime.enable(callback)
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.
Parameters
callback ( function )
Results
error ( error )
Runtime.disable(callback)
Disables reporting of execution contexts creation.
Parameters
callback ( function )
Results
error ( error )
Runtime.getRuntimeTypesForVariablesAtOffsets(TypeLocation, callback)
Returns detailed informtation on given function.
Parameters
locations ( array of TypeLocation )
An array of type locations we're requesting information for. Results are expected in the same order they're sent in.
callback ( function )
Results
error ( error )
types ( array of TypeDescription )
Runtime.enableTypeProfiler(callback)
Enables type profiling on the VM.
Parameters
callback ( function )
Results
error ( error )
Runtime.disableTypeProfiler(callback)
Disables type profiling on the VM.
Parameters
callback ( function )
Results
error ( error )
Runtime.getBasicBlocks(sourceID, callback)
Returns a list of basic blocks for the given sourceID with information about their text ranges and whether or not they have executed.
Parameters
sourceID ( string )
Indicates which sourceID information is requested for.
callback ( function )
Results
error ( error )
basicBlocks ( array of BasicBlock )
Events
Event: executionContextCreated
Issued when new execution context is created.
Results
context ( ExecutionContextDescription )
A newly created execution contex.
Types
Class: RemoteObjectId
Type: string
Unique object identifier.
Class: RemoteObject
Type: object
Mirror object referencing original JavaScript object.
Properties
type ( string enumerated ["object","function","undefined","string","number","boolean","symbol"] )
Object type.
subtype ( optional string enumerated ["array","null","node","regexp","date","error","map","set","weakmap","iterator"] )
Object subtype hint. Specified for
objecttype values only.
className ( optional string )
Object class (constructor) name. Specified for
objecttype values only.
value ( optional any )
Remote object value (in case of primitive values or JSON values if it was requested).
description ( optional string )
String representation of the object.
objectId ( optional RemoteObjectId )
Unique object identifier (for non-primitive values).
size ( optional integer )
Size of the array/collection. Specified for array/map/set/weakmap object type values only.
preview ( optional ObjectPreview )
Preview containing abbreviated property values. Specified for
objecttype values only.
Class: ObjectPreview
Type: object
Object containing abbreviated remote object value.
Properties
type ( string enumerated ["object","function","undefined","string","number","boolean","symbol"] )
Object type.
subtype ( optional string enumerated ["array","null","node","regexp","date","error","map","set","weakmap","iterator"] )
Object subtype hint. Specified for
objecttype values only.
description ( optional string )
String representation of the object.
lossless ( boolean )
Determines whether preview is lossless (contains all information of the original object).
overflow ( optional boolean )
True iff some of the properties of the original did not fit.
properties ( optional array of PropertyPreview )
List of the properties.
entries ( optional array of EntryPreview )
List of the entries. Specified for
mapandsetsubtype values only.
size ( optional integer )
Size of the array/collection. Specified for array/map/set/weakmap object type values only.
Class: PropertyPreview
Type: object
Properties
name ( string )
Property name.
type ( string enumerated ["object","function","undefined","string","number","boolean","symbol","accessor"] )
Object type.
subtype ( optional string enumerated ["array","null","node","regexp","date","error","map","set","weakmap","iterator"] )
Object subtype hint. Specified for
objecttype values only.
value ( optional string )
User-friendly property value string.
valuePreview ( optional ObjectPreview )
Nested value preview.
internal ( optional boolean )
True if this is an internal property.
Class: EntryPreview
Type: object
Properties
key ( optional ObjectPreview )
Entry key. Specified for map-like collection entries.
value ( ObjectPreview )
Entry value.
Class: CollectionEntry
Type: object
Properties
key ( optional Runtime.RemoteObject )
Entry key of a map-like collection, otherwise not provided.
value ( Runtime.RemoteObject )
Entry value.
Class: PropertyDescriptor
Type: object
Object property descriptor.
Properties
name ( string )
Property name.
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
undefinedif there is no getter (accessor descriptors only).
set ( optional RemoteObject )
A function which serves as a setter for the property, or
undefinedif 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.
nativeGetter ( optional boolean )
True if the property value came from a native getter.
Class: InternalPropertyDescriptor
Type: object
Object internal property descriptor. This property isn't normally visible in JavaScript code.
Properties
name ( string )
Conventional property name.
value ( optional RemoteObject )
The value associated with the property.
Class: CallArgument
Type: object
Represents function call argument. Either remote object id objectId or primitive value or neither of (for undefined) them should be specified.
Properties
value ( optional any )
Primitive value.
objectId ( optional RemoteObjectId )
Remote object handle.
Class: ExecutionContextId
Type: integer
Id of an execution context.
Class: ExecutionContextDescription
Type: object
Description of an isolated world.
Properties
id ( ExecutionContextId )
Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed.
isPageContext ( boolean )
True if this is a context where inpspected web page scripts run. False if it is a content script isolated context.
name ( string )
Human readable name describing given context.
frameId ( Network.FrameId )
Id of the owning frame.
Class: SyntaxErrorType
Type: string
Syntax error type: "none" for no error, "irrecoverable" for unrecoverable errors, "unterminated-literal" for when there is an unterminated literal, "recoverable" for when the expression is unfinished but valid so far.
Class: ErrorRange
Type: object
Range of an error in source code.
Properties
startOffset ( integer )
Start offset of range (inclusive).
endOffset ( integer )
End offset of range (exclusive).
Class: StructureDescription
Type: object
Properties
fields ( optional array )
Array of strings, where the strings represent object properties.
optionalFields ( optional array )
Array of strings, where the strings represent optional object properties.
constructorName ( optional string )
Name of the constructor.
prototypeStructure ( optional StructureDescription )
Pointer to the StructureRepresentation of the protoype if one exists.
isImprecise ( optional boolean )
If true, it indicates that the fields in this StructureDescription may be inaccurate. I.e, there might have been fields that have been deleted before it was profiled or it has fields we haven't profiled.
Class: TypeSet
Type: object
Properties
isFunction ( boolean )
Indicates if this type description has been type Function.
isUndefined ( boolean )
Indicates if this type description has been type Undefined.
isNull ( boolean )
Indicates if this type description has been type Null.
isBoolean ( boolean )
Indicates if this type description has been type Boolean.
isInteger ( boolean )
Indicates if this type description has been type Integer.
isNumber ( boolean )
Indicates if this type description has been type Number.
isString ( boolean )
Indicates if this type description has been type String.
isObject ( boolean )
Indicates if this type description has been type Object.
Class: TypeDescription
Type: object
Container for type information that has been gathered.
Properties
isValid ( boolean )
If true, we were able to correlate the offset successfuly with a program location. If false, the offset may be bogus or the offset may be from a CodeBlock that hasn't executed.
leastCommonAncestor ( optional string )
Least common ancestor of all Constructors if the TypeDescription has seen any structures. This string is the display name of the shared constructor function.
typeSet ( optional TypeSet )
Set of booleans for determining the aggregate type of this type description.
structures ( optional array of StructureDescription )
Array of descriptions for all structures seen for this variable.
isTruncated ( optional boolean )
If true, this indicates that no more structures are being profiled because some maximum threshold has been reached and profiling has stopped because of memory pressure.
Class: TypeLocation
Type: object
Describes the location of an expression we want type information for.
Properties
typeInformationDescriptor ( integer )
What kind of type information do we want (normal, function return values, 'this' statement).
sourceID ( string )
sourceID uniquely identifying a script
divot ( integer )
character offset for assignment range
Class: BasicBlock
Type: object
From Wikipedia: a basic block is a portion of the code within a program with only one entry point and only one exit point. This type gives the location of a basic block and if that basic block has executed.
Properties
startOffset ( integer )
Start offset of the basic block.
endOffset ( integer )
End offset of the basic block.
hasExecuted ( boolean )
Indicates if the basic block has executed before.