Yes!!

On 6/25/14, 8:15 AM, Jason Orendorff wrote:
We're considering building a JavaScript API for dynamic analysis of JS code.
Here's the sort of thing you could do with it:

  - Gather code coverage information (useful for testing/release mgmt?)

Yes! We'd absolutely love to show code coverage in the debugger's source editor! We've played with implementations based on Debugger.prototype.onEnterFrame and hidden breakpoints, but it is pretty slow and feels like a huge hack. Would this work likely yield improved performance over that approach?


  - Trace all object mutation and method calls (useful for devtools?)


Absolutely! A thousand times yes! We've made a prototype tracing debugger (again, based on Debugger.prototype.onEnterFrame) but (again) it is pretty slow so it isn't pref'd on by default (a few other reasons as well; it needs polish).

We (devtools) have talked a lot about wanting to be the "best printf debugger" to lower the barriers to entry for people who normally print debug. Manually adding printfs is like a really crappy, temporary, tracing debugger; I see huge opportunities for developer productivity here!

(Flip devtools.debugger.tracer to see the prototype: http://i.imgur.com/E3jtaxv.jpg)

  - Record/replay of JS execution (useful for devtools?)

I'm drooling aaaahhhhhhhhhh

  - Detect when a mathematical operation returns NaN (useful for game
    developers?)

This would be a great fit for a console warning, IMO.


Note that the API would not directly offer all these features. Instead, it
would offer some powerful but mind-boggling way of instrumenting all JS
code. It would be up to you, the user, to configure the instrumentation, get useful data out of it, and display or analyze it. There would be some overhead
when you turn this on; we don't know how much yet.

Would the API be something like DTrace? Just want to figure out what kind of thing we are talking about here.


We would present a detailed example of how to use the proposed API, but we are
so early in the process that we're not even sure what it would look like.
There are several possibilities.

We need to know how to prioritize this work. We need to know what kind of API we should build. So we're looking for early adopters. If that's you, please
speak up and tell us how you'd like to instrument JS code.


/me raises hand

Mostly interested in tracing calls and mutations. Also code coverage, but to a bit of a lesser extent.

Record/replay is such a holy grail (eclipsed only by "time traveling" / reverse and replay interactive (as opposed to a static recording) debugging with live, on-stack code editing) that I hesitate to even get my hopes up...

Nick
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to