跳到主要内容

Runtime

Runtime 领域通过远程评估和镜像对象的方式暴露 JavaScript 运行时环境。评估结果以镜像对象的形式返回,这些镜像对象会公开对象的类型、字符串表示形式以及可用于进一步对象引用的唯一标识符。原始对象会保留在内存中,除非它们被显式释放,或者与其对象组中的其他对象一同被释放。

EN
Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.

✅️️ Methods

🔨Runtime.addBinding

如果executionContextId为空,则会在所有被检查上下文的全局对象上添加具有给定名称的绑定,包括后续创建的上下文,且绑定在页面重新加载后依然有效。绑定函数仅接受一个参数,该参数应为字符串类型,若输入其他类型,函数将抛出异常。每次调用绑定函数都会产生Runtime.bindingCalled通知。

EN
If executionContextId is empty, adds binding with the given name on the global objects of all inspected contexts, including those created later, bindings survive reloads. Binding function takes exactly one argument, this argument should be string, in case of any other input, function throws an exception. Each binding function call produces Runtime.bindingCalled notification.
参数必填标记类型描述原文
name✔️string
executionContextId🧪ExecutionContextId如果指定,绑定将仅对指定的执行上下文暴露。如果省略且未设置 executionContextName,则绑定将对目标的所有执行上下文暴露。此参数与 executionContextName 互斥。由于使用场景不明确及实现中存在缺陷(crbug.com/1169639),现已被 executionContextName 取代。executionContextId 将在未来被移除。
ENIf specified, the binding would only be exposed to the specified execution context. If omitted and executionContextName is not set, the binding is exposed to all execution contexts of the target. This parameter is mutually exclusive with executionContextName. Deprecated in favor of executionContextName due to an unclear use case and bugs in implementation (crbug.com/1169639). executionContextId will be removed in the future.
executionContextNamestring如果指定,该绑定将暴露给具有匹配名称的执行上下文,即使是在绑定添加后创建的上下文。另请参阅 ExecutionContext.namePage.addScriptToEvaluateOnNewDocumentworldName 参数。此参数与 executionContextId 互斥。
ENIf specified, the binding is exposed to the executionContext with matching name, even for contexts created after the binding is added. See also ExecutionContext.name and worldName parameter to Page.addScriptToEvaluateOnNewDocument. This parameter is mutually exclusive with executionContextId.

🔨Runtime.awaitPromise

为具有给定Promise对象ID的Promise添加处理程序。

EN
Add handler to promise with given promise object id.
参数必填标记类型描述原文
promiseObjectId✔️RemoteObjectIdpromise的标识符。
ENIdentifier of the promise.
returnByValueboolean结果是否预期为一个应通过值发送的JSON对象。
ENWhether the result is expected to be a JSON object that should be sent by value.
generatePreviewboolean是否应为结果生成预览。
ENWhether preview should be generated for the result.
返回对象类型描述原文
resultRemoteObjectPromise result. 如果 promise 被拒绝,将包含被拒绝的值。
ENPromise result. Will contain rejected value if promise was rejected.
exceptionDetailsExceptionDetails如果堆栈跟踪可用,则提供异常详细信息。
ENException details if stack strace is available.

🔨Runtime.callFunctionOn

在给定对象上调用具有指定声明的函数。结果的所属对象组继承自目标对象。

EN
Calls function with given declaration on the given object. Object group of the result is inherited from the target object.
参数必填标记类型描述原文
functionDeclaration✔️string声明要调用的函数。
ENDeclaration of the function to call.
objectIdRemoteObjectId调用函数的对象标识符。必须指定 objectId 或 executionContextId 中的一个。
ENIdentifier of the object to call function on. Either objectId or executionContextId should be specified.
argumentsarray[CallArgument]调用参数。所有调用参数必须与目标对象属于同一个JavaScript世界。
ENCall arguments. All call arguments must belong to the same JavaScript world as the target object.
silentboolean在静默模式下,评估期间抛出的异常不会被报告,也不会暂停执行。这会覆盖 setPauseOnException 的状态。
ENIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
returnByValueboolean结果是否预期为一个应通过值传递的JSON对象。可通过serializationOptions覆盖此设置。
ENWhether the result is expected to be a JSON object which should be sent by value. Can be overriden by serializationOptions.
generatePreview🧪boolean是否应为结果生成预览。
ENWhether preview should be generated for the result.
userGestureboolean是否应将执行视为由用户在界面中发起。
ENWhether execution should be treated as initiated by user in the UI.
awaitPromiseboolean执行是否应该await结果值,并在等待的Promise解析后返回。
ENWhether execution should await for resulting value and return once awaited promise is resolved.
executionContextIdExecutionContextId指定执行上下文,其全局对象将用于调用函数。必须指定 executionContextIdobjectId 之一。
ENSpecifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified.
objectGroupstring可用于释放多个对象的符号化组名。如果未指定objectGroup但指定了objectId,则objectGroup将从对象继承。
ENSymbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object.
throwOnSideEffect🧪boolean是否在评估过程中无法排除副作用时抛出异常。
ENWhether to throw an exception if side effect cannot be ruled out during evaluation.
uniqueContextId🧪string一种指定执行上下文以调用函数的替代方式。与可能在进程间重复使用的contextId相比,这种方式保证系统唯一性,因此可用于防止在非预期上下文中意外调用函数(例如因跨进程导航导致的情况)。此方式与executionContextId互斥。
ENAn alternative way to specify the execution context to call function on. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental function call in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with executionContextId.
serializationOptions🧪SerializationOptions指定结果序列化方式。如果提供,将覆盖 generatePreviewreturnByValue
ENSpecifies the result serialization. If provided, overrides generatePreview and returnByValue.
返回对象类型描述原文
resultRemoteObject调用结果。
ENCall result.
exceptionDetailsExceptionDetails异常详情。
ENException details.

🔨Runtime.compileScript

编译表达式。

EN
Compiles expression.
参数必填标记类型描述原文
expression✔️string要编译的表达式。
ENExpression to compile.
sourceURL✔️string脚本的源URL将被设置。
ENSource url to be set for the script.
persistScript✔️boolean指定是否应持久化已编译的脚本。
ENSpecifies whether the compiled script should be persisted.
executionContextIdExecutionContextId指定在哪个执行上下文中运行脚本。如果省略该参数,则将在被检查页面的上下文中执行评估。
ENSpecifies 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.
返回对象类型描述原文
scriptIdScriptId脚本的ID。
ENId of the script.
exceptionDetailsExceptionDetails异常详情。
ENException details.

🔨Runtime.disable

禁用执行上下文创建的报告。

EN
Disables reporting of execution contexts creation.

🔨Runtime.discardConsoleEntries

丢弃已收集的异常和''console API''调用。

EN
Discards collected exceptions and console API calls.

🔨Runtime.enable

启用通过executionContextCreated事件报告执行上下文创建的功能。当启用报告时,该事件将立即为每个现有的执行上下文发送。

EN
Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context.

🔨Runtime.evaluate

在全局对象上评估表达式。

EN
Evaluates expression on global object.
参数必填标记类型描述原文
expression✔️string要评估的表达式。
ENExpression to evaluate.
objectGroupstring可用于释放多个对象的符号组名称。
ENSymbolic group name that can be used to release multiple objects.
includeCommandLineAPIboolean确定在评估期间是否应提供命令行API。
ENDetermines whether Command Line API should be available during the evaluation.
silentboolean在静默模式下,评估期间抛出的异常不会被报告,也不会暂停执行。这会覆盖 setPauseOnException 的状态。
ENIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
contextIdExecutionContextId指定在哪个执行上下文中进行评估。如果省略该参数,则评估将在被检查页面的上下文中执行。这与uniqueContextId互斥,后者提供了一种在多进程环境中更可靠的识别执行上下文的方法。
ENSpecifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. This is mutually exclusive with uniqueContextId, which offers an alternative way to identify the execution context that is more reliable in a multi-process environment.
returnByValueboolean结果是否预期为一个应通过值传递的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.
userGestureboolean是否应将执行视为由用户在UI中发起。
ENWhether execution should be treated as initiated by user in the UI.
awaitPromiseboolean执行是否应该await结果值,并在等待的承诺解析后返回。
ENWhether execution should await for resulting value and return once awaited promise is resolved.
throwOnSideEffect🧪boolean是否在评估期间无法排除副作用时抛出异常。这隐含了下面的 disableBreaks
ENWhether to throw an exception if side effect cannot be ruled out during evaluation. This implies disableBreaks below.
timeout🧪TimeDelta在超时(毫秒数)后终止执行。
ENTerminate execution after timing out (number of milliseconds).
disableBreaks🧪boolean在执行期间禁用断点。
ENDisable breakpoints during execution.
replMode🧪boolean将此标志设为 true 可启用 let 重声明和顶层 await。请注意,仅当 let 变量本身源自 replMode 时才能进行重声明。
ENSetting this flag to true enables let re-declaration and top-level await. Note that let variables can only be re-declared if they originate from replMode themselves.
allowUnsafeEvalBlockedByCSP🧪boolean目标的内容安全策略(CSP)可能会阻止'unsafe-eval',这包括使用不可调用参数调用时的eval()、Function()、setTimeout()和setInterval()。此标志会绕过CSP以进行此评估,并允许unsafe-eval。默认为true。
ENThe Content Security Policy (CSP) for the target might block 'unsafe-eval' which includes eval(), Function(), setTimeout() and setInterval() when called with non-callable arguments. This flag bypasses CSP for this evaluation and allows unsafe-eval. Defaults to true.
uniqueContextId🧪string指定执行上下文的另一种方式。与可能在多个进程间重复使用的contextId相比,这种方式保证系统唯一性,因此可用于防止表达式在非预期上下文中意外执行(例如因跨进程导航导致的情况)。此方式与contextId互斥。
ENAn alternative way to specify the execution context to evaluate in. Compared to contextId that may be reused across processes, this is guaranteed to be system-unique, so it can be used to prevent accidental evaluation of the expression in context different than intended (e.g. as a result of navigation across process boundaries). This is mutually exclusive with contextId.
serializationOptions🧪SerializationOptions指定结果序列化方式。如果提供,将覆盖 generatePreviewreturnByValue
ENSpecifies the result serialization. If provided, overrides generatePreview and returnByValue.
返回对象类型描述原文
resultRemoteObject评估结果。
ENEvaluation result.
exceptionDetailsExceptionDetails异常详情。
ENException details.

