Interface DebuggerAsync


public interface DebuggerAsync
Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.
  • Method Details

    • continueToLocation

      CompletableFuture<Void> continueToLocation(Location location)
      Continues execution until specific location is reached.
      Parameters:
      location - Location to continue to.
    • continueToLocation

      CompletableFuture<Void> continueToLocation(Location location, TargetCallFrames targetCallFrames)
      Continues execution until specific location is reached.
      Parameters:
      location - Location to continue to.
    • disable

      Disables debugger for given page.
    • disassembleWasmModule

      CompletableFuture<DisassembleWasmModuleResult> disassembleWasmModule(String scriptId)
      Returns:
      DisassembleWasmModuleResult
    • enable

      Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
      Returns:
      Unique identifier of the debugger.
    • enable

      CompletableFuture<String> enable(Double maxScriptsCacheSize)
      Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
      Parameters:
      maxScriptsCacheSize - The maximum size in bytes of collected scripts (not referenced by other heap objects) the debugger can hold. Puts no limit if parameter is omitted.
      Returns:
      Unique identifier of the debugger.
    • evaluateOnCallFrame

      CompletableFuture<EvaluateOnCallFrameResult> evaluateOnCallFrame(String callFrameId, String expression)
      Evaluates expression on a given call frame.
      Parameters:
      callFrameId - Call frame identifier to evaluate on.
      expression - Expression to evaluate.
      Returns:
      EvaluateOnCallFrameResult
    • evaluateOnCallFrame

      CompletableFuture<EvaluateOnCallFrameResult> evaluateOnCallFrame(String callFrameId, String expression, String objectGroup, Boolean includeCommandLineAPI, Boolean silent, Boolean returnByValue, Boolean generatePreview, Boolean throwOnSideEffect, Double timeout)
      Evaluates expression on a given call frame.
      Parameters:
      callFrameId - Call frame identifier to evaluate on.
      expression - Expression to evaluate.
      objectGroup - String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup).
      includeCommandLineAPI - Specifies whether command line API should be available to the evaluated expression, defaults to false.
      silent - In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
      returnByValue - Whether the result is expected to be a JSON object that should be sent by value.
      generatePreview - Whether preview should be generated for the result.
      throwOnSideEffect - Whether to throw an exception if side effect cannot be ruled out during evaluation.
      timeout - Terminate execution after timing out (number of milliseconds).
      Returns:
      EvaluateOnCallFrameResult
    • getPossibleBreakpoints

      CompletableFuture<List<BreakLocation>> getPossibleBreakpoints(Location start)
      Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
      Parameters:
      start - Start of range to search possible breakpoint locations in.
      Returns:
      List of the possible breakpoint locations.
    • getPossibleBreakpoints

      CompletableFuture<List<BreakLocation>> getPossibleBreakpoints(Location start, Location end, Boolean restrictToFunction)
      Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
      Parameters:
      start - Start of range to search possible breakpoint locations in.
      end - End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range.
      restrictToFunction - Only consider locations which are in the same (non-nested) function as start.
      Returns:
      List of the possible breakpoint locations.
    • getScriptSource

      CompletableFuture<GetScriptSourceResult> getScriptSource(String scriptId)
      Returns source for the script with given id.
      Parameters:
      scriptId - Id of the script to get source for.
      Returns:
      GetScriptSourceResult
    • getStackTrace

      CompletableFuture<StackTrace> getStackTrace(StackTraceId stackTraceId)
      Returns stack trace with given stackTraceId.
    • getWasmBytecode

      @Deprecated CompletableFuture<String> getWasmBytecode(String scriptId)
      Deprecated.
      This command is deprecated. Use getScriptSource instead.
      Parameters:
      scriptId - Id of the Wasm script to get source for.
      Returns:
      Script source. (Encoded as a base64 string when passed over JSON)
    • nextWasmDisassemblyChunk

      CompletableFuture<WasmDisassemblyChunk> nextWasmDisassemblyChunk(String streamId)
      Disassemble the next chunk of lines for the module corresponding to the stream. If disassembly is complete, this API will invalidate the streamId and return an empty chunk. Any subsequent calls for the now invalid stream will return errors.
      Returns:
      The next chunk of disassembly.
    • pause

      Stops on the next JavaScript statement.
    • pauseOnAsyncCall

      @Deprecated CompletableFuture<Void> pauseOnAsyncCall(StackTraceId parentStackTraceId)
      Deprecated.
    • removeBreakpoint

      CompletableFuture<Void> removeBreakpoint(String breakpointId)
      Removes JavaScript breakpoint.
    • restartFrame

      CompletableFuture<RestartFrameResult> restartFrame(String callFrameId)
      Restarts particular call frame from the beginning. The old, deprecated behavior of restartFrame is to stay paused and allow further CDP commands after a restart was scheduled. This can cause problems with restarting, so we now continue execution immediatly after it has been scheduled until we reach the beginning of the restarted frame. To stay back-wards compatible, restartFrame now expects a mode parameter to be present. If the mode parameter is missing, restartFrame errors out. The various return values are deprecated and callFrames is always empty. Use the call frames from the Debugger#paused events instead, that fires once V8 pauses at the beginning of the restarted function.
      Parameters:
      callFrameId - Call frame identifier to evaluate on.
      Returns:
      RestartFrameResult
    • restartFrame

      CompletableFuture<RestartFrameResult> restartFrame(String callFrameId, RestartFrameMode mode)
      Restarts particular call frame from the beginning. The old, deprecated behavior of restartFrame is to stay paused and allow further CDP commands after a restart was scheduled. This can cause problems with restarting, so we now continue execution immediatly after it has been scheduled until we reach the beginning of the restarted frame. To stay back-wards compatible, restartFrame now expects a mode parameter to be present. If the mode parameter is missing, restartFrame errors out. The various return values are deprecated and callFrames is always empty. Use the call frames from the Debugger#paused events instead, that fires once V8 pauses at the beginning of the restarted function.
      Parameters:
      callFrameId - Call frame identifier to evaluate on.
      mode - The mode parameter must be present and set to 'StepInto', otherwise restartFrame will error out.
      Returns:
      RestartFrameResult
    • resume

      Resumes JavaScript execution.
    • resume

      CompletableFuture<Void> resume(Boolean terminateOnResume)
      Resumes JavaScript execution.
      Parameters:
      terminateOnResume - Set to true to terminate execution upon resuming execution. In contrast to Runtime.terminateExecution, this will allows to execute further JavaScript (i.e. via evaluation) until execution of the paused code is actually resumed, at which point termination is triggered. If execution is currently not paused, this parameter has no effect.
    • searchInContent

      CompletableFuture<List<SearchMatch>> searchInContent(String scriptId, String query)
      Searches for given string in script content.
      Parameters:
      scriptId - Id of the script to search in.
      query - String to search for.
      Returns:
      List of search matches.
    • searchInContent

      CompletableFuture<List<SearchMatch>> searchInContent(String scriptId, String query, Boolean caseSensitive, Boolean isRegex)
      Searches for given string in script content.
      Parameters:
      scriptId - Id of the script to search in.
      query - String to search for.
      caseSensitive - If true, search is case sensitive.
      isRegex - If true, treats string parameter as regex.
      Returns:
      List of search matches.
    • setAsyncCallStackDepth

      CompletableFuture<Void> setAsyncCallStackDepth(Integer maxDepth)
      Enables or disables async call stacks tracking.
      Parameters:
      maxDepth - Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default).
    • setBlackboxPatterns

      CompletableFuture<Void> setBlackboxPatterns(List<String> patterns)
      Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful.
      Parameters:
      patterns - Array of regexps that will be used to check script url for blackbox state.
    • setBlackboxedRanges

      CompletableFuture<Void> setBlackboxedRanges(String scriptId, List<ScriptPosition> positions)
      Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted.
      Parameters:
      scriptId - Id of the script.
    • setBreakpoint

      Sets JavaScript breakpoint at a given location.
      Parameters:
      location - Location to set breakpoint in.
      Returns:
      SetBreakpointResult
    • setBreakpoint

      CompletableFuture<SetBreakpointResult> setBreakpoint(Location location, String condition)
      Sets JavaScript breakpoint at a given location.
      Parameters:
      location - Location to set breakpoint in.
      condition - Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
      Returns:
      SetBreakpointResult
    • setBreakpointByUrl

      CompletableFuture<SetBreakpointByUrlResult> setBreakpointByUrl(Integer lineNumber)
      Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads.
      Parameters:
      lineNumber - Line number to set breakpoint at.
      Returns:
      SetBreakpointByUrlResult
    • setBreakpointByUrl

      CompletableFuture<SetBreakpointByUrlResult> setBreakpointByUrl(Integer lineNumber, String url, String urlRegex, String scriptHash, Integer columnNumber, String condition)
      Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads.
      Parameters:
      lineNumber - Line number to set breakpoint at.
      url - URL of the resources to set breakpoint on.
      urlRegex - Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified.
      scriptHash - Script hash of the resources to set breakpoint on.
      columnNumber - Offset in the line to set breakpoint at.
      condition - Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
      Returns:
      SetBreakpointByUrlResult
    • setBreakpointOnFunctionCall

      CompletableFuture<String> setBreakpointOnFunctionCall(String objectId)
      Sets JavaScript breakpoint before each call to the given function. If another function was created from the same source as a given one, calling it will also trigger the breakpoint.
      Parameters:
      objectId - Function object id.
      Returns:
      Id of the created breakpoint for further reference.
    • setBreakpointOnFunctionCall

      CompletableFuture<String> setBreakpointOnFunctionCall(String objectId, String condition)
      Sets JavaScript breakpoint before each call to the given function. If another function was created from the same source as a given one, calling it will also trigger the breakpoint.
      Parameters:
      objectId - Function object id.
      condition - Expression to use as a breakpoint condition. When specified, debugger will stop on the breakpoint if this expression evaluates to true.
      Returns:
      Id of the created breakpoint for further reference.
    • setBreakpointsActive

      CompletableFuture<Void> setBreakpointsActive(Boolean active)
      Activates / deactivates all breakpoints on the page.
      Parameters:
      active - New value for breakpoints active state.
    • setInstrumentationBreakpoint

      CompletableFuture<String> setInstrumentationBreakpoint(InstrumentationName instrumentation)
      Sets instrumentation breakpoint.
      Parameters:
      instrumentation - Instrumentation name.
      Returns:
      Id of the created breakpoint for further reference.
    • setPauseOnExceptions

      CompletableFuture<Void> setPauseOnExceptions(PauseOnExceptionState state)
      Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none.
      Parameters:
      state - Pause on exceptions mode.
    • setReturnValue

      CompletableFuture<Void> setReturnValue(CallArgument newValue)
      Changes return value in top frame. Available only at return break position.
      Parameters:
      newValue - New return value.
    • setScriptSource

      CompletableFuture<SetScriptSourceResult> setScriptSource(String scriptId, String scriptSource)
      Edits JavaScript source live. In general, functions that are currently on the stack can not be edited with a single exception: If the edited function is the top-most stack frame and that is the only activation of that function on the stack. In this case the live edit will be successful and a Debugger.restartFrame for the top-most function is automatically triggered.
      Parameters:
      scriptId - Id of the script to edit.
      scriptSource - New content of the script.
      Returns:
      SetScriptSourceResult
    • setScriptSource

      CompletableFuture<SetScriptSourceResult> setScriptSource(String scriptId, String scriptSource, Boolean dryRun, Boolean allowTopFrameEditing)
      Edits JavaScript source live. In general, functions that are currently on the stack can not be edited with a single exception: If the edited function is the top-most stack frame and that is the only activation of that function on the stack. In this case the live edit will be successful and a Debugger.restartFrame for the top-most function is automatically triggered.
      Parameters:
      scriptId - Id of the script to edit.
      scriptSource - New content of the script.
      dryRun - If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
      allowTopFrameEditing - If true, then scriptSource is allowed to change the function on top of the stack as long as the top-most stack frame is the only activation of that function.
      Returns:
      SetScriptSourceResult
    • setSkipAllPauses

      CompletableFuture<Void> setSkipAllPauses(Boolean skip)
      Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
      Parameters:
      skip - New value for skip pauses state.
    • setVariableValue

      CompletableFuture<Void> setVariableValue(Integer scopeNumber, String variableName, CallArgument newValue, String callFrameId)
      Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
      Parameters:
      scopeNumber - 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually.
      variableName - Variable name.
      newValue - New variable value.
      callFrameId - Id of callframe that holds variable.
    • stepInto

      CompletableFuture<Void> stepInto()
      Steps into the function call.
    • stepInto

      CompletableFuture<Void> stepInto(Boolean breakOnAsyncCall, List<LocationRange> skipList)
      Steps into the function call.
      Parameters:
      breakOnAsyncCall - Debugger will pause on the execution of the first async task which was scheduled before next pause.
      skipList - The skipList specifies location ranges that should be skipped on step into.
    • stepOut

      Steps out of the function call.
    • stepOver

      CompletableFuture<Void> stepOver()
      Steps over the statement.
    • stepOver

      CompletableFuture<Void> stepOver(List<LocationRange> skipList)
      Steps over the statement.
      Parameters:
      skipList - The skipList specifies location ranges that should be skipped on step over.