- This topic has 3 replies, 2 voices, and was last updated 16 years, 4 months ago by Riyad Kalla.
-
AuthorPosts
-
Walter StovallMemberI want to debug some javascript that comes from html that’s assembled at runtime by the application. What the app does is treat the “.html” file as something of a template with placeholders for runtime-generated content. While this should be done with a technology like JSP, this application already exists and I need to work on it.
So if I view the html and set a breakpoint on a javascript line inside a script element, I apparently never hit my breakpoint because the URL the client references doesn’t refer to the html file? Instead, my servlet programmatically accesses that file while delivering content to the client.
For example, let’s say I have an html file called my_app.html. My servlet is programmed to respond to a url like http://localhost:8080/myapp/home by opening my_app.html, plugging in some runtime content like the user’s name and streaming that to the client.
So apparently the javascript debugger has no way to relate the file with my breakpoint in it to the content the client browser received?
Do I need to externalize my JavaScript code into files that are separate from these html fragments? Or is there maybe a simpler strategy that doesn’t impact this existing application that much?
Thanks for your help.
Riyad KallaMemberWhen you are viewing your app using the Web 2.0 Workbench, as you work with the app, in the DOM view are you seeing the updated/correct values including the JavaScript you are injecting from the server side?
Walter StovallMemberI didn’t realize I could wait till then to set breakpoints. But I set my AJAX preferences to suspend-at-start. And the debugger shows my html plus javascript when I start my javascript-debug launch configuration on the debug menu. The only enabled tools on the debugger toolbar are green/go and red/stop (no step into, etc). I double-click in the margin to set a breakpoint on the first line of code in the script tag and see visual confirmation that my breakpoint is set. Press the green/go and I don’t hit that breakpoint.
Then I filled out a form on this page and hit Submit. The debugger did not stop at any subsequent page loads until I launched a new debug session.
Riyad KallaMemberHmm it sounds like the JS debugger isn’t digesting the new code right away coming back to it. I know we are doing a lot of work on JavaScript in 7.0, I’ll make a note of us to check into this for that release. Sorry about the hickup.
Q: You know about using the browser view to browse to your particular page and then hitting the little “Bug” icon to start a debug session right there on that particular page right? (Might be an easier workflow for you)
-
AuthorPosts