RuntimeApi class
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.
Constructors
- RuntimeApi(Client _client)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onBindingCalled
→ Stream<
BindingCalledEvent> -
Notification is issued every time when binding is called.
no setter
-
onConsoleAPICalled
→ Stream<
ConsoleAPICalledEvent> -
Issued when console API was called.
no setter
-
onExceptionRevoked
→ Stream<
ExceptionRevokedEvent> -
Issued when unhandled exception was revoked.
no setter
-
onExceptionThrown
→ Stream<
ExceptionThrownEvent> -
Issued when exception was thrown and unhandled.
no setter
-
onExecutionContextCreated
→ Stream<
ExecutionContextDescription> -
Issued when new execution context is created.
no setter
-
onExecutionContextDestroyed
→ Stream<
ExecutionContextDestroyedEvent> -
Issued when execution context is destroyed.
no setter
-
onExecutionContextsCleared
→ Stream<
void> -
Issued when all executionContexts were cleared in browser
no setter
-
onInspectRequested
→ Stream<
InspectRequestedEvent> -
Issued when object should be inspected (for example, as a result of inspect() command line API
call).
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addBinding(
String name, {ExecutionContextId? executionContextId, String? executionContextName}) → Future< void> -
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.
executionContextNameIf specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See alsoExecutionContext.nameandworldNameparameter toPage.addScriptToEvaluateOnNewDocument. This parameter is mutually exclusive withexecutionContextId. -
awaitPromise(
RemoteObjectId promiseObjectId, {bool? returnByValue, bool? generatePreview}) → Future< AwaitPromiseResult> -
Add handler to promise with given promise object id.
promiseObjectIdIdentifier of the promise.returnByValueWhether the result is expected to be a JSON object that should be sent by value.generatePreviewWhether preview should be generated for the result. -
callFunctionOn(
String functionDeclaration, {RemoteObjectId? objectId, List< CallArgument> ? arguments, bool? silent, bool? returnByValue, bool? generatePreview, bool? userGesture, bool? awaitPromise, ExecutionContextId? executionContextId, String? objectGroup, bool? throwOnSideEffect, String? uniqueContextId, SerializationOptions? serializationOptions}) → Future<CallFunctionOnResult> -
Calls function with given declaration on the given object. Object group of the result is
inherited from the target object.
functionDeclarationDeclaration of the function to call.objectIdIdentifier of the object to call function on. Either objectId or executionContextId should be specified.argumentsCall arguments. All call arguments must belong to the same JavaScript world as the target object.silentIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnExceptionstate.returnByValueWhether the result is expected to be a JSON object which should be sent by value. Can be overriden byserializationOptions.generatePreviewWhether preview should be generated for the result.userGestureWhether execution should be treated as initiated by user in the UI.awaitPromiseWhether execution shouldawaitfor resulting value and return once awaited promise is resolved.executionContextIdSpecifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.objectGroupSymbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.throwOnSideEffectWhether to throw an exception if side effect cannot be ruled out during evaluation.uniqueContextIdAn alternative way to specify the execution context to call function on. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental function call in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive withexecutionContextId.serializationOptionsSpecifies the result serialization. If provided, overridesgeneratePreviewandreturnByValue. -
compileScript(
String expression, String sourceURL, bool persistScript, {ExecutionContextId? executionContextId}) → Future< CompileScriptResult> -
Compiles expression.
expressionExpression to compile.sourceURLSource url to be set for the script.persistScriptSpecifies whether the compiled script should be persisted.executionContextIdSpecifies 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. -
disable(
) → Future< void> - Disables reporting of execution contexts creation.
-
discardConsoleEntries(
) → Future< void> - Discards collected exceptions and console API calls.
-
enable(
) → Future< void> -
Enables reporting of execution contexts creation by means of
executionContextCreatedevent. When the reporting gets enabled the event will be sent immediately for each existing execution context. -
evaluate(
String expression, {String? objectGroup, bool? includeCommandLineAPI, bool? silent, ExecutionContextId? contextId, bool? returnByValue, bool? generatePreview, bool? userGesture, bool? awaitPromise, bool? throwOnSideEffect, TimeDelta? timeout, bool? disableBreaks, bool? replMode, bool? allowUnsafeEvalBlockedByCSP, String? uniqueContextId, SerializationOptions? serializationOptions}) → Future< EvaluateResult> -
Evaluates expression on global object.
expressionExpression to evaluate.objectGroupSymbolic group name that can be used to release multiple objects.includeCommandLineAPIDetermines whether Command Line API should be available during the evaluation.silentIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnExceptionstate.contextIdSpecifies 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 withuniqueContextId, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.returnByValueWhether the result is expected to be a JSON object that should be sent by value.generatePreviewWhether preview should be generated for the result.userGestureWhether execution should be treated as initiated by user in the UI.awaitPromiseWhether execution shouldawaitfor resulting value and return once awaited promise is resolved.throwOnSideEffectWhether to throw an exception if side effect cannot be ruled out during evaluation. This impliesdisableBreaksbelow.timeoutTerminate execution after timing out (number of milliseconds).disableBreaksDisable breakpoints during execution.replModeSetting this flag to true enablesletre-declaration and top-levelawait. Note thatletvariables can only be re-declared if they originate fromreplModethemselves.allowUnsafeEvalBlockedByCSPThe 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.uniqueContextIdAn 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 withcontextId.serializationOptionsSpecifies the result serialization. If provided, overridesgeneratePreviewandreturnByValue. -
getExceptionDetails(
RemoteObjectId errorObjectId) → Future< ExceptionDetails> -
This method tries to lookup and populate exception details for a
JavaScript Error object.
Note that the stackTrace portion of the resulting exceptionDetails will
only be populated if the Runtime domain was enabled at the time when the
Error was thrown.
errorObjectIdThe error object for which to resolve the exception details. -
getHeapUsage(
) → Future< GetHeapUsageResult> - Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.
-
getIsolateId(
) → Future< String> - Returns the isolate id. Returns: The isolate id.
-
getProperties(
RemoteObjectId objectId, {bool? ownProperties, bool? accessorPropertiesOnly, bool? generatePreview, bool? nonIndexedPropertiesOnly}) → Future< GetPropertiesResult> -
Returns properties of a given object. Object group of the result is inherited from the target
object.
objectIdIdentifier of the object to return properties for.ownPropertiesIf true, returns properties belonging only to the element itself, not to its prototype chain.accessorPropertiesOnlyIf true, returns accessor properties (with getter/setter) only; internal properties are not returned either.generatePreviewWhether preview should be generated for the results.nonIndexedPropertiesOnlyIf true, returns non-indexed properties only. -
globalLexicalScopeNames(
{ExecutionContextId? executionContextId}) → Future< List< String> > -
Returns all let, const and class variables from global scope.
executionContextIdSpecifies in which execution context to lookup global scope variables. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
queryObjects(
RemoteObjectId prototypeObjectId, {String? objectGroup}) → Future< RemoteObject> -
prototypeObjectIdIdentifier of the prototype to return objects for.objectGroupSymbolic group name that can be used to release the results. Returns: Array with objects. -
releaseObject(
RemoteObjectId objectId) → Future< void> -
Releases remote object with given id.
objectIdIdentifier of the object to release. -
releaseObjectGroup(
String objectGroup) → Future< void> -
Releases all remote objects that belong to a given group.
objectGroupSymbolic object group name. -
removeBinding(
String name) → Future< void> - This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.
-
runIfWaitingForDebugger(
) → Future< void> - Tells inspected instance to run if it was waiting for debugger to attach.
-
runScript(
ScriptId scriptId, {ExecutionContextId? executionContextId, String? objectGroup, bool? silent, bool? includeCommandLineAPI, bool? returnByValue, bool? generatePreview, bool? awaitPromise}) → Future< RunScriptResult> -
Runs script with given id in a given context.
scriptIdId of the script to run.executionContextIdSpecifies 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.objectGroupSymbolic group name that can be used to release multiple objects.silentIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnExceptionstate.includeCommandLineAPIDetermines whether Command Line API should be available during the evaluation.returnByValueWhether the result is expected to be a JSON object which should be sent by value.generatePreviewWhether preview should be generated for the result.awaitPromiseWhether execution shouldawaitfor resulting value and return once awaited promise is resolved. -
setAsyncCallStackDepth(
int maxDepth) → Future< void> -
Enables or disables async call stacks tracking.
maxDepthMaximum depth of async call stacks. Setting to0will effectively disable collecting async call stacks (default). -
setCustomObjectFormatterEnabled(
bool enabled) → Future< void> -
setMaxCallStackSizeToCapture(
int size) → Future< void> -
terminateExecution(
) → Future< void> - Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited