title: A "too much recursion" error in Firefox only sometimes?
body: <p>I have a pretty simple thing I'm doing with javascript and basically only sometimes will javascript give me a "too much recursion" error. </p>
  
  <p>The code in question:</p>
  
  <pre><code>if(pageLoad===undefined){
    var pageLoad=function(){}; 
  }
  var pageLoad_uniqueid_11=pageLoad;
  var pageLoad=function(){ 
    pageLoad_uniqueid_11();
    pageLoad_uniqueid_12(); 
  };
  var pageLoad_uniqueid_12=function(){
   alert('pageLoad');
  };
  
  $(document).ready(function(){
     pageLoad();
  });
  </code></pre>
  
  <p>(yes I know there are better way of doing this. This is difficult to change though, especially because of ASP.Net partial postbacks which aren't shown).</p>
  
  <p>Anyway, when the too much recursion error happens, it continues to happen until I restart Firefox. when I restart Firefox it all works as normal again. How do I fix this? </p>
  
  <p>I've also made a <a href="http://jsbin.com/aximey/2" rel="noreferrer">jsbin example</a></p>
  
  <p><strong>Update</strong></p>
  
  <p>Ok I've found out how to reliably reproduce it in our code, but it doesn't work for the jsbin example. If I create a new tab and go to the same page(have two tabs of the same address) and then refresh the first tab <strong>two</strong> times then I get this error consistently. We are not using any kind of session or anything else that I can think of that could cause such a problem to only occur in one tab!</p>
  
  <p><strong>Update 2</strong>
  Not as reliable as I thought, but it definitely only occurs when more than one tab of the same page is open. It'll occur every few reloads of one of the tabs open</p>
  
  <p>I've also updated my code to show an alert when pageLoad(the if statement) is initially undefined and when it is initially defined. Somehow, both alerts are showing up. This code is not duplicated in the rendered page and there is no way that it is being called twice. It is in a top level script element not surrounded by a function or anything! My code ends up looking like</p>
  
  <pre><code>if(pageLoad===undefined){ 
    var pageLoad=function(){}; 
    alert('new'); 
  } else {  
    alert('old'); 
  }
  </code></pre>