Debugger
调试器(Debugger)域提供了JavaScript调试功能。它允许设置和移除断点、单步执行、查看堆栈跟踪等操作。
EN
✅️️ Methods
🔨Debugger.continueToLocation
继续执行,直到到达特定位置。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| location | ✔️ | Location | 继续前往的位置。 | ENLocation to continue to. | |
| targetCallFrames | string | 允许的值:any、current | ENAllowed Values:any, current |
🔨Debugger.disable
禁用给定页面的调试器。
EN
🔨Debugger.enable
为指定页面启用调试器。在收到此命令的结果之前,客户端不应假定调试功能已启用。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| maxScriptsCacheSize | 🧪 | number | 调试器可容纳的已收集脚本(未被其他堆对象引用)的最大字节数。如果省略参数,则不设限制。 | ENThe maximum size in bytes of collected scripts (not referenced by other heap objects) the debugger can hold. Puts no limit if parameter is omitted. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| debuggerId | Runtime.UniqueDebuggerId | 调试器的唯一标识符。 | ENUnique identifier of the debugger. |
🔨Debugger.evaluateOnCallFrame
在指定的调用帧上评估表达式。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| callFrameId | ✔️ | CallFrameId | 要在其上评估的调用帧标识符。 | ENCall frame identifier to evaluate on. | |
| expression | ✔️ | string | 要评估的表达式。 | ENExpression to evaluate. | |
| objectGroup | string | 将结果放入的字符串对象组名称(允许使用releaseObjectGroup快速释放结果对象句柄)。 | ENString object group name to put result into (allows rapid releasing resulting object handles usingreleaseObjectGroup). | ||
| includeCommandLineAPI | boolean | 指定命令行API是否应对被评估的表达式可用,默认为false。 | ENSpecifies whether command line API should be available to the evaluated expression, defaults to false. | ||
| silent | boolean | 在静默模式下,评估期间抛出的异常不会被报告,也不会暂停执行。这会覆盖 setPauseOnException 状态。 | ENIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. OverridessetPauseOnException state. | ||
| returnByValue | boolean | 结果是否预期为一个应通过值传递的JSON对象。 | ENWhether the result is expected to be a JSON object that should be sent by value. | ||
| generatePreview | 🧪 | boolean | 是否应为结果生成预览。 | ENWhether preview should be generated for the result. | |
| throwOnSideEffect | boolean | 是否在评估过程中无法排除副作用时抛出异常。 | ENWhether to throw an exception if side effect cannot be ruled out during evaluation. | ||
| timeout | 🧪 | Runtime.TimeDelta | 执行在超时后终止(毫秒数)。 | ENTerminate execution after timing out (number of milliseconds). |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| result | Runtime.RemoteObject | 评估结果的对象包装器。 | ENObject wrapper for the evaluation result. |
| exceptionDetails | Runtime.ExceptionDetails | 异常详情。 | ENException details. |
🔨Debugger.getPossibleBreakpoints
返回断点的可能位置。起始和结束范围位置中的脚本ID应相同。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| start | ✔️ | Location | 搜索可能断点位置范围的起始点。 | ENStart of range to search possible breakpoint locations in. | |
| end | Location | 在脚本中搜索可能的断点位置的范围结束位置(不包含)。当未指定时,脚本的结尾将作为范围的结束。 | ENEnd of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. | ||
| restrictToFunction | boolean | 仅考虑与起始点位于同一(非嵌套)函数内的位置。 | ENOnly consider locations which are in the same (non-nested) function as start. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| locations | array[BreakLocation] | 可能的断点位置列表。 | ENList of the possible breakpoint locations. |
🔨Debugger.getScriptSource
返回具有给定ID的脚本的源代码。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 获取源代码的脚本ID。 | ENId of the script to get source for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| scriptSource | string | 脚本源(在Wasm字节码情况下为空)。 | ENScript source (empty in case of Wasm bytecode). |
| bytecode | string | Wasm字节码。(通过JSON传递时,编码为base64字符串) | ENWasm bytecode. (Encoded as a base64 string when passed over JSON) |
🔨Debugger.pause
在下一个JavaScript语句处停止。
EN
🔨Debugger.removeBreakpoint
移除JavaScript断点。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| breakpointId | ✔️ | BreakpointId |
🔨Debugger.restartFrame
从起始处重新执行特定的调用栈帧。restartFrame 已弃用的旧行为是在重启计划后保持暂停状态并允许进一步的 CDP 命令。这可能导致重启时出现问题,因此我们现在在计划重启后立即继续执行,直到到达重启栈帧的起始位置。
为保持向后兼容性,restartFrame 现在要求提供 mode 参数。如果缺少 mode 参数,restartFrame 将报错。
各种返回值均已弃用,且 callFrames 始终为空。请改用 Debugger#paused 事件中的调用栈帧,该事件会在 V8 在重启函数起始处暂停时触发。
EN
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.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| callFrameId | ✔️ | CallFrameId | 要在其上评估的调用帧标识符。 | ENCall frame identifier to evaluate on. | |
| mode | 🧪 | string | mode 参数必须存在且设置为 'StepInto',否则 restartFrame 将出错。允许的值: StepInto | ENThemode parameter must be present and set to 'StepInto', otherwise restartFrame will error out.Allowed Values: StepInto |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| callFrames | array[CallFrame] | 新堆栈跟踪。 | ENNew stack trace. |
| asyncStackTrace | Runtime.StackTrace | 异步堆栈跟踪(如果有的话)。 | ENAsync stack trace, if any. |
| asyncStackTraceId | Runtime.StackTraceId | 异步堆栈跟踪(如果有的话)。 | ENAsync stack trace, if any. |
🔨Debugger.resume
恢复 JavaScript 执行。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| terminateOnResume | boolean | 设置为 true 以在恢复执行时终止执行。与 Runtime.terminateExecution 不同,这将允许执行更多 JavaScript(例如通过求值),直到实际恢复暂停代码的执行,此时会触发终止。如果当前执行未暂停,则此参数无效。 | ENSet 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. |
🔨Debugger.searchInContent
在脚本内容中搜索给定的字符串。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 在脚本中搜索的Id。 | ENId of the script to search in. | |
| query | ✔️ | string | 要搜索的字符串。 | ENString to search for. | |
| caseSensitive | boolean | 如果为真,则搜索区分大小写。 | ENIf true, search is case sensitive. | ||
| isRegex | boolean | 如果为真,将字符串参数视为正则表达式。 | ENIf true, treats string parameter as regex. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| result | array[SearchMatch] | 搜索结果列表。 | ENList of search matches. |
🔨Debugger.setAsyncCallStackDepth
启用或禁用异步调用堆栈跟踪。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| maxDepth | ✔️ | integer | 异步调用栈的最大深度。设置为 0 将有效禁用收集异步调用栈(默认)。 | ENMaximum depth of async call stacks. Setting to0 will effectively disable collecting async call stacks (default). |
🔨Debugger.setBreakpoint
在指定位置设置JavaScript断点。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| location | ✔️ | Location | 在''和``内的内容保持不变的情况下,翻译文本为:设置断点的位置。 | ENLocation to set breakpoint in. | |
| condition | string | 用作断点条件的表达式。当指定时,调试器仅在此表达式求值为真时才会在断点处停止。 | ENExpression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| breakpointId | BreakpointId | 创建的断点ID,用于后续引用。 | ENId of the created breakpoint for further reference. |
| actualLocation | Location | 此断点解析到的位置。 | ENLocation this breakpoint resolved into. |
🔨Debugger.setBreakpointByUrl
在由URL或URL正则表达式指定的给定位置设置JavaScript断点。一旦发出此命令,所有已解析的脚本将解析断点并在locations属性中返回。后续匹配的脚本解析将触发breakpointResolved事件。此逻辑断点将在页面重新加载后保持有效。
EN
locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| lineNumber | ✔️ | integer | 设置断点的行号。 | ENLine number to set breakpoint at. | |
| url | string | 要在其上设置断点的资源URL。 | ENURL of the resources to set breakpoint on. | ||
| urlRegex | string | 用于设置断点的资源URL的正则表达式模式。必须指定 url 或 urlRegex 中的一项。 | ENRegex pattern for the URLs of the resources to set breakpoints on. Eitherurl or urlRegex must be specified. | ||
| scriptHash | string | 要设置断点的资源的脚本哈希。 | ENScript hash of the resources to set breakpoint on. | ||
| columnNumber | integer | 在行内设置断点的偏移量。 | ENOffset in the line to set breakpoint at. | ||
| condition | string | 用作断点条件的表达式。当指定后,调试器仅在该表达式求值为真时才会在断点处停止。 | ENExpression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| breakpointId | BreakpointId | 创建的断点ID,用于后续引用。 | ENId of the created breakpoint for further reference. |
| locations | array[Location] | 此断点添加时解析到的位置列表。 | ENList of the locations this breakpoint resolved into upon addition. |
🔨Debugger.setBreakpointsActive
激活/停用页面上的所有断点。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| active | ✔️ | boolean | 断点活动状态的新值。 | ENNew value for breakpoints active state. |
🔨Debugger.setInstrumentationBreakpoint
设置检测断点。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| instrumentation | ✔️ | string | 仪器名称。 允许值: beforeScriptExecution、beforeScriptWithSourceMapExecution | ENInstrumentation name.Allowed Values: beforeScriptExecution, beforeScriptWithSourceMapExecution |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| breakpointId | BreakpointId | 所创建断点的ID,用于后续引用。 | ENId of the created breakpoint for further reference. |
🔨Debugger.setPauseOnExceptions
定义异常暂停状态。可设置为在所有异常、未捕获异常、捕获异常或无异常时暂停。初始异常暂停状态为 none。
EN
none.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| state | ✔️ | string | 异常暂停模式。 允许值: none、caught、uncaught、all | ENPause on exceptions mode.Allowed Values: none, caught, uncaught, all |
🔨Debugger.setScriptSource
实时编辑JavaScript源代码。
通常情况下,当前位于调用栈中的函数无法被编辑,但有一个例外:如果被编辑的函数位于调用栈的最顶层,并且该函数在栈中仅被激活一次。在这种情况下,实时编辑将会成功,并且会自动触发对最顶层函数的Debugger.restartFrame操作。
EN
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.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 要编辑的脚本的Id。 | ENId of the script to edit. | |
| scriptSource | ✔️ | string | 脚本的新内容。 | ENNew content of the script. | |
| dryRun | boolean | 如果为真,则更改实际上不会被应用。空运行可用于在不实际修改代码的情况下获取结果描述。 | ENIf true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. | ||
| allowTopFrameEditing | 🧪 | boolean | 如果为真,则允许 scriptSource 修改调用栈顶部的函数,前提是最顶层的堆栈帧是该函数的唯一激活实例。 | ENIf true, thenscriptSource 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. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| callFrames | array[CallFrame] | VM停止时发生编辑情况下的新堆栈跟踪。 | ENNew stack trace in case editing has happened while VM was stopped. |
| stackChanged | boolean | 应用更改后,当前调用堆栈是否被修改。 | ENWhether current call stack was modified after applying the changes. |
| asyncStackTrace | Runtime.StackTrace | 异步堆栈跟踪(如果有的话)。 | ENAsync stack trace, if any. |
| asyncStackTraceId | Runtime.StackTraceId | 异步堆栈跟踪(如果有的话)。 | ENAsync stack trace, if any. |
| status | string | 操作是否成功。只有Ok表示实时编辑成功,而其他枚举变体表示实时编辑失败的原因。允许的值: Ok、CompileError、BlockedByActiveGenerator、BlockedByActiveFunction、BlockedByTopLevelEsModuleChange | ENWhether the operation was successful or not. OnlyOk denotes a successful live edit while the other enum variants denote why the live edit failed.Allowed Values: Ok, CompileError, BlockedByActiveGenerator, BlockedByActiveFunction, BlockedByTopLevelEsModuleChange |
| exceptionDetails | Runtime.ExceptionDetails | 异常详情(如果有)。仅在status为CompileError时出现。 | ENException details if any. Only present whenstatus is CompileError. |
🔨Debugger.setSkipAllPauses
使页面在任何暂停(断点、异常、DOM异常等)时不会中断。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| skip | ✔️ | boolean | 跳过暂停状态的新值。 | ENNew value for skip pauses state. |
🔨Debugger.setVariableValue
修改调用帧中变量的值。不支持基于对象的作用域,必须手动进行修改。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scopeNumber | ✔️ | integer | 基于0的编号,对应 在作用域链中列出的顺序。仅允许'local'、'closure'和'catch'这三种作用域类型。其他作用域类型可能需要手动处理。 | EN0-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 | ✔️ | string | 变量名。 | ENVariable name. | |
| newValue | ✔️ | Runtime.CallArgument | 新变量值。 | ENNew variable value. | |
| callFrameId | ✔️ | CallFrameId | 保存变量的调用帧的Id。 | ENId of callframe that holds variable. |
🔨Debugger.stepInto
单步进入函数调用。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| breakOnAsyncCall | 🧪 | boolean | 调试器将在执行第一个异步任务时暂停,该任务是在下一次暂停之前安排的。 | ENDebugger will pause on the execution of the first async task which was scheduled before next pause. | |
| skipList | 🧪 | array[LocationRange] | skipList指定了在单步进入时应跳过的位置范围。 | ENThe skipList specifies location ranges that should be skipped on step into. |
🔨Debugger.stepOut
退出函数调用。
EN
🔨Debugger.stepOver
单步跳过该语句。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| skipList | 🧪 | array[LocationRange] | skipList指定了在单步跳过时应跳过的位置范围。 | ENThe skipList specifies location ranges that should be skipped on step over. |
🔨Debugger.getWasmBytecode❌️
此命令已弃用。请改用 getScriptSource。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 获取源代码的Wasm脚本ID。 | ENId of the Wasm script to get source for. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| bytecode | string | 脚本源。(通过JSON传递时编码为base64字符串) | ENScript source. (Encoded as a base64 string when passed over JSON) |
🔨Debugger.disassembleWasmModule🧪
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 要反汇编的脚本的Id | ENId of the script to disassemble |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| streamId | string | 对于大型模块,返回一个流,可以从中连续读取额外的反汇编代码块。 | ENFor large modules, return a stream from which additional chunks of disassembly can be read successively. |
| totalNumberOfLines | integer | 反汇编文本中的总行数。 | ENThe total number of lines in the disassembly text. |
| functionBodyOffsets | array[integer] | 所有函数体的偏移量,格式为 [start1, end1, start2, end2, ...],其中所有 end 值均为不包含的。 | ENThe offsets of all function bodies, in the format [start1, end1, start2, end2, ...] where all ends are exclusive. |
| chunk | WasmDisassemblyChunk | 这是反汇编的第一部分。 | ENThe first chunk of disassembly. |
🔨Debugger.getStackTrace🧪
返回具有给定 stackTraceId 的堆栈跟踪。
EN
stackTraceId.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| stackTraceId | ✔️ | Runtime.StackTraceId |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| stackTrace | Runtime.StackTrace |
🔨Debugger.nextWasmDisassemblyChunk🧪
为对应流的模块反汇编下一块代码行。如果反汇编完成,此API将使streamId失效并返回空数据块。任何后续对现已失效流的调用都将返回错误。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| streamId | ✔️ | string |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| chunk | WasmDisassemblyChunk | 下一段反汇编代码。 | ENThe next chunk of disassembly. |
🔨Debugger.setBlackboxedRanges🧪
使后端在脚本的黑盒范围内跳过步骤。虚拟机将尝试通过多次执行“步入”操作来离开黑名单脚本,如果不 成功则最终采取“步出”操作。位置数组包含黑盒状态发生改变的位置。第一个区间不是黑盒化的。数组应已排序。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 脚本的Id。 | ENId of the script. | |
| positions | ✔️ | array[ScriptPosition] |
🔨Debugger.setBlackboxExecutionContexts🧪
将之前的黑盒执行上下文替换为传入的执行上下文。强制后端在这些执行上下文中跳过脚本的步进/暂停。虚拟机将尝试通过多次执行“步入”操作离开黑盒脚本,如果失败则最终采用“跳出”操作。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| uniqueIds | ✔️ | array[string] | 调试器应忽略的执行上下文唯一标识符数组。 | ENArray of execution context unique ids for the debugger to ignore. |
🔨Debugger.setBlackboxPatterns🧪
将之前的黑盒模式替换为传入的模式。强制后端跳过在与任一模式匹配的URL脚本中的单步执行/暂停。虚拟机将尝试通过多次执行“步入”操作离开黑盒脚本,若失败则最终采用“跳出”策略。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| patterns | ✔️ | array[string] | 用于检查脚本URL是否处于黑盒状态的正则表达式数组。 | ENArray of regexps that will be used to check script url for blackbox state. | |
| skipAnonymous | boolean | 如果为真,同时忽略没有源URL的脚本。 | ENIf true, also ignore scripts with no source url. |
🔨Debugger.setBreakpointOnFunctionCall🧪
在每次调用给定函数之前设置 JavaScript 断点。如果另一个函数与给定函数源自同一源代码,调用该函数也会触发断点。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| objectId | ✔️ | Runtime.RemoteObjectId | 函数对象标识符。 | ENFunction object id. | |
| condition | string | 用作断点条件的表达式。当指定时,如果此表达式的求值结果为真,调试器将在断点处停止。 | ENExpression to use as a breakpoint condition. When specified, debugger will stop on the breakpoint if this expression evaluates to true. |
| 返回对象 | 类型 | 描述 | 原文 |
|---|---|---|---|
| breakpointId | BreakpointId | 创建的断点ID,用于后续引用。 | ENId of the created breakpoint for further reference. |
🔨Debugger.setReturnValue🧪
在顶层帧中更改返回值。仅在返回断点位置可用。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| newValue | ✔️ | Runtime.CallArgument | 新的返回值。 | ENNew return value. |
🔨Debugger.pauseOnAsyncCall🧪❌️
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| parentStackTraceId | ✔️ | Runtime.StackTraceId | 当带有指定堆栈跟踪的异步调用开始时,调试器将暂停。 | ENDebugger will pause when async call with given stack trace is started. |
✅️️ Events
👋Debugger.paused
当 虚拟机在断点、异常或任何其他停止条件上停止时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| callFrames | ✔️ | array[CallFrame] | 虚拟机停止时所在的调用堆栈。 | ENCall stack the virtual machine stopped on. | |
| reason | ✔️ | string | 暂停原因。 允许的值: ambiguous、assert、CSPViolation、debugCommand、DOM、EventListener、exception、instrumentation、OOM、other、promiseRejection、XHR、step | ENPause reason.Allowed Values: ambiguous, assert, CSPViolation, debugCommand, DOM, EventListener, exception, instrumentation, OOM, other, promiseRejection, XHR, step | |
| data | object | 包含断点特定辅助属性的对象。 | ENObject containing break-specific auxiliary properties. | ||
| hitBreakpoints | array[string] | 命中断点ID | ENHit breakpoints IDs | ||
| asyncStackTrace | Runtime.StackTrace | 异步堆栈跟踪(如果有的话)。 | ENAsync stack trace, if any. | ||
| asyncStackTraceId | 🧪 | Runtime.StackTraceId | 异步堆栈跟踪(如果有的话)。 | ENAsync stack trace, if any. | |
| asyncCallStackTraceId | 🧪 | Runtime.StackTraceId | 永不出现,将被移除。 | ENNever present, will be removed. |
👋Debugger.resumed
当虚拟机恢复执行时触发。
EN
👋Debugger.scriptFailedToParse
当虚拟机无法解析脚本时触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 已解析脚本的标识符。 | ENIdentifier of the script parsed. | |
| url | ✔️ | string | URL或脚本解析的名称(如果有的话)。 | ENURL or name of the script parsed (if any). | |
| startLine | ✔️ | integer | 脚本在给定URL资源中的行偏移量(针对script标签)。 | ENLine offset of the script within the resource with given URL (for script tags). | |
| startColumn | ✔️ | integer | 给定URL资源中脚本的列偏移量。 | ENColumn offset of the script within the resource with given URL. | |
| endLine | ✔️ | integer | 脚本的最后一行。 | ENLast line of the script. | |
| endColumn | ✔️ | integer | 脚本最后一行的长度。 | ENLength of the last line of the script. | |
| executionContextId | ✔️ | Runtime.ExecutionContextId | 指定脚本创建上下文。 | ENSpecifies script creation context. | |
| hash | ✔️ | string | 脚本的内容哈希值,SHA-256。 | ENContent hash of the script, SHA-256. | |
| buildId | ✔️ | string | 对于 Wasm 模块,build_id 自定义节的内容。对于 JavaScript,debugId 魔法注释。 | ENFor Wasm modules, the content of thebuild_id custom section. For JavaScript the debugId magic comment. | |
| executionContextAuxData | object | 嵌入器特定的辅助数据,可能匹配 {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string} | ENEmbedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string} | ||
| sourceMapURL | string | 与脚本关联的源映射的URL(如果有的话)。 | ENURL of source map associated with script (if any). | ||
| hasSourceURL | boolean | 是的,如果此脚本具有 sourceURL。 | ENTrue, if this script has sourceURL. | ||
| isModule | boolean | 是的,如果此脚本是 ES6 模块。 | ENTrue, if this script is ES6 module. | ||
| length | integer | 这个脚本长度。 | ENThis script length. | ||
| stackTrace | 🧪 | Runtime.StackTrace | JavaScript脚本解析事件触发时的顶层堆栈帧(如果可用)。 | ENJavaScript top stack frame of where the script parsed event was triggered if available. | |
| codeOffset | 🧪 | integer | 如果脚本语言是WebAssembly,模块中的代码段偏移量。 | ENIf the scriptLanguage is WebAssembly, the code section offset in the module. | |
| scriptLanguage | 🧪 | Debugger.ScriptLanguage | 脚本的语言。 | ENThe language of the script. | |
| embedderName | 🧪 | string | 嵌入器为此脚本提供的名称。 | ENThe name the embedder supplied for this script. |
👋Debugger.scriptParsed
当虚拟机解析脚本时触发。此事件也会在启用调试器时对所有已知和未收集的脚本触发。
EN
| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | 已解析脚本的标识符。 | ENIdentifier of the script parsed. | |
| url | ✔️ | string | URL或脚本解析的名称(如果有的话)。 | ENURL or name of the script parsed (if any). | |
| startLine | ✔️ | integer | 脚本在给定URL资源中的行偏移量(针对脚本标签)。 | ENLine offset of the script within the resource with given URL (for script tags). | |
| startColumn | ✔️ | integer | 脚本在给定URL资源中的列偏移量。 | ENColumn offset of the script within the resource with given URL. | |
| endLine | ✔️ | integer | 脚本的最后一行。 | ENLast line of the script. | |
| endColumn | ✔️ | integer | 脚本最后一行的长度。 | ENLength of the last line of the script. | |
| executionContextId | ✔️ | Runtime.ExecutionContextId | 指定脚本创建上下文。 | ENSpecifies script creation context. | |
| hash | ✔️ | string | 脚本的内容哈希值,SHA-256。 | ENContent hash of the script, SHA-256. | |
| buildId | ✔️ | string | 对于Wasm模块,build_id自定义部分的内容。对于JavaScript,debugId魔法注释。 | ENFor Wasm modules, the content of thebuild_id custom section. For JavaScript the debugId magic comment. | |
| executionContextAuxData | object | 嵌入器特定的辅助数据,可能匹配 {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string} | ENEmbedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string} | ||
| isLiveEdit | 🧪 | boolean | 是的,如果此脚本是实时编辑操作的结果。 | ENTrue, if this script is generated as a result of the live edit operation. | |
| sourceMapURL | string | 与脚本关联的源映射的URL(如果有)。 | ENURL of source map associated with script (if any). | ||
| hasSourceURL | boolean | 是的,如果这个脚本有sourceURL。 | ENTrue, if this script has sourceURL. | ||
| isModule | boolean | 是的,如果这个脚本是 ES6 模块。 | ENTrue, if this script is ES6 module. | ||
| length | integer | 这个脚本长度。 | ENThis script length. | ||
| stackTrace | 🧪 | Runtime.StackTrace | JavaScript 脚本解析事件触发时的顶层堆栈帧(如果可用)。 | ENJavaScript top stack frame of where the script parsed event was triggered if available. | |
| codeOffset | 🧪 | integer | 如果脚本语言是WebAssembly,模块中代码段的偏移量。 | ENIf the scriptLanguage is WebAssembly, the code section offset in the module. | |
| scriptLanguage | 🧪 | Debugger.ScriptLanguage | 脚本的语言。 | ENThe language of the script. | |
| debugSymbols | 🧪 | array[Debugger.DebugSymbols] | 如果脚本语言是WebAssembly,模块的调试符号来源。 | ENIf the scriptLanguage is WebAssembly, the source of debug symbols for the module. | |
| embedderName | 🧪 | string | 嵌入者为该脚本提供的名称。 | ENThe name the embedder supplied for this script. | |
| resolvedBreakpoints | 🧪 | array[ResolvedBreakpoint] | 此脚本中设置的断点列表,如果对setBreakpointByUrl的调用匹配此脚本的URL或哈希值。使用此列表的客户端可以忽略breakpointResolved事件,它们是等效的。 | ENThe list of set breakpoints in this script if calls tosetBreakpointByUrl matches this script's URL or hash. Clients that use this list can ignore the breakpointResolved event. They are equivalent. |
👋Debugger.breakpointResolved❌️
当断点被解析为实际的脚本和位置时触发。已弃用,建议使用 scriptParsed 事件中的 resolvedBreakpoints 替代。
EN
resolvedBreakpoints in the scriptParsed event.| 参数 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| breakpointId | ✔️ | BreakpointId | 断点唯一标识符。 | ENBreakpoint unique identifier. | |
| location | ✔️ | Location | 实际断点位置。 | ENActual breakpoint location. |
✅️️ Types
📌Debugger.BreakLocation
返回类型:object
| 属性 | 必填 | 标记 | 类型 | 描述 | 原文 |
|---|---|---|---|---|---|
| scriptId | ✔️ | Runtime.ScriptId | Debugger.scriptParsed 中报告的脚本标识符。 | ENScript identifier as reported in theDebugger.scriptParsed. | |
| lineNumber | ✔️ | integer | 脚本中的行号(从0开始计数)。 | ENLine number in the script (0-based). | |
| columnNumber | integer | 脚本中的列号(从0开始计数)。 | ENColumn number in the script (0-based). | ||
| type | string | 允许的值:debuggerStatement、call、return | ENAllowed Values:debuggerStatement, call, return |
📌Debugger.BreakpointId
断点标识符。
EN
返回类型:string