DebuggerDomain

Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing breakpoints, stepping through execution, exploring stack traces, etc.

Official doc

Functions

Link copied to clipboard

Fired when breakpoint is resolved to an actual script and location.

Link copied to clipboard

Continues execution until specific location is reached.

Link copied to clipboard
suspend fun disable(): DisableResponse

Disables debugger for given page.

Link copied to clipboard
Link copied to clipboard
inline suspend fun enable(optionalArgs: EnableRequest.Builder.() -> Unit = {}): EnableResponse
suspend fun enable(input: EnableRequest): EnableResponse

Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.

Link copied to clipboard
inline suspend fun evaluateOnCallFrame(callFrameId: CallFrameId, expression: String, optionalArgs: EvaluateOnCallFrameRequest.Builder.() -> Unit = {}): EvaluateOnCallFrameResponse

Evaluates expression on a given call frame.

Link copied to clipboard
fun events(): Flow<DebuggerEvent>

Subscribes to all events related to this domain.

Link copied to clipboard

Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.

Link copied to clipboard

Returns source for the script with given id.

Link copied to clipboard

Returns stack trace with given stackTraceId.

Link copied to clipboard

This command is deprecated. Use getScriptSource instead.

Link copied to clipboard

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.

Link copied to clipboard
suspend fun pause(): PauseResponse

Stops on the next JavaScript statement.

Link copied to clipboard
Link copied to clipboard

Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria.

Link copied to clipboard
suspend fun pauseOnAsyncCall(parentStackTraceId: StackTraceId): PauseOnAsyncCallResponse

(undocumented in the protocol definition)

Link copied to clipboard

Removes JavaScript breakpoint.

Link copied to clipboard
inline suspend fun restartFrame(callFrameId: CallFrameId, optionalArgs: RestartFrameRequest.Builder.() -> Unit = {}): RestartFrameResponse

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.

Link copied to clipboard
inline suspend fun resume(optionalArgs: ResumeRequest.Builder.() -> Unit = {}): ResumeResponse
suspend fun resume(input: ResumeRequest): ResumeResponse

Resumes JavaScript execution.

Link copied to clipboard
Link copied to clipboard

Fired when the virtual machine resumed execution.

Link copied to clipboard

Fired when virtual machine fails to parse the script.

Link copied to clipboard
Link copied to clipboard

Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger.

Link copied to clipboard
inline suspend fun searchInContent(scriptId: ScriptId, query: String, optionalArgs: SearchInContentRequest.Builder.() -> Unit = {}): SearchInContentResponse

Searches for given string in script content.

Link copied to clipboard

Enables or disables async call stacks tracking.

Link copied to clipboard

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.

Link copied to clipboard

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.

Link copied to clipboard
inline suspend fun setBreakpoint(location: Location, optionalArgs: SetBreakpointRequest.Builder.() -> Unit = {}): SetBreakpointResponse

Sets JavaScript breakpoint at a given location.

Link copied to clipboard
inline suspend fun setBreakpointByUrl(lineNumber: Int, optionalArgs: SetBreakpointByUrlRequest.Builder.() -> Unit = {}): SetBreakpointByUrlResponse

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.

Link copied to clipboard

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.

Link copied to clipboard

Activates / deactivates all breakpoints on the page.

Link copied to clipboard

Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions, or caught exceptions, no exceptions. Initial pause on exceptions state is none.

Link copied to clipboard

Changes return value in top frame. Available only at return break position.

Link copied to clipboard
inline suspend fun setScriptSource(scriptId: ScriptId, scriptSource: String, optionalArgs: SetScriptSourceRequest.Builder.() -> Unit = {}): SetScriptSourceResponse

Edits JavaScript source live.

Link copied to clipboard

Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).

Link copied to clipboard
suspend fun setVariableValue(scopeNumber: Int, variableName: String, newValue: CallArgument, callFrameId: CallFrameId): SetVariableValueResponse

Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.

Link copied to clipboard
inline suspend fun stepInto(optionalArgs: StepIntoRequest.Builder.() -> Unit = {}): StepIntoResponse

Steps into the function call.

Link copied to clipboard
suspend fun stepOut(): StepOutResponse

Steps out of the function call.

Link copied to clipboard
inline suspend fun stepOver(optionalArgs: StepOverRequest.Builder.() -> Unit = {}): StepOverResponse

Steps over the statement.