MyEclipse: [TIP] Debugging code downloaded by Dojo

nvintila - May 12, 2006 - 08:14 PM
Post subject: [TIP] Debugging code downloaded by Dojo
Thanks for the JS debugger.

I am evaluating it and i can only get it to stop in JS code embedded in the HTML file i started with or the scripts listed in the head. We use Dojo and most of the JS code gets downloaded on demand: scripts are downloaded by Dojo and eval()-ed.

Is this debugger supposed to debug this JS code too?

I am currently trying to change Dojo to emit includes <script></script> for the scripts Dojo imports/requires/downloads.

I am having some success but i am breaking the internal state of the widget manager in Dojo.

Do you guys already have a solution to this?

Thanks
Nick
nvintila - May 13, 2006 - 07:03 PM
Post subject:
I figured out how to use something from Dojo to achieve this.

1) Include browser_debug.js after dojo.js
Code:

<script type="text/javascript" src="../../dojo/dojo.js"></script>
<script type="text/javascript" src="../../turbo/turbo.js"></script>
<script type="text/javascript" src="../../dojo/src/browser_debug.js"></script>
 

2) Call writeIncludes after the last dojo.require from the HTML file you debug.
Code:

dojo.hostenv.writeIncludes();


This sequence effectively overrides the default code loading mechanism in Dojo (see loadUri from browser_debug.js) and emits <script/> snippets in the head of the document thus convincing the browser to download the scripts itself. Using a smart technique this new loadUri includes the scripts in the correct order based on their dependencies.

Good luck
Nick
support-rkalla - May 13, 2006 - 10:53 PM
Post subject:
Nick,
Thank you for following up for the benefit of others, great tip. I'm going to make it sticky.
pompiuses - Feb 19, 2009 - 02:46 PM
Post subject:
I know this is an old thread, but I'm having trouble debugging using dojo 1.1.1.

There's no dojo/src/browser_debug.js or dojo.hostenv.writeIncludes() anymore.

Have someone found a good solution to setting breakpoints in your own dojo widgets using the MyEclipse javascript debugger?

Thanks!
All times are GMT - 6 Hours
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits