zozo
zozo

Reputation: 8612

firebug - how can I detect what functions have been called or from where a function has been called

I am trying to optimize a script and I'm using firebug profiler to see what functions use most time to start from there.

My problem is that the script uses jQuery and raphaeljs and their functions, events etc are listed as "anonymous". All of them.

As you can see in the image below everything I defined appears with name.

Here's a image of what I see (the image is readable just zoom a bit (ctrl + "+")).

enter image description here

Since I don't plan to modify jQuery or raphael I don't really care what's the name of the function called (tho it would be nice to know) but I'm really interested on where did that function has been called from (to see if I can reduce the number of calls or something). Any idea how to do that?

Thank you for your help.

Upvotes: 0

Views: 2328

Answers (2)

Alberto De Caro
Alberto De Caro

Reputation: 5213

In Firebug, use the stack panel to identify who is calling and who has been called. During the debug process, use the unminified version of the scripts in order to breakpoint in the proper positions.

Upvotes: 3

Ved
Ved

Reputation: 8777

To find which function called the current function use this :

alert(arguments.callee.caller.name);

This will alert the name of caller function. You can also use hierarchy like this :

arguments.callee.caller.caller.name 

Upvotes: 2

Related Questions