src/domains/runtime

Search:
Group by:

This module provides a direct mapping of CDP events and commands for v1.3 (stable) of 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 or are released along with the other objects in their object group.

Types

Runtime {.pure.} = enum
  consoleAPICalled = "Runtime.consoleAPICalled",
  executionContextCreated = "Runtime.executionContextCreated",
  executionContextDestroyed = "Runtime.executionContextDestroyed",
  executionContextCleared = "Runtime.executionContextCleared",
  exceptionThrown = "Runtime.exceptionThrown",
  exceptionRevoked = "Runtime.exceptionRevoked",
  inspectRequested = "Runtime.inspectRequested"
Runtime Domain events

Procs

proc addBinding(tab: Tab; name: string): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc addBinding(tab: Tab; name: string; params: JsonNode): owned(
    Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.addBinding

This method is interesting and has nuances regarding parameters. Visit the link above for more information.

proc awaitPromise(tab: Tab; promiseObjectId: string; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

Runtime.awaitPromise

Add handler to promise with given promise object id.

proc awaitPromist(tab: Tab; promiseObjectId: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc callFunctionOn(tab: Tab; functionDeclaration: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc callFunctionOn(tab: Tab; functionDeclaration: string; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

Runtime.callFunctionOn

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

proc compileScript(tab: Tab; expression, sourceURL, persistScript: string): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}
proc compileScript(tab: Tab; expression, sourceURL: string; persistScript: bool;
                   params: JsonNode): Future[JsonNode] {....stackTrace: false,
    raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.compileScript

Compiles expression.

proc disableRuntimeDomain(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.disable

Disables reporting of execution contexts creation.

proc discardConsoleEntries(tab: Tab): Future[JsonNode] {....stackTrace: false,
    raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.discardConsoleEntries

Discards collected exceptions and console API calls.

proc enableRuntimeDomain(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.enable

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.

proc evaluate(tab: Tab; expression: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc evaluate(tab: Tab; expression: string; params: JsonNode): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.evaluate

Evaluates expression on global object.

proc getProperties(tab: Tab; objectId: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc getProperties(tab: Tab; objectId: string; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

Runtime.getProperties

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

proc globalLexicalScopeNames(tab: Tab): Future[JsonNode] {....stackTrace: false,
    raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc globalLexicalScopeNames(tab: Tab; executionContextId: string): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}

Runtime.globalLexicalScopeNames

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

proc queryObjects(tab: Tab; prototypeObjectId: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc queryObjects(tab: Tab; prototypeObjectId: string; params: JsonNode): Future[
    JsonNode] {....stackTrace: false, raises: [Exception, ValueError],
                tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect],
                forbids: [].}
Runtime.queryObjects
proc releaseObject(tab: Tab; objectId: string): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.releaseObject

Releases remote object with given id.

proc releaseObjectGroup(tab: Tab; objectGroup: string): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.releaseObjectGroup

Releases all remote objects that belong to a given group.

proc removeBinding(tab: Tab; name: string): owned(Future[void]) {.
    ...stackTrace: false, raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.removeBinding

This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.

proc runIfWaitingForDebugger(tab: Tab): owned(Future[void]) {....stackTrace: false,
    raises: [Exception],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.runIfWaitingForDebugger

Tells inspected instance to run if it was waiting for debugger to attach.

proc runScript(tab: Tab; scriptId: string): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}
proc runScript(tab: Tab; scriptId: string; params: JsonNode): Future[JsonNode] {.
    ...stackTrace: false, raises: [Exception, ValueError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.runScript

Runs script with given id in a given context.

proc setAsyncCallStackDepthRuntimeDomain(tab: Tab; maxDepth: int): owned(
    Future[void]) {....stackTrace: false, raises: [Exception], tags: [RootEffect,
    WriteIOEffect, ReadIOEffect, TimeEffect], forbids: [].}

Runtime.setAsyncCallStackDepth

Enables or disables async call stacks tracking.