🔨Runtime.getProperties

返回给定对象的属性。结果的所属对象组继承自目标对象。

EN
Returns properties of a given object. Object group of the result is inherited from the target object.
参数必填标记类型描述原文
objectId✔️RemoteObjectId返回属性的对象标识符。
ENIdentifier of the object to return properties for.
ownPropertiesboolean如果为真,则仅返回元素自身的属性,不包括其原型链中的属性。
ENIf true, returns properties belonging only to the element itself, not to its prototype chain.
accessorPropertiesOnly🧪boolean如果为真,则仅返回访问器属性(带有getter/setter);内部属性也不会被返回。
ENIf true, returns accessor properties (with getter/setter) only; internal properties are not returned either.
generatePreview🧪boolean是否应为结果生成预览。
ENWhether preview should be generated for the results.
nonIndexedPropertiesOnly🧪boolean如果为真,则仅返回非索引属性。
ENIf true, returns non-indexed properties only.
返回对象类型描述原文
resultarray[PropertyDescriptor]对象属性。
ENObject properties.
internalPropertiesarray[InternalPropertyDescriptor]内部对象属性(仅限元素本身)。
ENInternal object properties (only of the element itself).
privatePropertiesarray[PrivatePropertyDescriptor]对象私有属性。
ENObject private properties.
exceptionDetailsExceptionDetails异常详情。
ENException details.

🔨Runtime.globalLexicalScopeNames

返回全局作用域中所有的let、const和class变量。

EN
Returns all let, const and class variables from global scope.
参数必填标记类型描述原文
executionContextIdExecutionContextId指定在哪个执行上下文中查找全局作用域变量。
ENSpecifies in which execution context to lookup global scope variables.
返回对象类型描述原文
namesarray[string]

🔨Runtime.queryObjects

参数必填标记类型描述原文
prototypeObjectId✔️RemoteObjectId返回对象的原型标识符。
ENIdentifier of the prototype to return objects for.
objectGroupstring可用于释放结果的符号组名称。
ENSymbolic group name that can be used to release the results.
返回对象类型描述原文
objectsRemoteObject包含对象的数组。
ENArray with objects.

🔨Runtime.releaseObject

释放具有给定ID的远程对象。

EN
Releases remote object with given id.
参数必填标记类型描述原文
objectId✔️RemoteObjectId要释放的对象的标识符。
ENIdentifier of the object to release.

🔨Runtime.releaseObjectGroup

释放属于给定组的所有远程对象。

EN
Releases all remote objects that belong to a given group.
参数必填标记类型描述原文
objectGroup✔️string符号化对象组名称。
ENSymbolic object group name.

🔨Runtime.removeBinding

该方法不会从全局对象中移除绑定函数,而是取消当前运行时代理对Runtime.bindingCalled通知的订阅。

EN
This method does not remove binding function from global object but unsubscribes current runtime agent from Runtime.bindingCalled notifications.
参数必填标记类型描述原文
name✔️string

🔨Runtime.runIfWaitingForDebugger

指示被检查的实例在等待调试器附加时运行。

EN
Tells inspected instance to run if it was waiting for debugger to attach.

🔨Runtime.runScript

在给定的上下文中运行指定ID的脚本。

