Retrieving local scope from call frame
See original GitHub issueI’m trying to retrieve the local scope data from chrome-remote-interface:
But when logging the frame it shows this:
{
callFrameId: '5692085564504316912.24.0',
functionName: '$u',
functionLocation: { scriptId: '1025', lineNumber: 3, columnNumber: 27701 },
location: { scriptId: '1025', lineNumber: 3, columnNumber: 27729 },
url: 'https://x/init.js',
scopeChain: [
{
type: 'local',
object: [Object],
name: '$u',
startLocation: [Object],
endLocation: [Object]
},
{
type: 'closure',
object: [Object],
startLocation: [Object],
endLocation: [Object]
},
{ type: 'global', object: [Object] }
],
this: { type: 'undefined' },
returnValue: { type: 'string', value: '/blocked' }
}
{
type: 'local',
object: {
type: 'object',
className: 'Object',
description: 'Object',
objectId: '3902945018858753175.1.508'
},
name: '$u',
startLocation: { scriptId: '9', lineNumber: 3, columnNumber: 27701 },
endLocation: { scriptId: '9', lineNumber: 3, columnNumber: 27730 }
}
How would you retrieve the e variable containing “pathname” from the local scope?
Component | Version |
---|---|
Operating system | Windows 10 |
Node.js | 14.18.0 |
Chrome/Chromium/… | Chrome 96.0.4664.45 |
chrome-remote-interface | 0.31.1 |
Is Chrome running in a container? NO
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
java - Getting local variables from a stack frame on the JVM
Is there any way to get a map or other data structure of the local variables in the current scope in on the...
Read more >Scope, Frame and Stack
Once foo() is invoked, it has its own frame created on the stack, one that now has its own, 'local' scope. (Note that...
Read more >Call Stack, Scope & Lifetime of Variables - YouTube
Concepts: Scope and Lifetime of VariablesProgram Call StackLocal and Global Variables.
Read more >How does variables inside a local scope work? Do they get ...
From what I know, when a function is called, it gets pushed onto the stack with all its data and when its scope...
Read more >How are variables stored in and retrieved from the program ...
Storing local variables on a stack is an implementation detail – basically an optimization. You can think of it this way.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
No problem, I will just iterate over them. Thanks for the quick replies & hard work put into this interface.
Not 100% sure, but I’m afraid you’ll have to iterate over the nested objects and call
Runtime.getProperties
for each of them. If you can come up with a standalone example I could maybe be more helpful.