0

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}. And the injectedScriptId never changes (at least I've never observed it changed). The id prop seems to be a unique object id in the memory.

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? 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?

Nurbol Alpysbayev
  • 19,522
  • 3
  • 54
  • 89

1 Answers1

0

Answer from 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. That’s why they have separate id counters.

So no, the internal id is not unique. Use the string.

Nurbol Alpysbayev
  • 19,522
  • 3
  • 54
  • 89