Sandip Chitale | 17 Jul 18:45

Re: [nbajax] Would like a better idea of how javascript debugging is meant to work with templates (e.g. erb/rhtml)

Anthony Richardson wrote:
> Cross posted to nbajax@...
<mailto:nbajax@...> and 
> dev@... <mailto:dev@...>
>
> I wanted to get an idea of what the expected level of functionality 
> the javascript debugger is going to be capable of offering when 
> debugging webpages generated from templates.
>
> I'm using Ruby on Rails and all responses returned to the browser are 
> constructed from erb files (although other templating systems are also 
> available). Basically a erb file is a normal HTML file with support 
> for embedded ruby code. Rails constructs the responses by merging many 
> erb files to create the resulting response to the user. Often the same 
> erb file is called many times with different parameters for 
> constructing things like lists etc..
>
> Is it expected that developers will be able to place breakpoints in 
> these erb files in any location and have the debugger resolve the 
> locations of the many source files that may have contributed to the 
> resulting page the user is currently viewing? (I'm not sure that this 
> is even possible without injecting debugging specific markup into the 
> served page as the page construction is a lossy process like compilation).
In 6.5 it is only possible to set the breakpoints in html and javascript 
files as long as the URL as seen by the browser can be mapped to the 
file in the project by simple lookup of the path part of the URL 
relative to the source roots in the project. You will be able to set the 
breakpoints in the HTML that the browser sees in terms of URL. To load 
this html you need to go to the Windows:Debugging:Sources window, select 
the URL and use "Go to Source" action to load it in the editor tab - the 
(Continue reading)

Anthony Richardson | 18 Jul 13:50

Re: [nbajax] Would like a better idea of how javascript debugging is meant to work with templates (e.g. erb/rhtml)

On Fri, Jul 18, 2008 at 2:15 AM, Sandip Chitale <Sandip.Chitale-xsfywfwIY+M@public.gmane.org> wrote:
Anthony Richardson wrote:
Cross posted to nbajax-gVrGfPuBK2Jg9hUCZPvPmw@public.gmane.org <mailto:nbajax-gVrGfPuBK2Jg9hUCZPvPmw@public.gmane.org> and dev-n3CzLFQkLgrXWKka9uoeGti2O/JbrIOy@public.gmane.org <mailto:dev-n3CzLFQkLgrXWKka9uoeGti2O/JbrIOy@public.gmane.org>

In 6.5 it is only possible to set the breakpoints in html and javascript files

Cool, no problem, I couldn't see how debugging templates (erb/rhtml) was going to work so this makes sense. I think something needs to be done to make this more intuative in the IDE however, but will fire a new thread to discuss this.
 
I can also get breakpoints working with included JS files, but only if they don't have parameters(isses #140442)
See above.

I'm not sure what part of what you mentioned above related to this, can you elaborate?
 


In the past I have got the debugger to stop at some breakpoints in a rhtml file that was a single rhtml with no layouts or partials (not the Rails default way of doing things). But the debugging features were broken after it has stopped and there was nothing you could do except cancel the debugging session. I haven't been able to repeat this limited success with later builds and using erb files.
The breakpoints in RHTML file are server side breakpoints. To debug RHTML files you will have to use the technique described above.

I think this is going to cause a lot of end user confusion. As I mentioned I will start another thread about this.
 
Thank you very much for the feedback.

Cheers,

Anthony Richardson


Gmane