chrome-devtools-kotlin / org.hildan.chrome.devtools.domains.debugger / DebuggerDomain

DebuggerDomain

class DebuggerDomain

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

Functions

breakpointResolved

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

fun breakpointResolved(): Flow<BreakpointResolvedEvent>

continueToLocation

Continues execution until specific location is reached.

suspend fun continueToLocation(input: ContinueToLocationRequest): Unit

disable

Disables debugger for given page.

suspend fun disable(): Unit

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.

suspend fun enable(input: EnableRequest): EnableResponse

evaluateOnCallFrame

Evaluates expression on a given call frame.

suspend fun evaluateOnCallFrame(input: EvaluateOnCallFrameRequest): EvaluateOnCallFrameResponse

events

Subscribes to all events related to this domain.

fun events(): Flow<DebuggerEvent>

executeWasmEvaluator

Execute a Wasm Evaluator module on a given call frame.

suspend fun executeWasmEvaluator(input: ExecuteWasmEvaluatorRequest): ExecuteWasmEvaluatorResponse

getPossibleBreakpoints

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

suspend fun getPossibleBreakpoints(input: GetPossibleBreakpointsRequest): GetPossibleBreakpointsResponse

getScriptSource

Returns source for the script with given id.

suspend fun getScriptSource(input: GetScriptSourceRequest): GetScriptSourceResponse

getStackTrace

Returns stack trace with given stackTraceId.

suspend fun getStackTrace(input: GetStackTraceRequest): GetStackTraceResponse

getWasmBytecode

This command is deprecated. Use getScriptSource instead.

suspend fun getWasmBytecode(input: GetWasmBytecodeRequest): GetWasmBytecodeResponse

pause

Stops on the next JavaScript statement.

suspend fun pause(): Unit

paused

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

fun paused(): Flow<PausedEvent>

pauseOnAsyncCall

suspend fun pauseOnAsyncCall(input: PauseOnAsyncCallRequest): Unit

removeBreakpoint

Removes JavaScript breakpoint.

suspend fun removeBreakpoint(input: RemoveBreakpointRequest): Unit

restartFrame

Restarts particular call frame from the beginning.

suspend fun restartFrame(input: RestartFrameRequest): RestartFrameResponse

resume

Resumes JavaScript execution.

suspend fun resume(input: ResumeRequest): Unit

resumed

Fired when the virtual machine resumed execution.

fun resumed(): Flow<ResumedEvent>

scriptFailedToParse

Fired when virtual machine fails to parse the script.

fun scriptFailedToParse(): Flow<ScriptFailedToParseEvent>

scriptParsed

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

fun scriptParsed(): Flow<ScriptParsedEvent>

searchInContent

Searches for given string in script content.

suspend fun searchInContent(input: SearchInContentRequest): SearchInContentResponse

setAsyncCallStackDepth

Enables or disables async call stacks tracking.

suspend fun setAsyncCallStackDepth(input: SetAsyncCallStackDepthRequest): Unit

setBlackboxedRanges

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.

suspend fun setBlackboxedRanges(input: SetBlackboxedRangesRequest): Unit

setBlackboxPatterns

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.

suspend fun setBlackboxPatterns(input: SetBlackboxPatternsRequest): Unit

setBreakpoint

Sets JavaScript breakpoint at a given location.

suspend fun setBreakpoint(input: SetBreakpointRequest): SetBreakpointResponse

setBreakpointByUrl

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.

suspend fun setBreakpointByUrl(input: SetBreakpointByUrlRequest): SetBreakpointByUrlResponse

setBreakpointOnFunctionCall

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.

suspend fun setBreakpointOnFunctionCall(input: SetBreakpointOnFunctionCallRequest): SetBreakpointOnFunctionCallResponse

setBreakpointsActive

Activates / deactivates all breakpoints on the page.

suspend fun setBreakpointsActive(input: SetBreakpointsActiveRequest): Unit

setInstrumentationBreakpoint

Sets instrumentation breakpoint.

suspend fun setInstrumentationBreakpoint(input: SetInstrumentationBreakpointRequest): SetInstrumentationBreakpointResponse

setPauseOnExceptions

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.

suspend fun setPauseOnExceptions(input: SetPauseOnExceptionsRequest): Unit

setReturnValue

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

suspend fun setReturnValue(input: SetReturnValueRequest): Unit

setScriptSource

Edits JavaScript source live.

suspend fun setScriptSource(input: SetScriptSourceRequest): SetScriptSourceResponse

setSkipAllPauses

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

suspend fun setSkipAllPauses(input: SetSkipAllPausesRequest): Unit

setVariableValue

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

suspend fun setVariableValue(input: SetVariableValueRequest): Unit

stepInto

Steps into the function call.

suspend fun stepInto(input: StepIntoRequest): Unit

stepOut

Steps out of the function call.

suspend fun stepOut(): Unit

stepOver

Steps over the statement.

suspend fun stepOver(input: StepOverRequest): Unit