Debugging dynamically loaded JS scripts

442 views
Skip to first unread message

StuperUser

unread,
Oct 12, 2011, 7:30:44 AM10/12/11
to Firebug
Some scripts are loaded via XHR requests (script tags in html server
responses that are put into the DOM using jQuery AJAX functions).

How can I set breakpoints and debug these?

Sebo

unread,
Oct 12, 2011, 9:38:36 AM10/12/11
to fir...@googlegroups.com
Just make sure you have all selected as script type. Then as soon as the AJAX request is done the new code should be listed inside the Script Location Menu. Please see the Firebug terminology in the case it's unclear what is meant.

Sebastian

StuperUser

unread,
Oct 12, 2011, 10:59:00 AM10/12/11
to Firebug
Hi Sebastian,

Thanks for that the terminology links are great for clarity.

Unfortunately the scripts aren't appearing in the Script Location
Menu.

I am using Firebug version 1.8.3 and Firefox version 7.01, but this is
an issue for all of my colleagues with various combinations of FB
versions and FF versions.

On Oct 12, 2:38 pm, Sebo <sebastianzart...@gmx.de> wrote:
> Just make sure you have all selected as script type<http://getfirebug.com/wiki/index.php/Script_Panel#Script_Type_Menu>.
> Then as soon as the AJAX request is done the new code should be listed
> inside the Script Location Menu<http://getfirebug.com/wiki/index.php/Script_Panel#Script_Location_Menu>.
> Please see the Firebug terminology<http://getfirebug.com/wiki/index.php/Firebug_Terminology>in the case it's unclear what is meant.
>
> Sebastian

Pedro Simonetti Garcia

unread,
Oct 12, 2011, 2:52:57 PM10/12/11
to fir...@googlegroups.com
Try inserting this line in your script where you want the code to be stopped:

debugger;

Then, when you load that script via XHR it should stop on that line.

Pedro Simonetti.

2011/10/12 StuperUser <tomma...@hotmail.com>
>
> Sebastian

--
You received this message because you are subscribed to the Google Groups "Firebug" group.
To post to this group, send email to fir...@googlegroups.com.
To unsubscribe from this group, send email to firebug+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/firebug?hl=en.


StuperUser

unread,
Oct 20, 2011, 7:49:22 AM10/20/11
to Firebug
Unfortunately this doesn't work.

On Oct 12, 7:52 pm, Pedro Simonetti Garcia <pedrosimone...@gmail.com>
wrote:
> Try inserting this line in your script where you want the code to be
> stopped:
>
> debugger;
>
> Then, when you load that script via XHR it should stop on that line.
>
> Pedro Simonetti.
>
> 2011/10/12 StuperUser <tommath...@hotmail.com>

Pedro Simonetti Garcia

unread,
Oct 20, 2011, 9:17:22 AM10/20/11
to fir...@googlegroups.com
Could you please post a sample code showing how you're loading that script?

Also, please try in a clean profile and let us know if the problem persists:
http://getfirebug.com/wiki/index.php/FAQ#Installing_in_a_clean_profile

regards,

Pedro Simonetti.

2011/10/20 StuperUser <tomma...@hotmail.com>

Sebo

unread,
Oct 25, 2011, 1:15:39 AM10/25/11
to fir...@googlegroups.com
Generally you should always follow the instructions at the following page in case you found a bug:

http://getfirebug.com/wiki/index.php/I_found_a_Firebug_Bug!

As Pedro already mentioned the most important thing is to create a reproducible test case. So we can see the same problem you are having.
Because all your workmates have the same problem, it seems not to depend on OS or Firefox version. So either it's really a bug in Firebug or there's something wrong with how your script is loaded.

Sebastian
Reply all
Reply to author
Forward
0 new messages