views:

84

answers:

6

I am trying to debug a large and complex webapp that makes heavy use of DIVs, AJAX, dynamic HTML and server-side code to do its job.

Under normal operation we do not have problems. However, when we put the webapp into an IFRAME, certain functions trigger a crash in IE7 that renders the browser inoperable (all CPU used).

What tools exist to help track down what could be happening? Loading the IE process into the debugger gives me all sorts of fascinating info about the registers, but I think the issue is in javascript.

We have tracked down one problem with the app already that involved incorrect reparenting of an element (something attached itself to window. instead of document.)

I wrote a test IFRAME page that dumps the innerHTML of the iframe into a textarea, so it can be compared during various states, but that only shows me static attributes, I can't tell what sort of javascript events are associated with elements or determine if a handler is firing out of turn.

IE8, Firefox, Chrome etc do not have the same behaviour.

Ideally I'd like something that would let me snapshot the DOM (or the javascript VM?) during a known good state, then "just before it happens" so we can figure out what's added / removed / missing / different. What is out there?

Update: I'm now trying to use the IE Developer Toolbar to track it down.

Update 2: The IE7 crash occurs following this AJAX code:

function Sys$UI$Control$get_element() {
    /// <value domElement="true" locid="P:J#Sys.UI.Control.element"></value>
    if (arguments.length !== 0) throw Error.parameterCount();
    return this._element;
}

The return this._element; line is the last thing that happens before I lose IE.

+6  A: 
  1. IE Developer's Toolbar. Download it here.
  2. For JavaScript debugging refer this blog.
Ankit Jain
Awesome, forgot about that. I was using the ancient Microsoft Script Debugger, and it at least found the "last good function call before death" - something in Microsoft.Ajax.js...
mwalker
It is embedded by default in IE 7 and above. For 6 and below u need to download toolbar.
Amit Ranjan
A: 

The IE developer toolbar definitely helps alot. Visual Studios's debugger is also very good if you can get a machine with VS and IE7 on it.

Wyatt Barnett
My test VM had Visual Studio Web Developer on it, but I could never get the debugger to kick in so I could step through the code. I ended up using the ancient Microsoft Script Debugger to find the specific crash point.
mwalker
+1  A: 

By placing 'debugger' in the javascript files in places where you'd like to start debugging you can debug the javascript in visual studio as well complete with trace, call stacks, etcetera.

Martijn Laarman
+2  A: 

Some guy made a bundle that's called Internet Explorer Collection. It includes some 6 different IE browsers ranging from IE6 to IE8 in different builds. All those include Firebug (really, it sort of works) and Internet Explorer Developer Toolbar.

It was really helpful for me to debug IE7 issues.

see this link.

Jasper
A: 

DynaTrace is a profiling tool for IE7. However, it provides a great deal of information (including JS stacks), so it can also be very helpful for debugging.

mikemanne
A: 

IE 7 and IE 8 has built in debugging tools. Press F12 and you are ready to debug. Also firebug-firefox and chrome's inspect element options are useful/

Amit Ranjan
That's only built-in to IE8, and Chrome and Firefox do not exhibit the crash.
mwalker