0
  1. Function call: I'm looking to implement an strace like functionality in javascript. That is, I'd like to log all function calls and potentially its arguments, in the order of function calls. Note that I'd like to do this in a stand alone js interpreter / headless browser, so browser plugins isn't going to help.

  2. Attribute access: Also, is there a way to log every attribute access?

I imagine there may be a way to monkey patch Object functions at the time of attribute access and function invocation? If now, may be do something with javascript engine?

Update: https://stackoverflow.com/a/23103992/1179293 seems to answer #1, with known limitations. Attribute access (#2) still remains unanswered

Community
  • 1
  • 1
zonked.zonda
  • 347
  • 1
  • 5
  • 19
  • @HectorBarbossa see update regarding use of firebug. – zonked.zonda Jun 21 '16 at 23:15
  • @MikeC agree, that's the best answer so far on Question 1 – zonked.zonda Jun 21 '16 at 23:16
  • 1
    @zonked.zonda You'll never be able to trace every single property lookup but you can wrap objects [in a `Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) and track the property accesses of those objects. – Mike Cluck Jun 21 '16 at 23:49

0 Answers0