EN
Runs script with given id in a given context.
参数必填标记类型描述原文
scriptId✔️ScriptId要运行的脚本的Id。
ENId of the script to run.
executionContextIdExecutionContextId指定在哪个执行上下文中运行脚本。如果省略该参数,则将在被检查页面的上下文中执行评估。
ENSpecifies 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.
objectGroupstring可用于释放多个对象的符号组名称。
ENSymbolic group name that can be used to release multiple objects.
silentboolean在静默模式下,评估期间抛出的异常不会被报告,也不会暂停执行。这会覆盖 setPauseOnException 状态。
ENIn silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.
includeCommandLineAPIboolean确定在评估期间是否应提供命令行API。
ENDetermines whether Command Line API should be available during the evaluation.
returnByValueboolean结果是否预期为一个JSON对象,该对象应通过值发送。
ENWhether the result is expected to be a JSON object which should be sent by value.
generatePreviewboolean是否应为结果生成预览。
ENWhether preview should be generated for the result.
awaitPromiseboolean执行是否应该 await 等待结果值,并在等待的 Promise 解析完成后返回。
ENWhether execution should await for resulting value and return once awaited promise is resolved.
返回对象类型描述原文
resultRemoteObject运行结果。
ENRun result.
exceptionDetailsExceptionDetails异常详情。
ENException details.

🔨Runtime.setAsyncCallStackDepth

启用或禁用异步调用堆栈跟踪。

EN
Enables or disables async call stacks tracking.
参数必填标记类型描述原文
maxDepth✔️integer异步调用栈的最大深度。设置为 0 将有效禁用收集异步调用栈(默认)。
ENMaximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default).

🔨Runtime.getExceptionDetails🧪

此方法尝试查找并填充JavaScript Error对象的异常详情。请注意,只有当Error被抛出时Runtime域处于启用状态,生成的exceptionDetails中的stackTrace部分才会被填充。

EN
This method tries to lookup and populate exception details for a JavaScript Error object. Note that the stackTrace portion of the resulting exceptionDetails will only be populated if the Runtime domain was enabled at the time when the Error was thrown.
参数必填标记类型描述原文
errorObjectId✔️RemoteObjectId解析异常详细信息的错误对象。
ENThe error object for which to resolve the exception details.
返回对象类型描述原文
exceptionDetailsExceptionDetails

🔨Runtime.getHeapUsage🧪

返回JavaScript堆使用情况。这是对应隔离区的总使用量,不限定于特定的运行时。

EN
Returns the JavaScript heap usage. It is the total usage of the corresponding isolate not scoped to a particular Runtime.
返回对象类型描述原文
usedSizenumber已使用的 JavaScript 堆大小(以字节为单位)。
ENUsed JavaScript heap size in bytes.
totalSizenumber已分配的 JavaScript 堆大小(以字节为单位)。
ENAllocated JavaScript heap size in bytes.
embedderHeapUsedSizenumber嵌入器垃圾回收堆中已使用的字节大小。
ENUsed size in bytes in the embedder's garbage-collected heap.
backingStorageSizenumber数组缓冲区和外部字符串后备存储的字节大小。
ENSize in bytes of backing storage for array buffers and external strings.

🔨Runtime.getIsolateId🧪

返回隔离ID。

EN
Returns the isolate id.
返回对象类型描述原文
idstring隔离ID。
ENThe isolate id.

🔨Runtime.setCustomObjectFormatterEnabled🧪

参数必填标记类型描述原文
enabled✔️boolean

🔨Runtime.setMaxCallStackSizeToCapture🧪

参数必填标记类型描述原文
size✔️integer

🔨Runtime.terminateExecution🧪

终止当前或下一次JavaScript执行。当最外层的脚本执行结束时,将取消终止。

EN
Terminate current or next JavaScript execution. Will cancel the termination when the outer-most script execution ends.

✅️️ Events

👋Runtime.consoleAPICalled

当控制台API被调用时发出。

EN
Issued when console API was called.
参数必填标记类型描述原文
type✔️string调用的类型。
允许的值:logdebuginfoerrorwarningdirdirxmltabletraceclearstartGroupstartGroupCollapsedendGroupassertprofileprofileEndcounttimeEnd
ENType of the call.
Allowed Values: log, debug, info, error, warning, dir, dirxml, table, trace, clear, startGroup, startGroupCollapsed, endGroup, assert, profile, profileEnd, count, timeEnd
args✔️array[RemoteObject]调用参数。
ENCall arguments.
executionContextId✔️ExecutionContextId调用发生所在的上下文标识符。
ENIdentifier of the context where the call was made.
timestamp✔️Timestamp调用时间戳。
ENCall timestamp.
stackTraceStackTrace调用时捕获的堆栈跟踪。对于以下调用类型,异步堆栈链会自动报告:asserterrortracewarning。对于其他类型,可以使用 Debugger.getStackTracestackTrace.parentId 字段来获取异步调用链。
ENStack trace captured when the call was made. The async stack chain is automatically reported for the following call types: assert, error, trace, warning. For other types the async call chain can be retrieved using Debugger.getStackTrace and stackTrace.parentId field.
context🧪string非默认控制台上下文(非 console.*)调用的控制台上下文描述符:对于未命名上下文的调用使用 'anonymous#unique-logger-id',对于命名上下文的调用使用 'name#unique-logger-id'。
ENConsole context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context.

