Class Runtime


  • public class Runtime
    extends java.lang.Object
    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.
    • Constructor Detail

      • Runtime

        public Runtime()
    • Method Detail

      • awaitPromise

        public static Command<Runtime.AwaitPromiseResponse> awaitPromise​(RemoteObjectId promiseObjectId,
                                                                         java.util.Optional<java.lang.Boolean> returnByValue,
                                                                         java.util.Optional<java.lang.Boolean> generatePreview)
        Add handler to promise with given promise object id.
      • callFunctionOn

        public static Command<Runtime.CallFunctionOnResponse> callFunctionOn​(java.lang.String functionDeclaration,
                                                                             java.util.Optional<RemoteObjectId> objectId,
                                                                             java.util.Optional<java.util.List<CallArgument>> arguments,
                                                                             java.util.Optional<java.lang.Boolean> silent,
                                                                             java.util.Optional<java.lang.Boolean> returnByValue,
                                                                             java.util.Optional<java.lang.Boolean> generatePreview,
                                                                             java.util.Optional<java.lang.Boolean> userGesture,
                                                                             java.util.Optional<java.lang.Boolean> awaitPromise,
                                                                             java.util.Optional<ExecutionContextId> executionContextId,
                                                                             java.util.Optional<java.lang.String> objectGroup)
        Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
      • disable

        public static Command<java.lang.Void> disable()
        Disables reporting of execution contexts creation.
      • discardConsoleEntries

        public static Command<java.lang.Void> discardConsoleEntries()
        Discards collected exceptions and console API calls.
      • enable

        public static Command<java.lang.Void> 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.
      • evaluate

        public static Command<Runtime.EvaluateResponse> evaluate​(java.lang.String expression,
                                                                 java.util.Optional<java.lang.String> objectGroup,
                                                                 java.util.Optional<java.lang.Boolean> includeCommandLineAPI,
                                                                 java.util.Optional<java.lang.Boolean> silent,
                                                                 java.util.Optional<ExecutionContextId> contextId,
                                                                 java.util.Optional<java.lang.Boolean> returnByValue,
                                                                 java.util.Optional<java.lang.Boolean> generatePreview,
                                                                 java.util.Optional<java.lang.Boolean> userGesture,
                                                                 java.util.Optional<java.lang.Boolean> awaitPromise,
                                                                 java.util.Optional<java.lang.Boolean> throwOnSideEffect,
                                                                 java.util.Optional<TimeDelta> timeout)
        Evaluates expression on global object.
      • getIsolateId

        @Beta
        public static Command<java.lang.String> getIsolateId()
        Returns the isolate id.
      • getHeapUsage

        @Beta
        public static Command<Runtime.GetHeapUsageResponse> getHeapUsage()
        Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.
      • getProperties

        public static Command<Runtime.GetPropertiesResponse> getProperties​(RemoteObjectId objectId,
                                                                           java.util.Optional<java.lang.Boolean> ownProperties,
                                                                           java.util.Optional<java.lang.Boolean> accessorPropertiesOnly,
                                                                           java.util.Optional<java.lang.Boolean> generatePreview)
        Returns properties of a given object. Object group of the result is inherited from the target object.
      • globalLexicalScopeNames

        public static Command<java.util.List<java.lang.String>> globalLexicalScopeNames​(java.util.Optional<ExecutionContextId> executionContextId)
        Returns all let, const and class variables from global scope.
      • releaseObject

        public static Command<java.lang.Void> releaseObject​(RemoteObjectId objectId)
        Releases remote object with given id.
      • releaseObjectGroup

        public static Command<java.lang.Void> releaseObjectGroup​(java.lang.String objectGroup)
        Releases all remote objects that belong to a given group.
      • runIfWaitingForDebugger

        public static Command<java.lang.Void> runIfWaitingForDebugger()
        Tells inspected instance to run if it was waiting for debugger to attach.
      • runScript

        public static Command<Runtime.RunScriptResponse> runScript​(ScriptId scriptId,
                                                                   java.util.Optional<ExecutionContextId> executionContextId,
                                                                   java.util.Optional<java.lang.String> objectGroup,
                                                                   java.util.Optional<java.lang.Boolean> silent,
                                                                   java.util.Optional<java.lang.Boolean> includeCommandLineAPI,
                                                                   java.util.Optional<java.lang.Boolean> returnByValue,
                                                                   java.util.Optional<java.lang.Boolean> generatePreview,
                                                                   java.util.Optional<java.lang.Boolean> awaitPromise)
        Runs script with given id in a given context.
      • setAsyncCallStackDepth

        public static Command<java.lang.Void> setAsyncCallStackDepth​(java.lang.Integer maxDepth)
        Enables or disables async call stacks tracking.
      • setCustomObjectFormatterEnabled

        @Beta
        public static Command<java.lang.Void> setCustomObjectFormatterEnabled​(java.lang.Boolean enabled)
      • setMaxCallStackSizeToCapture

        @Beta
        public static Command<java.lang.Void> setMaxCallStackSizeToCapture​(java.lang.Integer size)
      • terminateExecution

        @Beta
        public static Command<java.lang.Void> terminateExecution()
        Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.
      • addBinding

        @Beta
        public static Command<java.lang.Void> addBinding​(java.lang.String name,
                                                         java.util.Optional<ExecutionContextId> executionContextId)
        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. If executionContextId is specified, adds binding only on global object of given execution context. 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.
      • removeBinding

        @Beta
        public static Command<java.lang.Void> removeBinding​(java.lang.String name)
        This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.
      • executionContextsCleared

        public static Event<java.lang.Void> executionContextsCleared()