Skip to content

Latest commit

 

History

History
859 lines (762 loc) · 26.9 KB

File metadata and controls

859 lines (762 loc) · 26.9 KB
description title author ms.author ms.date ms.topic ms.prod
Reference for the Runtime Domain. 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.
Runtime Domain - DevTools Protocol Version 0.2
pelavall
pelavall
8/17/2018
reference
microsoft-edge

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, awaitPromise, getProperties, globalLexicalScopeNames, releaseObject, releaseObjectGroup, discardConsoleEntries
Events executionContextCreated, executionContextDestroyed, executionContextsCleared, exceptionThrown, consoleAPICalled
Types ScriptId, RemoteObjectId, UnserializableValue, RemoteObject, PropertyDescriptor, CallArgument, ExecutionContextId, ExecutionContextDescription, ExceptionDetails, Timestamp, CallFrame, StackTrace

Methods

enable

Enables reporting of the executionContextCreated, executionContextDestroyed and executionContextsCleared events. When the reporting gets enabled the executionContextCreated event will be sent immediately for each existing execution context.


disable

Disables reporting of the executionContextCreated, executionContextDestroyed and executionContextsCleared events.


evaluate

Evaluates expression on global object.

Parameters
expression string Expression to evaluate.
includeCommandLineAPI
optional
boolean Determines whether Command Line API should be available during the evaluation.
objectGroup
optional
string Symbolic group name that can be used to release multiple objects.
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.
executionContextId
optional
ExecutionContextId Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
objectGroup
optional
string 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.
Returns
result RemoteObject Call result.


awaitPromise

Add handler to promise with given promise object id.

Parameters
promiseObjectId RemoteObjectId Identifier of the promise.
returnByValue
optional
boolean Whether the result is expected to be a JSON object that should be sent by value.
Returns
result RemoteObject Promise result. Will contain rejected value if promise was rejected.


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.


globalLexicalScopeNames

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

Returns
names string[]


releaseObject

Releases remote object with given id.

Parameters
objectId RemoteObjectId Identifier of the object to release.


releaseObjectGroup

Releases all remote objects that belong to a given group.

Parameters
objectGroup string Symbolic object group name.


discardConsoleEntries

Discards collected exceptions and console API calls.


Events

executionContextCreated

Issued when new execution context is created.

Parameters
context ExecutionContextDescription A newly created execution context.


executionContextDestroyed

Issued when execution context is destroyed.

Parameters
executionContextId ExecutionContextId Id of the destroyed context


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


consoleAPICalled

Parameters
type string
Allowed values: log, info, warning, error, debug, assert, table, trace, dir, dirxml, clear, select, count, countReset, timeEnd, timeStamp, startGroup, startGroupCollapsed, endGroup
Type of the call. This includes log, info, warn, error, debug, assert, table, trace, dir, dirxml, clear, select, count, countReset, timeEnd, exception, timeStamp, group, groupCollapsed, groupEnd.
args RemoteObject[] Call arguments.
executionContextId ExecutionContextId Identifier of the context where console call was made
timestamp
optional
Timestamp Call timestamp.
stackTrace
optional
StackTrace Stack trace captured if available


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, node
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.


ExecutionContextDescription 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.
origin string Execution context origin.
name string Human readable name describing given 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. ScriptId will be empty if debugger is not enabled.
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.