question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: what is injectedScriptId (lacking documentation)?

See original GitHub issue

Reposting a StackOverflow question here (because got no answer there):

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.

So what’s the purpose of the injectedScriptId and what is InjectedScript?

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?

Help me please!

P.S. Maybe the answer should also go to the documentation.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
JoelEinbindercommented, Jun 7, 2019

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.

0reactions
ysmoodcommented, Dec 20, 2020

@JoelEinbinder The hack you mentioned has some race condition issue. I hope the chrome team can add an official endpoint for it. Since it’s pretty useful to check if an object is inside an iframe or not. And the playwright is using injectedScriptId? https://github.com/microsoft/playwright/blob/be16ce4bd200be6e38f542321336f816fa19575f/src/server/webkit/wkPage.ts#L484

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is Apple loading an anonymous script into my web ...
Redistribution and use in source and binary forms, with or without * modification, ... typeof document.all is always 'undefined'. return InjectedScript.
Read more >
WebView2 Win32 C++ ICoreWebView2 | Microsoft Learn
Run JavaScript code from the javascript parameter in the current top-level document rendered in the WebView. get_BrowserProcessId, The process ...
Read more >
Frequently Asked Questions — TagUI 6.110.0 documentation
TagUI is a free, open-source, cross-platform software released under the Apache 2.0 license. How do I find the XPath of a web element?¶....
Read more >
Expand Post - Help - Intuit
Sebastien Chartier asked a question. Edited April 19, 2022 at 7:28 PM. Where can I find documentation for developping "iframe' plugins like ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found