Site Navigation

Monday, March 23, 2009

bug 191 - stack overflow at line: 18 in IE

Issue: #191
Affects: IE6, IE7, IE8

Calling this a "bug" is a bit of a stretch but I wanted to post this so that users encountering this error message have an idea what to look for to fix it.

stack overflow at line: 18, stack overflow at line: 25, stack overflow at line: 41, stack overflow at line:67

It occurs only in IE, when you attempt to run code that runs in an infinite loop. Other browsers seem to pick up the recursion and simply ignore/skip over it without any errors.

It happens most commonly when you attempt to redefine the same method twice, which often happens as a side-issue of overwriting broken IE method implementations.

The actual line number in the message will change, but should be a fairly accurate indicator of where the call is that is causing the infinite loop.


<script type="text/javascript">
function fixGetElementsByNameInIE(){
//save ref to original method
document._getElementsByName = document.getElementsByName;
//now redefine it
document.getElementsByName = function(name){
var origResults = document._getElementsByName(name);
//... code to fix it...
return correctResults;

If you called fixGetElementsByNameInIE() more than once in IE when you try to actually run document.getElementsByName(name) IE will complain about a stack overflow as it ends up in an endless loop.

Known Workarounds: One. Never re-define a method in IE that points back to itself.

Related Issues: None.

Bug/Site Feedback |
Submit a bug