So i seem to have found the ultimate problem that i believe has an easy way to get around, but me personally after 3h of research on all forums gave up XD.
So i visited an online React website that contained webplayer.js file. Inside this bundle, we have an incredibly large and nested array that stores all the variables of the app and that no recursive function can get into before exceeding recursion limits.
The reason i want to reach a variable in this js file is to be able to manipulate a variable with my own js file(trying to create a plugin/tampermonkey script, never been so though XD). So i would like to find this specific key inside the large array in for example the chrome console to be able to edit it.
If i want to manipulate a variable here thats located in this large array for example: ("video-autoplay" : true)
, the only way i am able to do this right now in chrome is:
- Place a breakpoint where the webplayer.js sets
var autoPlay = Key to ("video-autoplay" : true)
- manually edit the variable when the breakpoint hits it...
The reason this works is when i hit the breakpoint i get into the same scope as that variable and i can simply from the chrome console now type autoPlay = False;
But to make this automated, i cannot rely on setting a breakpoint, therefore i somehow need to be able to get access to this key in the very large array.
Is there maybe a javascript function that can get this key without recursive search, maybe through a hash id(then using some sort of lookup table?) or something similar that i can inspect when i hit the breakpoint for var autoPlay = ...
and try to find maybe a way to uniquely reach that variable again after im out of the scope. (i did try to add it to the watch list, but again as soon as the breakpoint continues and goes out of scope it gets deleted)
So all in all, i believe that React variables that is coded turns into an array of nested variables when building the production files. So if React can manage to instantly accessing these variable in the nested array it leads me to believe that there's got to be a lookup table of some kind that we should be able to say something like var unreachableKey = GetKeyFromNestedArray("video-autoplay")??
Big thanks beforehand! :D
Edit Attached code pieces:
This is a very small part of the array structure
This is one of the places i could find the variable and simply placed a breakpoint.
ps. original file said r = t.videoAutoPlay
i changed it to r = t.video-autoplay
to match everything :D