Re: Debugger does not break into code
"7stud" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.jsdebugger |
|---|---|
| Message-ID | <[email protected]> |
> <html>
> <head>
> <script type="application/x-javascript"
> src="piggy-bank.js"/>
> <script language="javascript">
> function getStore2() {
> debugger
> getStore();
> }
> </script>
> </head>
> <body>
> <span onclick="alert('a'); getStore2();">click me</span>
> </body>
> </html>
Here, I'll be Venkman for you:
Error: line 8: GetStore() does not exist.
The rest of your post is unintelligible, although I too have used debuggers
before, and Venkman does not work for me with Firefox1.0 on Win98. If I
have two lines like this:
1)var a=10;
2)var b = 10;
After I step from line 1 to line 2, the debugger says a is undefined.
"David Huynh" <[email protected]> wrote in message
news:[email protected]...
> Hi,
>
> I'm having problem using the JS debugger. I'm reading this guide
> http://www.svendtofte.com/code/learning_venkman/basics.php
> to find out how to use the debugger, and although I've used plenty of
> debuggers in the past, I can't figure out how this Venkman thing works.
>
> I have a pretty simple HTML file here:
>
>
> And I followed these steps:
> 1. start Mozilla
> 2. open the JS debugger and click on the Stop button (gosh, I didn't
> expect to click "stop" to _start_ my debugging task)
> 3. load the HTML file in Mozilla browser
> 4. go to the JS debugger and set the right evaluation context
> 5. refresh the browser. The JS debugger does break into the script file
> piggy-bank.js (containing a bunch of functions) and I let it runs through.
> 6. click on the span "click me". The alert "a" comes up but then nothing
> else happens. It doesn't matter if I set any breakpoint in getStore2()
> or getStore(). The debugger keyword doesn't help either.
>
> Then I got clever and put in a function call to getStore() at the end of
> piggy-bank.js so that step #5 above would let me debug the function
> getStore(). The debugger does go into getStore(), which is something
> like this:
>
> function getStore() {
> debugger
> var RDF = Components.classes['@mozilla.org/rdf/rdf-service;1']
> .getService(Components.interfaces.nsIRDFService);
> ...
> }
>
> I hit F11 to step into at every point, but then when it reaches the
> assignment statement (RDF = ...), F11 seems to behave like F5--Venkman
> does not stop at the next statement. Frankly I don't know where it goes
> after I hit F11 at the assignment statement.
>
> Then I got even more clever and tried to paste the body of getStore() in
> the middle of step #5 above. But alas, the little textbox in Venkman
> only takes one line of text!
>
> I'm running Mozilla 1.7.2, Venkman 0.9.81. Venkman seems to be choking
> the daylight out of Mozilla.
>
>
>
> So I have 2 questions:
>
> 1. What should I do if I want to debug the function getStore()?
>
> 2. How did those folks that develop various Mozilla-based applications
> refrain from killing themselves with this kind of debugging support?
> Seriously, I have great respect for the Mozilla product from an
> engineering standpoint, but the documentation and developer support
> are... Are they using some other tricks to debug their JS code?
>
> Forgot to mention, the HTML file was originally a XUL. But Venkman
> doesn't even seem to handle XUL...
>
> Thanks in advance!
>
> David