...

View Full Version : Advanced Debug Info



Koabi
06-24-2004, 02:41 PM
Hi,
I'm writing a Javascript that helps one to find errors in other Javascript code, but in comparsion to the default error reports this one gives you a function call history, that means you will see on what way the function was called anyway (eg... start() called generateinfo() called parsestring() called findPattern()) as well as the parameters handed over to each of those functions (parsestring(string="Hallo Welt!"...) and it checks every object in the error producing line if it exists ("hallo" is not valid in "document.forms.hallo.style"...) so you mostly can see the error immidiately. I optimized my code so far that it will detect if the object is an function a var declared in the error-throwing function before the error occures or a global var/object.
Just take a lool at http://www.koabi.de/etz/?debug=1 and press the Produce Error button.
Note that this code works with Internet Explorer (6?) only.
I'm still working on it but when it's ready all you will have to do is copying 2 files to a subdir calles "debug" and add "<script src=debug/debug.js>".
Just wanted to know if there is interest in such a tool.

Acid
06-24-2004, 03:35 PM
That sounds like quite a good idea, epecially if it will be able to tell you exactly what line the error is on and what specifically is wrong with the script. The default "Error On Page" generated by Internet Explorer usually isn't helpful, it does tell you the line and character and whats wrong, however a lot fo the time this isn't even correct, I've come across that a few times in the past and the error turned out to be something completely different. With the built in error message in Internet Explorer being about as helpful as a Japanese VCR instruction manual i'd imagine a few people will be interested in this.

Vladdy
06-24-2004, 03:47 PM
Not so sure, it will be helpful.
Initial script development is done using Moz that has plenty of debugging tools. When time comes to adjust the code for IE stoopidity, the general implementation bugs are taken care of.

Willy Duitt
06-24-2004, 04:17 PM
FWIW: Using IE 6.2 I got nothing.
Nothing on your site work for me including your links.
Could be my security settings and although I am interested in such a thing, I am not interested in relaxing my settings.

.....Willy

Koabi
06-24-2004, 04:30 PM
I dont know IE 6.2 but after installing ServicePack2 on WinXP running Javascripts in IE often is blocked and there is kind of a banner in the top of the site where you can allow Javascripts to be ran.
What links do you mean?

Willy Duitt
06-24-2004, 05:04 PM
console, help, ect....

Koabi
06-24-2004, 05:41 PM
Ok, now i know, those are Javascript too. I coded some window manager with tabs, so when you click a link it changes to that tab without changing the page, so if you have JS disabled it's clear why they don't work. I think I got to get IE 6.2 myself to see what's the problem.

Willy Duitt
06-24-2004, 05:44 PM
I do not have javascript disabled. I have Active X, Flash and VBS disabled (perhaps a few others. I would have to check) but not javascript. (I wouldn't hang out in a javascript forum if I did) ;)

.....Willy

BTW: If this helps....
Detected: Windows XP SP1 (WinNT 5.01.2600)
Detected: Internet Explorer v6.00 SP1 (6.00.2800.1106)

Edit: oooh;

Apparently, somehow I lost 6.2
I wonder if this was caused by corrupting my profile in some way?
I will need to check if those values are correct.

Koabi
06-25-2004, 12:43 PM
Do you get a Javascript Error by IE? It's odd, i tried my scripts on various PCs, all having IE 6.0 and it works on all of them, I have no idea why it isn't working at yours. It would be great if you could give me some more information, a screenshot maybe of the page as it is displayed in your browser.

Willy Duitt
06-25-2004, 12:57 PM
Line: 4
Char: 2
Error: 'document.all.grizly.style'
is null or not an object...

Attached is a screenshot.
Hope that helps;
.....Willy

Willy Duitt
06-25-2004, 01:01 PM
BTW: That error was thrown after clicking on the Debug Button and previously clicking on console....

Koabi
06-25-2004, 05:33 PM
Thx, so thats the error that is produced, but what should come is a popup with this content (http://www.koabi.de/etz/sample.html).
When you said the links do not work, did you mean clicking the links results in to nothing happening or results to an empty window that means the Bootlog disappears what would mean the links are working as the console and help tabs are empty at the moment.

Willy Duitt
06-25-2004, 05:57 PM
I'm not getting any windows or popups and I just tried again with my popup blocker off but I knew that was not the problem since I never previously recieved an alert. All that happens when I click on console is the orginal box beneath that menu bar disappears and when I click on debug, I get that error.

Like I orginally said. This probably has something to do with my security settings. I haven't bothered looking at the source but if you are using any type of Microsoft proprietary scripting, I have that blocked. If you are scripting cross domain, blocked. Loading into an iframe, blocked. Java, blocked....

If noone else has reported these problems, I would not worry about it.


.....Willy

SpiritualStorms
06-25-2004, 11:57 PM
That sounds like quite a good idea, epecially if it will be able to tell you exactly what line the error is on and what specifically is wrong with the script. The default "Error On Page" generated by Internet Explorer usually isn't helpful, it does tell you the line and character and whats wrong, however a lot fo the time this isn't even correct, I've come across that a few times in the past and the error turned out to be something completely different. With the built in error message in Internet Explorer being about as helpful as a Japanese VCR instruction manual i'd imagine a few people will be interested in this.


I totally agree. Additionally, what constitutes a line? Does it mean that the first first tag of a document is a line? Or a line from the actual script? Over-all, i agree with the fact that the debugger isnt very precise at all in telling us what exactly is the nature of the problem.

Koabi
06-26-2004, 08:48 AM
The line is always the line of the file where the script is written in, so html-lines do count, but when the script isn't in the mainfile you will get the line of the scriptfile. Unhappilly due to a bug in IE you do not get the correct url always when getting a error message. I wrote my debugger to search all included script files and find the correct one and it seems to work allright. Out of that IE gives back the line after the error producing line usaly, so my script corrects that number, prints you the whole function code and highlights that line with the error. Furthermore it parses all objects in that line and checks wich elements could be wrong. So when you have eg alrt(document.all.frm.style.color); it will find out that alrt is not a valid object/function and it start checking the parts of document.all.frm.style.color from the first element to the last until there is an error (in this case document.all will be ok but then document.all.frm would be wrong). Just visit that links written before to see what I mean.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum