glenatron
glenatron

Reputation: 11362

"Stack overflow in line 0" on Internet Explorer

I realise this is not the ideal place to ask about this in terms of searchability, but I've got a page whose JavaScript code throws "Stack overflow in line 0" errors when I look at it in Internet Explorer.

The problem is quite clearly not in line 0, but somewhere in the list of stuff that I'm writing to the document. Everything works fine in Firefox, so I don't have the delights of Firebug and friends to assist in troubleshooting.

Are there any standard causes for this? I'm guessing this is probably an Internet Explorer 7 bug or something quite obscure, and my Google-fu is bringing me little joy currently. I can find lots of people who have run into this before, but I can't seem to find how they solved it.

Upvotes: 37

Views: 250651

Answers (13)

Mitchel Sellers
Mitchel Sellers

Reputation: 63126

You can turn off the "Disable Script Debugging" option inside of Internet Explorer and start debugging with Visual Studio if you happen to have that around.

I've found that it is one of few ways to diagnose some of those IE specific issues.

Upvotes: 16

Max
Max

Reputation: 804

I have reproduced the same error on IE8. One of the text boxes has some event handlers to replace not valid data.

$('.numbersonly').on("keyup input propertychange", function () {
    //code
});

The error message was shown on entering data to this text box. We removed event "propertychange" from the code above and now it works correctly.

P.S. maybe it will help somebody

Upvotes: 1

Muhd
Muhd

Reputation: 25576

My was "at line 1" instead but...

I got this problem when using jQuery's .clone method. I replaced these by using making jQuery objects from the html string: $($(selector).html()).

Upvotes: 1

pmaruszczyk
pmaruszczyk

Reputation: 2165

In my case I had two functions a() and b(). First was calling second and second was calling first one:

var i = 0;
function a() { b(); }
function b() {
  i++; 
  if (i < 30) {
    a();
  }
}

a();

I resolved this using setTimeout:

var i = 0;
function a() { b(); }
function b() {
  i++; 
  if (i < 30) {
    setTimeout( function() {
      a();
    }, 0);
  }
}

a();

Upvotes: 0

Manisha
Manisha

Reputation: 1

This is problem with Java and Flash Player. Install the latest Java and Flash Player, and the problem will be resolved. If not, then install Mozilla Firefox, it will auto install the updates required.

Upvotes: -16

Ross Boucher
Ross Boucher

Reputation: 702

I ran into this problem recently and wrote up a post about the particular case in our code that was causing this problem.

http://cappuccino.org/discuss/2010/03/01/internet-explorer-global-variables-and-stack-overflows/

The quick summary is: recursion that passes through the host global object is limited to a stack depth of 13. In other words, if the reference your function call is using (not necessarily the function itself) was defined with some form window.foo = function, then recursing through foo is limited to a depth of 13.

Upvotes: 31

devsnd
devsnd

Reputation: 7722

If you came here because you had the problem inside your selenium tests: IE doesn't like By.id("xyz"). Use By.name, xpath, or whatever instead.

Upvotes: 3

Tillito
Tillito

Reputation: 7858

I set up a default project and found out the following:

The problem is the combination of smartNavigation and maintainScrollPositionOnPostBack. The error only occurs when both are set to true.

In my case, the error was produced by:

<pages smartNavigation="true" maintainScrollPositionOnPostBack="true" />

Any other combination works fine.

Can anybody confirm this?

Upvotes: 2

FasoService
FasoService

Reputation: 133

I don't know what to tell you, but the same problem occured with jQuery table sorting and SEARCH. When there is nothing left in the table, where you are searching a string for example, you get this error too. Even in Google Analytics this error occurs often.

Upvotes: 0

massoud
massoud

Reputation: 71

I had this problem, and I solved it. There was an attribute in the <%@ Page tag named MaintainScrollPositionOnPostback and after removing it, the error disapeared. I added it before to prevent scrolling after each postback.

Upvotes: 7

glenatron
glenatron

Reputation: 11362

Aha!

I had an OnError() event in some code that was setting the image source to a default image path if it wasn't found. Of course, if the default image path wasn't found it would trigger the error handler...

For people who have a similar problem but not the same, I guess the cause of this is most likely to be either an unterminated loop, an event handler that triggers itself or something similar that throws the JavaScript engine into a spin.

Upvotes: 20

Janaka senatilleke
Janaka senatilleke

Reputation: 19

  1. Internet Options
  2. Tools
  3. Internet options
  4. Advanced
  5. Navigation section
  6. Click > Disable script debugging

    display a notification about every script error

  7. sign in
  8. You will smile !

Upvotes: 1

CDev
CDev

Reputation: 21

Also having smartNavigation="true" causes this"

Upvotes: 2

Related Questions