简体   繁体   English

在Chrome Devtools协议中,什么是`injectScriptId`?

[英]In Chrome Devtools Protocol, what is `injectedScriptId`?

In CDP, when, for example, executing Debugger.evaluateOnCallFrame in order to evaluate some object, the response will contain an objectId property that looks like {injectedScriptId: 1, id: 413} . 在CDP中,例如,当为了评估某个对象而执行Debugger.evaluateOnCallFrame时,响应将包含一个看起来像{injectedScriptId: 1, id: 413}objectId属性。 And the injectedScriptId never changes (at least I've never observed it changed). 并且injectedScriptId永远不会改变(至少我从未观察到它发生了变化)。 The id prop seems to be a unique object id in the memory. id prop似乎是内存中唯一的对象id。

Related (even more important, but simply seeking confirmation) question: is the id in objectId a unique identifier of the object across the whole program/process? 相关(甚至更为重要,而只是寻求确认)问题:那就是idobjectId在整个程序/处理对象的唯一标识? Can I rely on it in order to build a serialized, circular-reference-free string representation of variables? 我可以依赖它来构建一个序列化的,无循环引用的变量字符串表示吗?

So what's the purpose of the injectedScriptId and what is InjectedScript ? 那么,有什么目的injectedScriptId ,什么是InjectedScript

Answer from JoelEinbinder : JoelEinbinder的回答

This is an internal implementation detail so you shouldn't rely on it and it may change at any time without warning, or not behave consistently. 这是一个内部实现细节,因此您不应该依赖它,它可能会在没有警告的情况下随时更改,或者行为不一致。

Injected script is the internal thing that we inject into a JavaScript execution context to manage remote objects and other things. 注入脚本是我们注入JavaScript执行上下文以管理远程对象和其他事物的内部事物。 That's why they have separate id counters. 这就是为什么他们有独立的id计数器。

So no, the internal id is not unique. 所以不,内部ID不是唯一的。 Use the string. 使用字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何重定向到chrome-devtools://协议? - How to redirect to the chrome-devtools:// protocol? Chrome DevTools 协议:如何获取节点的单击事件处理程序名称 - Chrome DevTools Protocol: How to get click event handler name of a Node 如何在没有 Puppeteer 的情况下通过 DevTools 协议模拟 Chrome window 中的点击? - How to simulate clicks in a Chrome window via the DevTools Protocol without Puppeteer? Chrome DevTools 协议:如何取消订阅 Page.javascriptDialogOpening 事件 - Chrome DevTools Protocol: How to unsubscribe Page.javascriptDialogOpening event “儿童”在Chrome Devtools中意味着什么? - What does “child” mean in Chrome Devtools? 是什么提示 chrome devtools 寻找源图 - What prompts chrome devtools to look for source maps 括号在chrome devtools内存标签中的含义 - What the parentheses means in chrome devtools memory tab Chrome DevTools:这个箭头(< - )是什么意思? - Chrome DevTools: what's this arrow(<-) meaning? Chrome DevTools中的Handled过滤器用于什么? - What is the Handled filter in Chrome DevTools used for? 如何使用 Puppeteer 和 Chrome DevTools 协议修改请求标头? (可能是JS语法问题) - How to modify request headers using Puppeteer & Chrome DevTools Protocol? (Possibly a JS syntax issue)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM