method
inspector.Session.post
Posts a message to the inspector back-end. callback will be notified when a response is received. callback is a function that accepts two optional arguments: error and message-specific result.
session.post('Runtime.evaluate', { expression: '2 + 2' },
(error, { result }) => console.log(result));
// Output: { type: 'number', value: 4, description: '4' }The latest version of the V8 inspector protocol is published on the Chrome DevTools Protocol Viewer.
Node.js inspector supports all the Chrome DevTools Protocol domains declared by V8. Chrome DevTools Protocol domain provides an interface for interacting with one of the runtime agents used to inspect the application state and listen to the run-time events.
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
Returns properties of a given object. Object group of the result is inherited from the target object.
Releases all remote objects that belong to a given group.
Returns all let, const and class variables from global scope.
Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received.
Activates / deactivates all breakpoints on the page.
Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc).
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 <code>locations</code> property. Further matching script parsing will result in subsequent <code>breakpointResolved</code> events issued. This logical breakpoint will survive page reloads.
Returns possible locations for breakpoint. scriptId in start and end range locations should be the same.
Continues execution until specific location is reached.
Returns stack trace with given <code>stackTraceId</code>.
Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is <code>none</code>.
Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually.
Changes return value in top frame. Available only at return break position.
Enables or disables async call stacks tracking.
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.
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.
Changes CPU profiler sampling interval. Must be called before CPU profiles recording started.
Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters.
Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started.
Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection.
Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions).
Enables network tracking, network events will now be delivered to the client.
Returns post data sent with the request. Returns an error when no data was sent with the request.
Enables streaming of the response for the given requestId. If enabled, the dataReceived event contains the data that was received during streaming.
Enable the NodeRuntime.waitingForDisconnect.
Sends protocol message over session with given id.
Instructs the inspector to attach to running workers. Will also attach to new workers as they start
Referenced types
interface EvaluateParameterType
- awaitPromise?: boolean
Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved.
- contextId?: number
Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
- includeCommandLineAPI?: boolean
Determines whether Command Line API should be available during the evaluation.
- returnByValue?: boolean
Whether the result is expected to be a JSON object that should be sent by value.
- silent?: boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
interface AwaitPromiseParameterType
- returnByValue?: boolean
Whether the result is expected to be a JSON object that should be sent by value.
interface CallFunctionOnParameterType
- arguments?: CallArgument[]
Call arguments. All call arguments must belong to the same JavaScript world as the target object.
- awaitPromise?: boolean
Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved.
- executionContextId?: number
Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
- objectGroup?: string
Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
- objectId?: string
Identifier of the object to call function on. Either objectId or executionContextId should be specified.
- returnByValue?: boolean
Whether the result is expected to be a JSON object which should be sent by value.
- silent?: boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
interface GetPropertiesParameterType
- accessorPropertiesOnly?: boolean
If true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
- ownProperties?: boolean
If true, returns properties belonging only to the element itself, not to its prototype chain.
interface ReleaseObjectParameterType
interface ReleaseObjectGroupParameterType
interface CompileScriptParameterType
- executionContextId?: number
Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
interface RunScriptParameterType
- awaitPromise?: boolean
Whether execution should <code>await</code> for resulting value and return once awaited promise is resolved.
- executionContextId?: number
Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page.
- includeCommandLineAPI?: boolean
Determines whether Command Line API should be available during the evaluation.
- returnByValue?: boolean
Whether the result is expected to be a JSON object which should be sent by value.
- silent?: boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
interface QueryObjectsParameterType
interface GlobalLexicalScopeNamesParameterType
interface SetBreakpointsActiveParameterType
interface SetSkipAllPausesParameterType
interface SetBreakpointByUrlParameterType
- condition?: string
Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
- urlRegex?: string
Regex pattern for the URLs of the resources to set breakpoints on. Either <code>url</code> or <code>urlRegex</code> must be specified.
interface SetBreakpointParameterType
- condition?: string
Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true.
interface RemoveBreakpointParameterType
interface GetPossibleBreakpointsParameterType
- restrictToFunction?: boolean
Only consider locations which are in the same (non-nested) function as start.
interface ContinueToLocationParameterType
interface PauseOnAsyncCallParameterType
- parentStackTraceId: StackTraceId
Debugger will pause when async call with given stack trace is started.
interface StepIntoParameterType
- breakOnAsyncCall?: boolean
Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause.
interface SearchInContentParameterType
interface SetScriptSourceParameterType
- dryRun?: boolean
If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.
interface RestartFrameParameterType
interface GetScriptSourceParameterType
interface SetPauseOnExceptionsParameterType
interface EvaluateOnCallFrameParameterType
- includeCommandLineAPI?: boolean
Specifies whether command line API should be available to the evaluated expression, defaults to false.
- objectGroup?: string
String object group name to put result into (allows rapid releasing resulting object handles using <code>releaseObjectGroup</code>).
- returnByValue?: boolean
Whether the result is expected to be a JSON object that should be sent by value.
- silent?: boolean
In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides <code>setPauseOnException</code> state.
- throwOnSideEffect?: boolean
Whether to throw an exception if side effect cannot be ruled out during evaluation.
interface SetVariableValueParameterType
- scopeNumber: number
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.
interface SetReturnValueParameterType
interface SetAsyncCallStackDepthParameterType
- maxDepth: number
Maximum depth of async call stacks. Setting to <code>0</code> will effectively disable collecting async call stacks (default).
interface SetBlackboxPatternsParameterType
interface SetBlackboxedRangesParameterType
interface SetSamplingIntervalParameterType
interface StartPreciseCoverageParameterType
interface StartTrackingHeapObjectsParameterType
interface StopTrackingHeapObjectsParameterType
- reportProgress?: boolean
If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped.
interface TakeHeapSnapshotParameterType
- reportProgress?: boolean
If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken.
interface GetObjectByHeapObjectIdParameterType
interface AddInspectedHeapObjectParameterType
interface GetHeapObjectIdParameterType
interface StartSamplingParameterType
- samplingInterval?: number
Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes.
interface ReadParameterType
- offset?: number
Seek to the specified offset before reading (if not specified, proceed with offset following the last read). Some types of streams may only support sequential reads.
interface CloseParameterType
interface EnableParameterType
- maxResourceBufferSize?: number
Per-resource buffer size in bytes to use when preserving network payloads (XHRs, etc).
- maxTotalBufferSize?: number
Buffer size in bytes to use when preserving network payloads (XHRs, etc).
interface GetRequestPostDataParameterType
interface GetResponseBodyParameterType
interface StreamResourceContentParameterType
interface LoadNetworkResourceParameterType
interface StartParameterType
interface SendMessageToWorkerParameterType
interface EnableParameterType
- waitForDebuggerOnStart: boolean
Whether to new workers should be paused until the frontend sends
Runtime.runIfWaitingForDebuggermessage to run them.