👋Runtime.exceptionRevoked

当未处理的异常被撤销时发出。

EN
Issued when unhandled exception was revoked.
参数必填标记类型描述原文
reason✔️string描述异常被撤销的原因。
ENReason describing why exception was revoked.
exceptionId✔️integer被撤销异常的ID,如 exceptionThrown 中报告。
ENThe id of revoked exception, as reported in exceptionThrown.

👋Runtime.exceptionThrown

当异常被抛出且未被处理时发出。

EN
Issued when exception was thrown and unhandled.
参数必填标记类型描述原文
timestamp✔️Timestamp异常的时间戳。
ENTimestamp of the exception.
exceptionDetails✔️ExceptionDetails

👋Runtime.executionContextCreated

当新的执行上下文被创建时发出。

EN
Issued when new execution context is created.
参数必填标记类型描述原文
context✔️ExecutionContextDescription一个新创建的''执行上下文''。
ENA newly created execution context.

👋Runtime.executionContextDestroyed

当执行上下文被销毁时发出。

EN
Issued when execution context is destroyed.
参数必填标记类型描述原文
executionContextId✔️❌️ExecutionContextId被销毁上下文的ID
ENId of the destroyed context
executionContextUniqueId✔️🧪string被销毁上下文的唯一标识符
ENUnique Id of the destroyed context

👋Runtime.executionContextsCleared

当浏览器中的所有执行上下文被清除时发出

EN
Issued when all executionContexts were cleared in browser

👋Runtime.inspectRequested

当对象需要被检查时发出(例如,作为 inspect() 命令行 API 调用的结果)。

EN
Issued when object should be inspected (for example, as a result of inspect() command line API call).
参数必填标记类型描述原文
object✔️RemoteObject
hints✔️object
executionContextId🧪ExecutionContextId调用发生所在上下文的标识符。
ENIdentifier of the context where the call was made.

👋Runtime.bindingCalled🧪

每次调用绑定''时都会发出通知。

EN
Notification is issued every time when binding is called.
参数必填标记类型描述原文
name✔️string
payload✔️string
executionContextId✔️ExecutionContextId调用发生所在上下文的标识符。
ENIdentifier of the context where the call was made.

✅️️ Types

📌Runtime.CallArgument

表示函数调用参数。应指定远程对象ID objectId、原始值 value、不可序列化的原始值,或者都不指定(对应undefined情况)。

EN
Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified.

返回类型:object

属性必填标记类型描述原文
valueany原始值或可序列化的JavaScript对象。
ENPrimitive value or serializable javascript object.
unserializableValueUnserializableValue无法进行 JSON 序列化的原始值。
ENPrimitive value which can not be JSON-stringified.
objectIdRemoteObjectId远程对象句柄。
ENRemote object handle.

📌Runtime.CallFrame

运行时错误和断言的堆栈条目。

EN
Stack entry for runtime errors and assertions.

返回类型:object

属性必填标记类型描述原文
functionName✔️stringJavaScript函数名。
ENJavaScript function name.
scriptId✔️ScriptIdJavaScript 脚本 ID。
ENJavaScript script id.
url✔️stringJavaScript脚本名称或URL。
ENJavaScript script name or url.
lineNumber✔️integerJavaScript 脚本行号(从 0 开始计数)。
ENJavaScript script line number (0-based).
columnNumber✔️integerJavaScript脚本列号(从0开始计数)。
ENJavaScript script column number (0-based).

📌Runtime.DeepSerializedValue

表示深度序列化的值。

EN
Represents deep serialized value.

返回类型:object

属性必填标记类型描述原文
type✔️string允许的值:undefinednullstringnumberbooleanbigintregexpdatesymbolarrayobjectfunctionmapsetweakmapweakseterrorproxypromisetypedarrayarraybuffernodewindowgenerator
ENAllowed Values: undefined, null, string, number, boolean, bigint, regexp, date, symbol, array, object, function, map, set, weakmap, weakset, error, proxy, promise, typedarray, arraybuffer, node, window, generator
valueany
objectIdstring
weakLocalObjectReferenceinteger设置在序列化过程中值引用是否被多次遇到。在这种情况下,值仅提供给其中一个序列化值。在单个CDP调用的范围内,每个值都是唯一的。
ENSet if value reference met more then once during serialization. In such case, value is provided only to one of the serialized values. Unique per value in the scope of one CDP call.

