facebook

[TIP] Debugging code downloaded by Dojo

  1. MyEclipse Archived
  2.  > 
  3. Web 2.0 / AJAX
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #251982 Reply

    nvintila
    Member

    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

    #252007 Reply

    nvintila
    Member

    I figured out how to use something from Dojo to achieve this.

    1) Include browser_debug.js after dojo.js

    
    <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.

    
    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

    #252009 Reply

    Riyad Kalla
    Member

    Nick,
    Thank you for following up for the benefit of others, great tip. I’m going to make it sticky.

    #295049 Reply

    pompiuses
    Member

    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!

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: [TIP] Debugging code downloaded by Dojo

You must be logged in to post in the forum log in