0

How can I (if I can, at all) read captured variables in a function's closure given a function object in Chrome or Firefox?

Chrome development tools let me examine closures if I print an object in the console, so there ought to be a debugging API of a sort, which I'd like to use from a script. This is not production code, so I can put the browser in some sort of "debug mode" if I have to.

Alex B
  • 82,554
  • 44
  • 203
  • 280
  • 1
    possible (partial) duplicate of [Is it possible to gain access to the closure of a function?](http://stackoverflow.com/questions/11192875/is-it-possible-to-gain-access-to-the-closure-of-a-function) – Denys Séguret Feb 20 '13 at 13:28
  • @dystroy The question linked only has a bunch of non-answers, though. I am open to use "unofficial" methods (like a debug API) to get the data I need, so the question has a slightly different angle. – Alex B Feb 20 '13 at 13:43
  • I understand that you're open to solutions working only in some kind of debug mode. That's why I completed my comment with `(partial)`, even if I think this was debated before and at that time. – Denys Séguret Feb 20 '13 at 13:45
  • Why would you need to inspect them by a script? What's wrong with just using the developer tools? Btw, Opera's Dragonfly is open-source and you could build something on their debugging protocol – Bergi Feb 20 '13 at 14:10
  • @Bergi I need automation. I'm scraping transaction data from my bank account with Selenium, and now they've changed storage from a global var to a private object inside a closure. – Alex B Feb 21 '13 at 00:57

0 Answers0