📌Runtime.ExceptionDetails

关于在脚本编译或执行期间抛出的异常(或错误)的详细信息。

EN
Detailed information about exception (or error) that was thrown during script compilation or execution.

返回类型:object

属性必填标记类型描述原文
exceptionId✔️integer异常ID。
ENException id.
text✔️string异常文本,在异常对象可用时应与之一并使用。
ENException text, which should be used together with exception object when available.
lineNumber✔️integer异常位置的行号(从0开始计数)。
ENLine number of the exception location (0-based).
columnNumber✔️integer异常位置的列号(从0开始计数)。
ENColumn number of the exception location (0-based).
scriptIdScriptId异常位置的脚本ID。
ENScript ID of the exception location.
urlstring异常位置的URL,用于脚本未被报告时使用。
ENURL of the exception location, to be used when the script was not reported.
stackTraceStackTraceJavaScript堆栈跟踪(如果可用)。
ENJavaScript stack trace if available.
exceptionRemoteObject如果可用,则返回异常对象。
ENException object if available.
executionContextIdExecutionContextId发生异常的上下文的标识符。
ENIdentifier of the context where exception happened.
exceptionMetaData🧪object包含客户端与此异常关联的元数据条目的字典,例如有关关联网络请求的信息等。
ENDictionary with entries of meta data that the client associated with this exception, such as information about associated network requests, etc.

📌Runtime.ExecutionContextDescription

一个隔离世界的描述。

EN
Description of an isolated world.

返回类型:object

属性必填标记类型描述原文
id✔️ExecutionContextId执行上下文的唯一标识符。可用于指定脚本评估应在哪个执行上下文中执行。
ENUnique id of the execution context. It can be used to specify in which execution context script evaluation should be performed.
origin✔️string执行上下文来源。
ENExecution context origin.
name✔️string描述给定上下文的人类可读名称。
ENHuman readable name describing given context.
uniqueId✔️🧪string一个系统唯一的执行上下文标识符。与id不同,它在多个进程中是唯一的,因此可以在后端执行跨进程导航时可靠地用于识别特定上下文。
ENA system-unique execution context identifier. Unlike the id, this is unique across multiple processes, so can be reliably used to identify specific context while backend performs a cross-process navigation.
auxDataobject嵌入器特定的辅助数据,可能匹配 {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string}
ENEmbedder-specific auxiliary data likely matching {isDefault: boolean, type: 'default'|'isolated'|'worker', frameId: string}

📌Runtime.ExecutionContextId

执行上下文的标识符。

EN
Id of an execution context.

返回类型:integer


📌Runtime.InternalPropertyDescriptor

对象内部属性描述符。此属性在 JavaScript 代码中通常不可见。

EN
Object internal property descriptor. This property isn't normally visible in JavaScript code.

返回类型:object

属性必填标记类型描述原文
name✔️string常规属性名称。
ENConventional property name.
valueRemoteObject与属性关联的值。
ENThe value associated with the property.

📌Runtime.PropertyDescriptor

对象属性描述符。

EN
Object property descriptor.

返回类型:object

属性必填标记类型描述原文
name✔️string属性名称或符号描述。
ENProperty name or symbol description.
valueRemoteObject与该属性关联的值。
ENThe value associated with the property.
writableboolean如果与属性关联的值可以被更改,则为真(仅限数据描述符)。
ENTrue if the value associated with the property may be changed (data descriptors only).
getRemoteObject一个作为属性获取器的函数,如果没有获取器则为 undefined(仅限访问器描述符)。
ENA function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only).
setRemoteObject一个作为属性设置器的函数,如果没有设置器则为 undefined(仅限访问器描述符)。
ENA function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only).
configurable✔️boolean如果此属性描述符的类型可以更改,并且该属性可以从相应对象中删除,则为真。
ENTrue if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object.
enumerable✔️boolean如果此属性在对相应对象的属性进行枚举时出现,则为真。
ENTrue if this property shows up during enumeration of the properties on the corresponding object.
wasThrownboolean如果结果在求值过程中被抛出,则为真。
ENTrue if the result was thrown during the evaluation.
isOwnboolean如果该属性为对象所拥有,则为真。
ENTrue if the property is owned for the object.
symbolRemoteObject属性符号对象,如果该属性是 symbol 类型。
ENProperty symbol object, if the property is of the symbol type.

📌Runtime.RemoteObject

引用原始JavaScript对象的镜像对象。

EN
Mirror object referencing original JavaScript object.

返回类型:object

属性必填标记类型描述原文
type✔️string对象类型。
允许的值:objectfunctionundefinedstringnumberbooleansymbolbigint
ENObject type.
Allowed Values: object, function, undefined, string, number, boolean, symbol, bigint
subtypestring对象子类型提示。仅针对 object 类型值指定。注意:如果此处进行任何更改,请确保同时更新下方 ObjectPreviewPropertyPreview 中的 subtype

允许值:arraynullnoderegexpdatemapsetweakmapweaksetiteratorgeneratorerrorproxypromisetypedarrayarraybufferdataviewwebassemblymemorywasmvaluetrustedtype
ENObject subtype hint. Specified for object type values only. NOTE: If you change anything here, make sure to also update subtype in ObjectPreview and PropertyPreview below.
Allowed Values: array, null, node, regexp, date, map, set, weakmap, weakset, iterator, generator, error, proxy, promise, typedarray, arraybuffer, dataview, webassemblymemory, wasmvalue, trustedtype
classNamestring对象类(构造函数)名称。仅针对 object 类型值指定。
ENObject class (constructor) name. Specified for object type values only.
valueany在原始值或JSON值(如果被请求)的情况下,远程对象的值。
ENRemote object value in case of primitive values or JSON values (if it was requested).
unserializableValueUnserializableValue无法被 JSON 序列化的原始值没有 value 属性,但会获得此属性。
ENPrimitive value which can not be JSON-stringified does not have value, but gets this property.
descriptionstring对象的字符串表示形式。
ENString representation of the object.
deepSerializedValue🧪DeepSerializedValue深度序列化值。
ENDeep serialized value.
objectIdRemoteObjectId唯一对象标识符(针对非原始值)。
ENUnique object identifier (for non-primitive values).
preview🧪ObjectPreview包含缩写属性值的预览。仅针对 object 类型值指定。
ENPreview containing abbreviated property values. Specified for object type values only.
customPreview🧪CustomPreview

📌Runtime.RemoteObjectId

唯一对象标识符。

EN
Unique object identifier.

返回类型:string


📌Runtime.ScriptId

唯一的脚本标识符。

EN
Unique script identifier.

返回类型:string


📌Runtime.SerializationOptions

表示序列化的选项。覆盖 generatePreviewreturnByValue

EN
Represents options for serialization. Overrides generatePreview and returnByValue.

返回类型:object

属性必填标记类型描述原文
serialization✔️string允许的值:deepjsonidOnly
ENAllowed Values: deep, json, idOnly
maxDepthinteger深度序列化深度。默认值为完全深度。仅在 deep 序列化模式下生效。
ENDeep serialization depth. Default is full depth. Respected only in deep serialization mode.
additionalParametersobject嵌入器特定参数。例如,如果连接到 Chrome 中的 V8,这些参数通过 maxNodeDepth: integerincludeShadowTree: "none" | "open" | "all" 控制 DOM 序列化。参数值只能是字符串或整数类型。
ENEmbedder-specific parameters. For example if connected to V8 in Chrome these control DOM serialization via maxNodeDepth: integer and includeShadowTree: "none" | "open" | "all". Values can be only of type string or integer.

📌Runtime.StackTrace

断言或错误消息的调用帧。

EN
Call frames for assertions or error messages.

返回类型:object

属性必填标记类型描述原文
descriptionstring此堆栈跟踪的字符串标签。对于异步跟踪,这可能是发起异步调用的函数名称。
ENString label of this stack trace. For async traces this may be a name of the function that initiated the async call.
callFrames✔️array[CallFrame]JavaScript 函数名称。
ENJavaScript function name.
parentStackTrace此前的异步 JavaScript 调用栈(若存在)。
ENAsynchronous JavaScript stack trace that preceded this stack, if available.
parentId🧪StackTraceId此前的异步JavaScript堆栈跟踪(如果可用)。
ENAsynchronous JavaScript stack trace that preceded this stack, if available.

📌Runtime.TimeDelta

毫秒数。

EN
Number of milliseconds.

返回类型:number


📌Runtime.Timestamp

自纪元以来的毫秒数。

EN
Number of milliseconds since epoch.

返回类型:number


📌Runtime.UnserializableValue

无法进行 JSON 序列化的原始值。包括值 -0NaNInfinity-Infinity 以及大整数字面量。

EN
Primitive value which cannot be JSON-stringified. Includes values -0, NaN, Infinity, -Infinity, and bigint literals.

返回类型:string


📌Runtime.CustomPreview🧪

返回类型:object

