Enumerate functions from a jsdIScript?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Enumerate functions from a jsdIScript?

erwan
Hi,

I'm trying to write a code coverage extension for Firefox. To do that
I need to list all existing functions in a given script to know what
percentage of methods is actually called.

So far I found how to enumerate through all scripts and get
jsdIScript, but I can't find any way to enumerate functions. Of course
I could use a functionHook, but it will only tell me about function
that get called (and precisely I need to know about functions that are
not called to alert the developer!)

Is there a way to enumerate functions?


Thank you,
Erwan
_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger
Reply | Threaded
Open this post in threaded view
|

Re: Enumerate functions from a jsdIScript?

John J Barton
On 4/20/2010 2:55 AM, Erwan wrote:
> Hi,
>
> I'm trying to write a code coverage extension for Firefox. To do that
> I need to list all existing functions in a given script to know what
> percentage of methods is actually called.

Each jsdIScript corresponds to one function in the source code.

>
> So far I found how to enumerate through all scripts and get
> jsdIScript, but I can't find any way to enumerate functions. Of course
> I could use a functionHook, but it will only tell me about function
> that get called (and precisely I need to know about functions that are
> not called to alert the developer!)
>
> Is there a way to enumerate functions?

Do you mean "is there a way to enumerate all of the JS function objects
reachable from global scope"? Yes, iterate the properties and ask each
if they are a function.

Do you mean "is there a way to enumerate all of the JS function objects
known to the JS engine"? Not in Javascript.

jjb

>
>
> Thank you,
> Erwan

_______________________________________________
dev-apps-js-debugger mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-js-debugger