[英]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? 相关(甚至更为重要,而只是寻求确认)问题:那就是
id
在objectId
在整个程序/处理对象的唯一标识? 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.