属性必填标记类型描述原文
header✔️string格式化程序调用formatter.header(object, config)后得到的JSON字符串化结果。其中包含代表RemoteObject的json ML数组。
ENThe JSON-stringified result of formatter.header(object, config) call. It contains json ML array that represents RemoteObject.
bodyGetterIdRemoteObjectId如果格式化程序在 formatter.hasBody 调用中返回 true,那么 bodyGetterId 将包含一个 RemoteObjectId,该 ID 对应一个函数,该函数返回 formatter.body(object, config) 调用的结果。结果值为 json ML 数组。
ENIf formatter returns true as a result of formatter.hasBody call then bodyGetterId will contain RemoteObjectId for the function that returns result of formatter.body(object, config) call. The result value is json ML array.

📌Runtime.EntryPreview🧪

返回类型:object

属性必填标记类型描述原文
keyObjectPreview键的预览。为类似映射的集合条目指定。
ENPreview of the key. Specified for map-like collection entries.
value✔️ObjectPreview值的预览。
ENPreview of the value.

📌Runtime.ObjectPreview🧪

包含缩写远程对象值的对象。

EN
Object containing abbreviated remote object value.

返回类型:object

属性必填标记类型描述原文
type✔️string对象类型。
允许的取值:objectfunctionundefinedstringnumberbooleansymbolbigint
ENObject type.
Allowed Values: object, function, undefined, string, number, boolean, symbol, bigint
subtypestring对象子类型提示。仅针对 object 类型值指定。
允许值:arraynullnoderegexpdatemapsetweakmapweaksetiteratorgeneratorerrorproxypromisetypedarrayarraybufferdataviewwebassemblymemorywasmvaluetrustedtype
ENObject subtype hint. Specified for object type values only.
Allowed Values: array, null, node, regexp, date, map, set, weakmap, weakset, iterator, generator, error, proxy, promise, typedarray, arraybuffer, dataview, webassemblymemory, wasmvalue, trustedtype
descriptionstring对象的字符串表示。
ENString representation of the object.
overflow✔️boolean如果原始对象的某些属性或条目无法容纳,则为真。
ENTrue iff some of the properties or entries of the original object did not fit.
properties✔️array[PropertyPreview]属性列表。
ENList of the properties.
entriesarray[EntryPreview]条目列表。仅针对 mapset 子类型值指定。
ENList of the entries. Specified for map and set subtype values only.

📌Runtime.PrivatePropertyDescriptor🧪

对象私有字段描述符。

EN
Object private field descriptor.

返回类型:object

属性必填标记类型描述原文
name✔️string私有属性名称。
ENPrivate property name.
valueRemoteObject与私有属性关联的值。
ENThe value associated with the private property.
getRemoteObject一个函数,用作私有属性的getter;如果没有getter,则为undefined(仅适用于访问器描述符)。
ENA function which serves as a getter for the private property, or undefined if there is no getter (accessor descriptors only).
setRemoteObject一个函数,用作私有属性的设置器,如果没有设置器则为 undefined(仅限访问器描述符)。
ENA function which serves as a setter for the private property, or undefined if there is no setter (accessor descriptors only).

📌Runtime.PropertyPreview🧪

返回类型:object

属性必填标记类型描述原文
name✔️string属性名称。
ENProperty name.
type✔️string对象类型。访问器意味着该属性本身是一个访问器属性。
允许的值:objectfunctionundefinedstringnumberbooleansymbolaccessorbigint
ENObject type. Accessor means that the property itself is an accessor property.
Allowed Values: object, function, undefined, string, number, boolean, symbol, accessor, bigint
valuestring用户友好的属性值字符串。
ENUser-friendly property value string.
valuePreviewObjectPreview嵌套值预览。
ENNested value preview.
subtypestring对象子类型提示。仅针对object类型值指定。
允许取值:array, null, node, regexp, date, map, set, weakmap, weakset, iterator, generator, error, proxy, promise, typedarray, arraybuffer, dataview, webassemblymemory, wasmvalue, trustedtype
ENObject subtype hint. Specified for object type values only.
Allowed Values: array, null, node, regexp, date, map, set, weakmap, weakset, iterator, generator, error, proxy, promise, typedarray, arraybuffer, dataview, webassemblymemory, wasmvalue, trustedtype

📌Runtime.StackTraceId🧪

如果设置了 debuggerId,堆栈跟踪来自另一个调试器,并且可以在那里解析。这允许跟踪跨调试器的调用。有关用法,请参见 Runtime.StackTraceDebugger.paused

EN
If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages.

返回类型:object

属性必填标记类型描述原文
id✔️string
debuggerIdUniqueDebuggerId

📌Runtime.UniqueDebuggerId🧪

当前调试器的唯一标识符。

EN
Unique identifier of current debugger.

返回类型:string