Re: Enumerate functions from a jsdIScript?

johnjbarton <[email protected]> Tue, 20 Apr 2010 06:51:40 -0700
Newsgroups gmane.comp.mozilla.devel.jsdebugger
Message-ID <[email protected]>
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